准备

开始

1. 创建虚拟主机

创建虚拟主机

2. 初始化网盘

# 创建网盘目录
cd /opt
mkdir cloudreve
cd cloudreve

# 下载程序
wget https://github.com/cloudreve/Cloudreve/releases/download/3.3.1/cloudreve_3.3.1_linux_amd64.tar.gz

# 解压程序
tar xf cloudreve_3.3.1_linux_amd64.tar.gz && rm -f cloudreve_3.3.1_linux_amd64.tar.gz

# 初始化程序
./cloudreve

root@iZj6c4r627vc7uaugviqojZ:/opt/cloudreve# ./cloudreve 

   ___ _                 _                    
  / __\ | ___  _   _  __| |_ __ _____   _____ 
 / /  | |/ _ \| | | |/ _ | '__/ _ \ \ / / _ \	
/ /___| | (_) | |_| | (_| | | |  __/\ V /  __/
\____/|_|\___/ \__,_|\__,_|_|  \___| \_/ \___|

   V3.3.1  Commit #a1252c8  Pro=false
================================================

[Info]    2021-06-04 00:40:27 初始化数据库连接
[Info]    2021-06-04 00:40:27 开始进行数据库初始化...
[Info]    2021-06-04 00:40:28 初始管理员账号:admin@cloudreve.org
[Info]    2021-06-04 00:40:28 初始管理员密码:******
[Info]    2021-06-04 00:40:28 数据库初始化结束
[Info]    2021-06-04 00:40:28 初始化任务队列,WorkerNum = 10
[Info]    2021-06-04 00:40:28 初始化定时任务...
[Info]    2021-06-04 00:40:28 当前运行模式:Master
[Info]    2021-06-04 00:40:28 开始监听 :5212

3. 修改 Nginx 配置

nano /usr/local/nginx/conf/vhost/pan.gentrabbit.moe.conf

location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://127.0.0.1:5212;
}

4. 重启 Nginx 服务

systemctl restart nginx

5. 配置 Cloudreve 服务

nano /etc/systemd/system/cloudreve.service

[Unit]
Description=Cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
After=mysqld.service
Wants=network.target

[Service]
WorkingDirectory=/opt/cloudreve
ExecStart=/opt/cloudreve/cloudreve
Restart=on-abnormal
RestartSec=5s
KillMode=mixed

StandardOutput=null
StandardError=syslog

[Install]
WantedBy=multi-user.target

6. 启动 Cloudreve 服务

systemctl daemon-reload
systemctl enable --now cloudreve