文章部分内容出自 AList帮助文档

一键安装脚本

一键安装脚本仅适用于 Linux amd64/arm64 平台

标准安装

首先是能不能连上全靠脸的一键安装脚本
如果安装脚本提示网络错误,请移至下面的 手动安装步骤

安装

bash
1
curl -fsSL "https://alist.nn.ci/v3.sh" | bash -s install

更新

bash
1
curl -fsSL "https://alist.nn.ci/v3.sh" | bash -s update

自定义路径

默认安装在 /opt/alist 中。 如果需要安装到指定路径,在末尾加上路径参数即可,如 安装到 /root

plaintext
1
2
3
4
# 安装到 /root 目录下
curl -fsSL "https://alist.nn.ci/v3.sh" | bash -s install /root
# 更新 /root 目录下的 Alist
curl -fsSL "https://alist.nn.ci/v3.sh" | bash -s update /root
  • 启动: systemctl start alist
  • 关闭: systemctl stop alist
  • 状态: systemctl status alist
  • 重启: systemctl restart alist

手动安装

获取二进制文件

打开 AList Release 下载对应系统的文件。

如 Linux 就下载 alist-linux-xxx.tar.gz
macOS 为 alist-darwin-xxx.tar.gz
Windows 为 alist-windows-xxx.zip

! xxx 指代 CPU 指令集

运行程序

bash
1
2
3
4
5
6
# 解压下载的文件,得到可执行文件:
tar -zxvf alist-linux-amd64.tar.gz
# 授予程序执行权限:
chmod +x alist
# 运行程序
./alist server
bash
1
2
3
4
5
6
# 解压下载的文件,得到可执行文件:
tar -zxvf alist-darwin-amd64.tar.gz
# 授予程序执行权限:
chmod +x alist
# 运行程序
./alist server
powershell
1
2
3
4
5
# 解压下载的文件
# 也可以执行下面命令,"alist-xxxx.zip" 是你下载的文件名
unzip alist-windows-amd64.zip
# 运行程序
.\alist.exe server

创建守护进程

使用下面命令来创建 alist.service

bash
1
sudo nano /usr/lib/systemd/system/alist.service

在文件中添加下列内容,其中 {path_alist} 为程序路径

plaintext
1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=alist
After=network.target

[Service]
Type=simple
WorkingDirectory={path_alist}
ExecStart={path_alist}/alist server
Restart=on-failure

[Install]
WantedBy=multi-user.target

执行 systemctl daemon-reload 来重载配置

然后就可以用 systemctl 命令来管理 Alist

  • 启动: systemctl start alist
  • 关闭: systemctl stop alist
  • 状态: systemctl status alist
  • 重启: systemctl restart alist

使用下面命令来创建 ci.nn.alist.plist

bash
1
sudo nano ~/Library/LaunchAgents/ci.nn.alist.plist

在文件中添加下列内容,其中 {path_alist} 可替换为程序路径,path/to/working/dir 为 AList的工作路径

xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ci.nn.alist</string>
<key>KeepAlive</key>
<true/>
<key>ProcessType</key>
<string>Background</string>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>path/to/working/dir</string>
<key>ProgramArguments</key>
<array>
<string>{path_alist}/alist</string>
<string>server</string>
</array>
</dict>
</plist>

执行 launchctl load ~/Library/LaunchAgents/ci.nn.alist.plist 加载配置

  • 开启: launchctl start ~/Library/LaunchAgents/ci.nn.alist.plist
  • 关闭: launchctl stop ~/Library/LaunchAgents/ci.nn.alist.plist
  • 卸载配置: launchctl unload ~/Library/LaunchAgents/ci.nn.alist.plist

用 .VBS 脚本启动和停止,分别创建两个脚本 分别是 启动.vbs 和 停止.vbs

启动.vbs

vbscript
1
2
3
4
Dim ws
Set ws = Wscript.CreateObject("Wscript.Shell")
ws.run "alist.exe server",vbhide
Wscript.quit

停止.vbs

vbscript
1
2
3
4
Dim ws
Set ws = Wscript.CreateObject("Wscript.Shell")
ws.run "taskkill /f /im alist.exe",0
Wscript.quit

创建管理员密码

对于 Linux/macOS :

bash
1
2
3
4
# 随机生成一个密码
./alist admin random
# 手动设置一个密码,`NEW_PASSWORD`是指你需要设置的密码
./alist admin set NEW_PASSWORD

对于 Windows :

powershell
1
2
3
4
# 随机生成一个密码
./alist.exe admin random
# 手动设置一个密码,`NEW_PASSWORD`是指你需要设置的密码
./alist.exe admin set NEW_PASSWORD

获取端口

使用命令 .\alist.exe server 可运行 Alist,在日志中可以看见端口,默认端口为 5244

在浏览器中输入 127.0.0.1:5244 即可访问