跳至主要內容

从源码运行

Andy Hsu2022年9月11日GuideInstallGuide大约 1 分钟

从源码运行

警告

此步骤仅适用于需要自行修改源代码的用户。 不明白的请跳过。

环境准备

首先,你需要一个有gitnodejspnpmgolang>=1.20gcc的环境

构建前端

使用 git clone --recurse-submodules https://github.com/alist-org/alist-web.git 克隆前端 ,执行 pnpm install && pnpm build 得到 dist 目录下的目标文件

构建后端

克隆 https://github.com/alist-org/alistopen in new window ,将上一步的 dist 目录复制到项目下的 public 目录下,然后执行:

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)
version=$(git describe --long --tags --dirty --always)
webVersion=$(wget -qO- -t1 -T2 "https://api.github.com/repos/alist-org/alist-web/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
ldflags="\
-w -s \
-X 'github.com/alist-org/alist/v3/internal/conf.BuiltAt=$builtAt' \
-X 'github.com/alist-org/alist/v3/internal/conf.GoVersion=$goVersion' \
-X 'github.com/alist-org/alist/v3/internal/conf.GitAuthor=$gitAuthor' \
-X 'github.com/alist-org/alist/v3/internal/conf.GitCommit=$gitCommit' \
-X 'github.com/alist-org/alist/v3/internal/conf.Version=$version' \
-X 'github.com/alist-org/alist/v3/internal/conf.WebVersion=$webVersion' \
"
go build -ldflags="$ldflags" .
你可能需要的编译教程视频

Windows版本:https://www.bilibili.com/video/BV1Xr4y1z723open in new window
(虽然是V2版的,但是跟V3版本一样的..)

Linux版本:https://www.bilibili.com/video/BV1GW4y1s742open in new window

番外编译文档:https://www.yuque.com/anwenya/alist/glqlhuopen in new window

温馨提示
 请仔细查看弹窗提示内容

1.v3.25.1新版更新了新的密码方式,获取方式也进行了更改,详细说明请看自己安装方式的文档页面内
2.v3.25.1阿里云盘open可以自行选择挂载备份盘或者资源库,详情详情点击查看
3.AList版本大于v3.22.1,新版本新增单点登录自动注册为AList账户,点击查看详细说明
4.移动云盘天翼云分别有改动详情请自行查看文档
5.v3.20.1的版本破坏性更新查看详细说明,前往配置文档页面
6.AList v3.30.0版本开始将不再支持Win7/Server2008,因为Go不支持了,点击查看详细说明.
7.添加云盘后请及时配置[防盗/元信息]等措施,防止被[爬虫/其他人]恶意[访问/分享]导致帐号被[冻结/禁用].