同时部署多个Openlist程序
前言
用openlist官方提供的一键脚本可以轻松的让我们将openlist部署到我们的服务器中,但是这种方法只能部署一个openlist程序,如果我们想要部署第二个或者多个openlist程序要怎么做呢?本文就提供一个思路。
1、复制主程序
创建一个新文件夹,如openlist2,将openlist主程序复制一份到openlist2中;
2、赋权
cd openlist2,然后授予程序执行权限:chmod +x openlist;
3、初始化
生成本地配置文件:./openlist admin random,如需自定义密码则:./openlist admin set NEW_PASSWORD;
4、修改端口
在openlist2/data目录下找到config.json文件并打开,找到scheme下的"http_port": 5244,,将5244改为任意未使用端口并保存(记得安全组或防火墙放行该端口);
5、配置守护进程
打开/etc/systemd/system目录,创建服务名.service,如opnelist2.service,打开并添加如下内容:
[Unit]Description=openlistAfter=network.target
[Service]Type=simpleWorkingDirectory=path_openlistExecStart=path_openlist/openlist serverRestart=on-failure
[Install]WantedBy=multi-user.target将Description=openlist改为Description=opnelist2,path_openlist改为openlist所在路径,如WorkingDirectory=var/openlist2,ExecStart=var/openlist2/openlist server,然后保存。
然后,执行systemctl daemon-reload重载配置
7、启动并配置开机自启
先执行systemctl start opnelist2启动openlist,再执行systemctl enable opnelist2配置开机启动,即可通过ip:端口访问openlist程序了,和官方一样使用命令控制:
启动: systemctl start opnelist2关闭: systemctl stop opnelist2配置开机自启: systemctl enable opnelist2取消开机自启: systemctl disable opnelist2状态: systemctl status opnelist2重启: systemctl restart opnelist2文章分享
如果这篇文章对你有帮助,欢迎分享给更多人!
部分内容可能已过时
岁语集