![图片[1]-使用Docker静态编译musl版本的OpenList网盘-坤哥资源](https://guankan.tk/wp-content/uploads/2024/01/juedn.png)
MUSL 静态编译的优点?
使用 MUSL libc 进行静态编译,可以生成具有高度兼容性和超稳定性的 Linux 可执行文件。MUSL 编译出的静态二进制文件,会把运行所需的库全部打包进一个可执行文件中,支持老旧的CentOS 6 / 7系统、也更轻量、更安全。
编译文件
1,创建一个工作目录:mkdir -p /root/alist-build
2,进入目录:cd /root/alist-build
3,拉取前端源文件:git clone --recurse-submodules https://github.com/OpenListTeam/OpenList-Frontend.git
4,修改和美化前端文件代码
5,上传2个文件(docker-compose.yml和build.sh),目录结构以下:
/root/openlist-build/
├── docker-compose.yml
├── build.sh
└── OpenList-Frontend/ (修改好的前端文件夹)
6,开始编译:docker-compose up --force-recreate
7,编译成功后,验证文件类型:ldd ./openlist-musl
正常显示为:
运行测试
1,授权文件chmod +x openlist-musl
2,查看版本:./openlist-musl version
3,启动程序./openlist-musl server
当你看到 start HTTP server @ 0.0.0.0:5244 的输出,之后没有报错,说明操作成功。
现在打开 http://ip:5244 可以看到登录页面,如果安装了宝塔面板,在安全中放行 5244 端口
后台运行
1,创建目录 (如果不存在)mkdir -p /root/openlist
2,进入目录cd /root/openlist
3,将新编译的文件复制过来cp /root/openlist-build/openlist-musl /root/openlist/
4,给予执行权限chmod +x /root/openlist/openlist-musl
5,设置用户名admin和密码123456./openlist-musl admin set 123456
6,创建进程文件sudo touch /usr/lib/systemd/system/openlist.service
7,进入目录cd /usr/lib/systemd/system打开文件openlist.service,粘贴以下代码保存
# 停止旧服务:
systemctl stop openlist
# 重载配置:
systemctl daemon-reload
# 启动服务:
systemctl start openlist
# 设置开机自启:
systemctl enable openlist
# 查看状态:
systemctl status openlist
# 重启:
systemctl restart openlist
8,最后,在Nginx 配置使用域名反向代理,OK















暂无评论内容