下载

  1. [[email protected].io]# wget https://github.com/alist-org/alist/releases/download/v3.7.2/alist-linux-amd64.tar.gz
  2. [[email protected].io]# tar zxf alist-linux-amd64.tar.gz
  3. [[email protected].io]# sudo ./alist admin
  4. INFO[2023-01-03 20:57:22] reading config file: data/config.json
  5. INFO[2023-01-03 20:57:22] load config from env with prefix: ALIST_
  6. INFO[2023-01-03 20:57:22] init logrus...
  7. WARN[2023-01-03 20:57:22] not enable search
  8. INFO[2023-01-03 20:57:22] admin user's info:
  9. username: admin
  10. password: abc1234

部署

  1. [[email protected].io]# cat /usr/lib/systemd/system/alist.service
  2. [Unit]
  3. Description=alist
  4. After=network.target
  5. [Service]
  6. Type=simple
  7. WorkingDirectory=path_alist
  8. ExecStart=path_alist/alist server
  9. Restart=on-failure
  10. [Install]
  11. WantedBy=multi-user.target
  12. [[email protected].io]# sudo systemctl daemon-reload
  13. [[email protected].io]# sudo systemctl enable alist
  14. [[email protected].io]# sudo systemctl start alist

配置

Storage 配置

打开 http://localhost:5244,你会看到这个页面:

图 1:alist 默认首页

忽略上面的错误,然后点击下面的 login:

图 2:alist login

然后输入账号密码,账号密码就是最开始下载的时候,alist admin 输出的最后两行:

图 3:alist 账号密码

然后配置 storage:

图 4:添加 Storage

这里我添加一个 local 的试试:

图 5:添加 local storage

然后再重新打开 http://localhost:5244 就有内容了。

图 6:配置 storage 后首页

Nginx 配置

如果你本机还有 Nginx,那么可以将 alist 配置在 Nginx 之后,但是不得不说,alist 的 nginx 代理做得不好,无法使用 subpath,所以只能代理 /,因此 nginx 的配置为

那么你需要做额外的两个步骤:

步骤一:修改你的 alist 配置文件:

  1. [[email protected].io]# cat /etc/alist/data/config.json
  2. ...
  3. "site_url": "http://<domain>/alist",
  4. ...

步骤二:增加 nginx 的配置

  1. [[email protected].io]# cat /etc/nginx/nginx.conf
  2. location /alist/ {
  3. proxy_pass http://127.0.0.1:5244/;
  4. proxy_set_header X-Real-IP $remote_addr;
  5. proxy_set_header Host $host;
  6. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  7. proxy_set_header Range $http_range;
  8. proxy_http_version 1.1;
  9. proxy_set_header Upgrade $http_upgrade;
  10. proxy_set_header Connection "upgrade";
  11. proxy_redirect off;
  12. client_max_body_size 20000m;
  13. }

问题解决

failed get storage: can’t find storage with rawPath: /

可能你一安装完之后打开就是这个报错的页面,但是实际上这无关大雅,关键的是你需要点击下面的 “Login” 登录一下:

图 7:忽略错误,选择登录

Ref