Debian安装Cloudreve

Debian安装Cloudreve

wget https://github.com/cloudreve/Cloudreve/releases/download/3.8.3/cloudreve_3.8.3_linux_amd64.tar.gz
mkdir  cloudreve
cd /root/cloudreve
tar zxvf cloudreve_3.8.3_linux_amd64.tar.gz
chmod +x /root/cloudreve/cloudreve
./cloudreve/cloudreve

进程守护,两种方式可任选其一

1.Systemd

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

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

StandardOutput=null
StandardError=syslog

[Install]
WantedBy=multi-user.target

更新配置systemctl daemon-reload

启动服务systemctl start cloudreve

设置开机启动systemctl enable cloudreve

管理命令:

启动服务systemctl start cloudreve

停止服务systemctl stop cloudreve

重启服务systemctl restart cloudreve

查看状态systemctl status cloudreve

2.Supervisor

apt  install supervisor
touch /etc/supervisord.conf
echo_supervisord_conf > /etc/supervisord.conf
nano /etc/supervisord.conf

[program:cloudreve]
directory=/root/cloudreve
command=/root/cloudreve/cloudreve
autostart=true
autorestart=true
stderr_logfile=/var/log/cloudreve.err
stdout_logfile=/var/log/cloudreve.log
environment=CODENATION_ENV=prod

mkdir -p /etc/supervisor/conf
nano /etc/supervisor/conf/cloudreve.conf

文件底部的[include] 分区注释符号;删除,加入新的配置文件包含路径:
[include]
files = /etc/supervisor/conf/*.conf
supervisord -c /etc/supervisord.conf
supervisorctl status cloudreve

通过全局配置文件启动 supervisor:

supervisord -c /etc/supervisord.conf

通过以下指令管理 Cloudreve 进程:

启动supervisorctl start cloudreve

停止supervisorctl stop cloudreve

查看状态sudo supervisorctl status cloudreve

cloudreve.service.rar (319 字节)