本文及资源最后更新时间 2022-04-24 by sky995
官方已经写出了非常详细的教程,可以移步官方使用说明查看:
官方使用说明
但是今天,缙哥哥要跟大家分享的是基于宝塔面板安装 Alist 程序。
推荐使用宝塔Linux控制面板
部署好宝塔面板之后,创建网站。
数据库无需创建,PHP版本可随意,纯静态也可以。这里我们复制一下根目录
地址,后面安装 Alist 程序需要用到。根目录地址为:
<code><span class="str">/www/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="pln">alist</span><span class="pun">.</span><span class="pln">dujin</span><span class="pun">.</span><span class="pln">org</span></code>
宝塔安装 Alist 程序
接下来,通过 ssh 连接该服务器,在官方给出的基础上,末尾增加指定目录安装,添加刚刚得到的根目录地址,如下示例。
<code><span class="pln">curl </span><span class="pun">-</span><span class="pln">fsSL </span><span class="str">"https://nn.ci/alist.sh"</span> <span class="pun">|</span><span class="pln"> bash </span><span class="pun">-</span><span class="pln">s install </span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="pln">alist</span><span class="pun">.</span><span class="pln">dujin</span><span class="pun">.</span><span class="pln">org curl </span><span class="pun">-</span><span class="pln">fsSL </span><span class="str">"https://nn.ci/alist.sh"</span> <span class="pun">|</span><span class="pln"> bash </span><span class="pun">-</span><span class="pln">s update </span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="pln">alist</span><span class="pun">.</span><span class="pln">dujin</span><span class="pun">.</span><span class="pln">org curl </span><span class="pun">-</span><span class="pln">fsSL </span><span class="str">"https://nn.ci/alist.sh"</span> <span class="pun">|</span><span class="pln"> bash </span><span class="pun">-</span><span class="pln">s uninstall </span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="pln">alist</span><span class="pun">.</span><span class="pln">dujin</span><span class="pun">.</span><span class="pln">org</span></code>
install 为安装,update 为升级,uninstall 为卸载。我们执行第一行安装之后,会得到如下内容:
<code><span class="typ">Alist</span> <span class="pun">安装成功!</span> <span class="pun">访问地址:</span><span class="pln">http</span><span class="pun">:</span><span class="com">//YOUR_IP:5244/</span> <span class="pun">配置文件:/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="pln">alist</span><span class="pun">.</span><span class="pln">dujin</span><span class="pun">.</span><span class="pln">org</span><span class="pun">/</span><span class="pln">alist</span><span class="pun">/</span><span class="pln">data</span><span class="pun">/</span><span class="pln">config</span><span class="pun">.</span><span class="pln">json </span><span class="pun">初始管理密码:</span><span class="pln">www</span><span class="pun">.</span><span class="pln">dujin</span><span class="pun">.</span><span class="pln">org </span><span class="pun">查看状态:</span><span class="pln">systemctl status alist </span><span class="pun">启动服务:</span><span class="pln">systemctl start alist </span><span class="pun">重启服务:</span><span class="pln">systemctl restart alist </span><span class="pun">停止服务:</span><span class="pln">systemctl stop alist </span><span class="pun">温馨提示:如果端口无法正常访问,请检查</span> <span class="pun">服务器安全组、本机防火墙、</span><span class="typ">Alist</span><span class="pun">状态</span></code>
这里我们要记住 Alist 初始管理密码。所以,你如果是使用阿里云、腾讯云、华为云之类的服务器,就要把这个 5244 端口给开一下,同时在宝塔
→安全
里面也对 5244 端口放行一下。
给 Alist 程序添加反向代理
点击宝塔→网站
菜单→对应网站设置
→反向代理→添加反向代理。
点击开启代理,代理名称随意,目标URL设置为:
<code><span class="pln">http</span><span class="pun">:</span><span class="com">//127.0.0.1:5244</span></code>
其余保持默认即可,点击提交
按钮。
其他终端管理命令
<code><span class="pun">启动:</span><span class="pln"> systemctl start alist </span><span class="pun">关闭:</span><span class="pln"> systemctl stop alist </span><span class="pun">自启:</span><span class="pln"> systemctl enable alist </span><span class="pun">状态:</span><span class="pln"> systemctl status alist </span><span class="pun">重启:</span><span class="pln"> systemctl restart alist</span></code>
输入你的前端域名就可以访问,这里的密码就是最开始通过 ssh 安装成功显示的密码
至于如何添加各种网盘这种事,官方说明都写的很清楚了,这里就不再赘述了。
个人建议
如果是自己一个人用用,那么可以选择一款网络较好的服务器,尤其是海外服务器,还可以对接谷歌云盘、海外版 OneDrive 等。
如果是公开给大伙儿用,那么建议套一个 CloudFlare,避免被频繁扫描或者胡乱调用导致 API 阈值过高而账号被黑。