Cloudreve 安装步骤
1. 环境准备
在开始安装 Cloudreve 之前,请确保您的系统满足以下要求:
-
操作系统: Linux、Windows 或 macOS
-
数据库: MySQL 5.7+ 或 SQLite3
-
Web 服务器: Nginx 或 Apache(可选)
-
PHP: 7.2+(如果使用 PHP 版本)
2. 下载 Cloudreve
您可以从 Cloudreve 的 GitHub 仓库或官方网站下载最新版本的安装包。
# 使用 wget 下载
wget https://github.com/cloudreve/Cloudreve/releases/download/3.x.x/cloudreve_3.x.x_linux_amd64.tar.gz
# 解压
tar -zxvf cloudreve_3.x.x_linux_amd64.tar.gz
3. 配置数据库
使用 MySQL
-
创建一个新的数据库和用户:
CREATE DATABASE cloudreve; CREATE USER 'cloudreve'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON cloudreve.* TO 'cloudreve'@'localhost'; FLUSH PRIVILEGES;
修改 conf.ini
文件以使用 MySQL 数据库:
[Database]
Type = mysql
Host = 127.0.0.1
Port = 3306
User = cloudreve
Password = your_password
Name = cloudreve
使用 SQLite3
如果您选择使用 SQLite3,只需确保 conf.ini
文件中的数据库配置如下:
[Database]
Type = sqlite3
Path = /path/to/cloudreve.db
4. 启动 Cloudreve
在解压后的目录中,运行以下命令启动 Cloudreve:
./cloudreve
首次启动时,Cloudreve 会生成一个管理员账户和密码,请妥善保存。
5. 配置 Web 服务器(可选)
使用 Nginx
-
创建一个新的 Nginx 配置文件:
sudo nano /etc/nginx/sites-available/cloudreve
- 添加以下内容:
server { listen 80; server_name your_domain.com; location / { proxy_pass http://127.0.0.1:5212; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
- 启用配置文件并重启 Nginx:
sudo ln -s /etc/nginx/sites-available/cloudreve /etc/nginx/sites-enabled/ sudo systemctl restart nginx
使用 Apache
-
启用必要的 Apache 模块:
sudo a2enmod proxy proxy_http
- 创建一个新的 Apache 配置文件:
sudo nano /etc/apache2/sites-available/cloudreve.conf
- 添加以下内容:
<VirtualHost *:80> ServerName your_domain.com ProxyPreserveHost On ProxyPass / http://127.0.0.1:5212/ ProxyPassReverse / http://127.0.0.1:5212/ </VirtualHost>
- 启用配置文件并重启 Apache:
sudo a2ensite cloudreve.conf sudo systemctl restart apache2
6. 访问 Cloudreve
打开浏览器,访问 http://your_domain.com
或 http://localhost:5212
,使用首次启动时生成的管理员账户登录。
7. 配置系统服务(可选)
为了让 Cloudreve 在后台运行并随系统启动,您可以将其配置为系统服务。
使用 Systemd
-
创建一个新的 systemd 服务文件:
sudo nano /etc/systemd/system/cloudreve.service
- 添加以下内容:
[Unit] Description=Cloudreve After=network.target [Service] ExecStart=/path/to/cloudreve WorkingDirectory=/path/to/cloudreve Restart=always User=your_user [Install] WantedBy=multi-user.target
- 启用并启动服务:
sudo systemctl enable cloudreve sudo systemctl start cloudreve
8. 完成
至此,Cloudreve 已成功安装并配置完成。您可以根据需要进一步配置存储策略、用户权限等。
© 版权声明
文章版权归原作者所有,如有侵权请联系删除。
THE END
暂无评论内容