介绍

Alist是一款支持多种存储的目录文件列表程序,支持 web 浏览与 webdav

支持的存储

目前已知支持的有

  • 本地存储
  • 阿里云盘
  • OneDrive / Sharepoint(国际版, 世纪互联,de,us)
  • 天翼云盘 (个人云, 家庭云)
  • GoogleDrive
  • 123 云盘
  • 蓝奏云
  • Alist
  • FTP
  • PikPak
  • 闪电盘
  • S3
  • WebDav
  • Teambition(中国,国际)
  • 分秒帧
  • 和彩云 (个人云, 家庭云)
  • Yandex.Disk
  • 百度网盘
  • 夸克网盘
  • 迅雷云盘

安装

脚本安装

仅支持Linux-x86_64/aarch64平台

安装

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

已经安装过再次执行安装会删除之前的数据,更新请使用更新命令

更新

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

卸载​

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

自定义路径

默认安装在/opt/alist,要自定义安装路径,添加安装路径为第二个参数,必须是绝对路径(路径以alist结尾时直接安装到给定路径,否则会安装在给定路径alist目录下),如安装到/root

1
2
3
4
5
6
# 安装
curl -fsSL "https://nn.ci/alist.sh" | bash -s install /root
# 更新
curl -fsSL "https://nn.ci/alist.sh" | bash -s update /root
# 卸载
curl -fsSL "https://nn.ci/alist.sh" | bash -s uninstall /root

手动安装

获取Alist​

打开AList Release界面下载要部署的系统对应的文件,最新的版本前端已经与后端打包在一起,无需再次下载前端文件

运行

Linux​

1
2
3
4
5
6
# 解压下载对文件得到可执行文件:
tar -zxvf alist-xxxx.tar.gz
# 赋予程序执行权限:
chmod +x alist-xxxx
# 运行程序
./alist-xxxx

其中的xxxx是指不同系统/架构对应的名称,一般Linux-x86/64是alist-linux-amd64,如果你的glibc版本过低,建议下载musl版本

Windows

直接解压获取到的 zip 压缩包,启动 alist-xxxx.exe 即可。

当看到输出start server @ 0.0.0.0:5244且之后没有报错后,就表示运行成功了,首次运行会输出初始密码,程序默认监听5244端口,现在打开http://ip:5244就可以看见登陆页面了,webdav相关请看WebDav

守护进程

/etc/systemd/system/alist.service```添加以下内容,其中path_alist为alist所在的路径
1
2
3
4
5
6
7
8
9
10
11
12
13
```
[Unit]
Description=alist
After=network.target

[Service]
Type=simple
WorkingDirectory=path_alist
ExecStart=path_alist/alist-xxxx -conf data/config.json
Restart=on-failure

[Install]
WantedBy=multi-user.target

然后```systemctl daemon-reload````,现在你就可以使用这些命令来管理程序了

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

    使用Docker安装

    初始密码请查看日志输出
    1
    2
    3
    docker logs alist
    # 或者
    docker exec -it alist ./alist -password

    稳定版

    1
    docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 --name="alist" xhofe/alist:latest

    开发版

    不推荐,这有可能无法正常使用
    1
    docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 --name="alist" xhofe/alist:v2

    指定版本

    具体见 https://hub.docker.com/r/xhofe/alist

    PaaS

    初始密码请查看日志输出

    Koyeb

    https://github.com/alist-org/alist-koyeb

    Render​

    https://github.com/alist-org/alist-render

    Heroku

    https://github.com/alist-org/alist-heroku-postgres (推荐)
    https://github.com/alist-org/alist-heroku

    Repl.it

    https://github.com/alist-org/alist-replit

    从源码运行

    此步骤只是为需要自行修改源码的用户准备,不了解的话请跳过

    环境准备

    首先需要有gitnodejsyarngolang>=1.17, gcc的环境

    构建前端

    clone https://github.com/Xhofe/alist-web 这个项目,执行yarn && yarn build,得到dist目录下的目标文件

    构建后端​

    clone https://github.com/Xhofe/alist 这个项目,将上一步dist目录下的文件全部拷贝至项目下的public目录,然后
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    appName="alist"
    builtAt="$(date +'%F %T %z')"
    goVersion=$(go version | sed 's/go version //')
    gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD)
    gitCommit=$(git log --pretty=format:"%h" -1)
    gitTag=$(git describe --long --tags --dirty --always)
    ldflags="\
    -w -s \
    -X 'github.com/Xhofe/alist/conf.BuiltAt=$builtAt' \
    -X 'github.com/Xhofe/alist/conf.GoVersion=$goVersion' \
    -X 'github.com/Xhofe/alist/conf.GitAuthor=$gitAuthor' \
    -X 'github.com/Xhofe/alist/conf.GitCommit=$gitCommit' \
    -X 'github.com/Xhofe/alist/conf.GitTag=$gitTag' \
    "
    go build -ldflags="$ldflags" alist.go

    反代

    程序默认监听5244端口

    nginx

    在网站的配置文件的server字段中加入
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Range $http_range;
    proxy_set_header If-Range $http_if_range;
    proxy_redirect off;
    proxy_pass http://127.0.0.1:5244;
    # 上传的最大文件尺寸
    client_max_body_size 20000m;
    }

    如果你使用宝塔,请务必删除以下默认配置

    location ~ ^/(.user.ini|.htaccess|.git|.svn|.project|LICENSE|README.md
    location ~ ..(gif|jpg|jpeg|png|bmp|swf)$
    location ~ .
    .(js|css)?$

    Apache

    在VirtualHost字段下加入反代配置项ProxyPass,列如
    1
    2
    3
    4
    5
    6
    7
    8
    <VirtualHost *:80>
    ServerName myapp.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /www/myapp/public

    AllowEncodedSlashes NoDecode
    ProxyPass "/" "http://127.0.0.1:5244/" nocanon
    </VirtualHost>

    Caddy

    在Caddyfile文件下加入反代配置项reverse_proxy,列如
    1
    2
    3
    :80 {
    reverse_proxy 127.0.0.1:5244
    }