编译Alist可以修改前/后端源码,不管是出于想折腾还是想要修改源码,大家都可以尝试编译。

1.编译前准备

GitHub code space编译只有一个版本,如果你想要像AList官方那样编译很多可以使用 GitHub Actions 来进行编译
如果你只有修改前端的想法,强烈推荐 单独只进行编译前端即可,后端(二进制)应用程序继续使用AList官方原版的文件
因为现在支持引用第三方前端文件使用:参考 https://alist.nn.ci/zh/config/configuration.html#bleve-dir
这样就不用担心设备不同不会交叉编译,以及编译过程中出现的问题无法解决

1.1 编译前说明

编译Linux版本教程我们使用 GitHub code space 来演示
原本我们需要安装 gitnodejspnpmgccgolang 1.20+ 这些软件并且配置环境的,但是呢code space帮我们已经配置好了,不用我们手动安装了(小声逼逼:对于不会安装环境的偷着乐)
打开Build software better, together创建一个空白模板
选择Blank

1.2 前后端代码克隆到本地

后端:git clone https://github.com/alist-org/alist.git
前端:git clone --recurse-submodules https://github.com/alist-org/alist-web.git

找不到终端在哪里


克隆前后端

1.3 安装 pnpm

使用npm安装pnpm 输入 npm install -g pnpm 执行安装

报错xxxxxx 317

出现该问题是内存不够导致的


以下为安装反馈

@66788zzz ➜ /workspaces/codespaces-blank $ npm install -g pnpm

changed 1 package in 2s

1 package is looking for funding
  run `npm fund` for details
npm notice
npm notice New major version of npm available! 10.8.2 -> 11.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
npm notice To update run: npm install -g [email protected]
npm notice

1.4 下载zh-CN&且初始化

点击右侧按钮下载zh-CN.zip,将其上传至Alist-web文件夹内:

cd alist-web
unzip zh-CN.zip
node ./scripts/i18n.mjs
rm zh-CN.zip

代码说明:

  1. 进入前端文件夹里面
  2. 解压
  3. 初始化一下语言包,不然无法使用
  4. 删除语言包压缩包

安装项目所有依赖,同时编译前端文件


修改前端代码的教程详见下方文章:


2.编译前端

输入 pnpm install && pnpm run build 编译前端(也可分开,先执行 pnpm install再执行 pnpm run build,都一样)

运行反馈

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Downloading [email protected]: 18.44 MB/18.44 MB, done
Downloading [email protected]: 6.97 MB/6.97 MB, done
Downloading @crowdin/[email protected]: 6.78 MB/6.78 MB, done
Downloading [email protected]: 11.70 MB/11.70 MB, done
Progress: resolved 470, reused 0, downloaded 470, added 470, done
node_modules/.pnpm/[email protected]/node_modules/core-js: Running postinstall script, done in 63ms
node_modules/.pnpm/[email protected]/node_modules/esbuild: Running postinstall script, done in 84ms

dependencies:
+ @egjs/view360 4.0.0-beta.7
+ @github/webauthn-json 2.1.1
+ @hope-ui/solid 0.6.7
+ @monaco-editor/loader 1.4.0
+ @motionone/solid 10.14.1
+ @solid-primitives/i18n 1.1.0
+ @solid-primitives/keyboard 1.2.5
+ @solid-primitives/storage 1.3.1
+ @stitches/core 1.2.8
+ @types/qrcode 1.5.5
+ @viselect/vanilla 3.5.0
+ aplayer 1.10.1
+ artplayer 5.0.9
+ artplayer-plugin-danmuku 5.0.1
+ asciinema-player 3.6.3
+ axios 1.1.3
+ chardet 2.0.0
+ clsx 2.0.0
+ copy-to-clipboard 3.3.2
+ crypto-js 4.2.0
+ flv.js 1.6.2
+ hls.js 1.2.1
+ just-once 2.2.0
+ libass-wasm 4.1.0
+ lightgallery 2.5.0
+ mark.js 8.11.1
+ mitt 3.0.0
+ qrcode 1.5.4
+ rehype-katex 6.0.3
+ rehype-raw 6.1.1
+ remark-gfm 3.0.1
+ remark-math 5.1.1
+ seemly 0.3.6
+ sha256 0.2.0
+ solid-contextmenu 0.0.2
+ solid-icons 1.0.1
+ solid-js 1.4.8
+ solid-markdown 1.2.0
+ solid-transition-group 0.0.12
+ streamsaver 2.0.6
+ typescript-natural-sort 0.7.2

devDependencies:
+ @crowdin/cli 3.7.10
+ @hrgui/libass-wasm-ts 1.0.3
+ @types/mark.js 8.11.8
+ @types/node 20.0.0
+ @types/sha256 0.2.0
+ @types/streamsaver 2.0.1
+ @vitejs/plugin-legacy 2.0.1
+ husky 8.0.2
+ lint-staged 13.0.4
+ prettier 3.1.1
+ rollup-plugin-copy 3.5.0
+ terser 5.14.2
+ typescript 4.7.4
+ vite 3.0.8
+ vite-plugin-dynamic-base 0.4.4
+ vite-plugin-solid 2.3.0

> [email protected] prepare /workspaces/codespaces-blank/alist-web
> husky install

husky - Git hooks installed

Done in 11.8s

> [email protected] build /workspaces/codespaces-blank/alist-web
> vite build

vite v3.0.8 building for production...
✓ 861 modules transformed.
dist/assets/useTitle-legacy.15d74cb1.js                         0.67 KiB / gzip: 0.38 KiB
dist/assets/index-legacy.fc20fdf5.js                            10.89 KiB / gzip: 3.41 KiB
dist/assets/FolderTree-legacy.9ee2d686.js                       12.91 KiB / gzip: 4.80 KiB
dist/assets/index-legacy.a201e321.js                            0.92 KiB / gzip: 0.46 KiB
dist/assets/index-legacy.06abf7c5.js                            19.26 KiB / gzip: 6.40 KiB
dist/assets/index-legacy.399aaa55.js                            3.88 KiB / gzip: 0.65 KiB
dist/assets/Layout-legacy.93d24036.js                           55.40 KiB / gzip: 15.92 KiB
dist/assets/webauthn-json.browser-ponyfill-legacy.8ddd819a.js   11.56 KiB / gzip: 4.11 KiB
dist/assets/index-legacy.e0663023.js                            17.03 KiB / gzip: 6.28 KiB
dist/assets/index-legacy.2ed3c9fc.js                            0.39 KiB / gzip: 0.25 KiB
dist/assets/entry-legacy.52b4b945.js                            42.00 KiB / gzip: 11.62 KiB
dist/assets/icon-legacy.a5357180.js                             6.10 KiB / gzip: 3.02 KiB
dist/assets/solid-contextmenu-legacy.6a4ede2c.js                10.28 KiB / gzip: 3.74 KiB
dist/assets/Upload-legacy.30772639.js                           22.23 KiB / gzip: 7.17 KiB
dist/assets/Paginator-legacy.08ed02ba.js                        3.74 KiB / gzip: 1.48 KiB
dist/assets/_commonjs-dynamic-modules-legacy.cf19cda3.js        0.30 KiB / gzip: 0.22 KiB
dist/assets/Password-legacy.ba114bef.js                         1.04 KiB / gzip: 0.54 KiB
dist/assets/File-legacy.7bbc405b.js                             31.58 KiB / gzip: 11.89 KiB
dist/assets/Common-legacy.50c04363.js                           10.22 KiB / gzip: 3.86 KiB
dist/assets/ResponsiveGrid-legacy.f9d69c79.js                   0.37 KiB / gzip: 0.28 KiB
dist/assets/SettingItem-legacy.a420b422.js                      3.43 KiB / gzip: 1.24 KiB
dist/assets/item_type-legacy.4bd28ded.js                        0.21 KiB / gzip: 0.17 KiB
dist/assets/PublicKeys-legacy.6067a8e9.js                       12.92 KiB / gzip: 4.51 KiB
dist/assets/Profile-legacy.818311f3.js                          16.33 KiB / gzip: 5.61 KiB
dist/assets/S3-legacy.8fa0f41c.js                               15.16 KiB / gzip: 5.17 KiB
dist/assets/Other-legacy.a0f97aab.js                            16.21 KiB / gzip: 4.72 KiB
dist/assets/offline_download-legacy.7a3808fe.js                 0.64 KiB / gzip: 0.37 KiB
dist/assets/helper-legacy.ac54b13a.js                           25.57 KiB / gzip: 7.80 KiB
dist/assets/Upload-legacy.343c4924.js                           0.71 KiB / gzip: 0.42 KiB
dist/assets/Copy-legacy.853df5bc.js                             0.83 KiB / gzip: 0.47 KiB
dist/assets/Decompress-legacy.56f6d81c.js                       0.62 KiB / gzip: 0.36 KiB
dist/assets/Users-legacy.552a1a23.js                            11.58 KiB / gzip: 4.19 KiB
dist/assets/DeletePopover-legacy.710dfa5c.js                    0.77 KiB / gzip: 0.37 KiB
dist/assets/Wether-legacy.58e88bdd.js                           0.31 KiB / gzip: 0.22 KiB
dist/assets/Storages-legacy.d6cd7507.js                         14.23 KiB / gzip: 4.83 KiB
dist/assets/indexes-legacy.8e466874.js                          14.55 KiB / gzip: 4.96 KiB
dist/assets/backup-restore-legacy.8e050b8b.js                   17.66 KiB / gzip: 6.00 KiB
dist/assets/About-legacy.662b41c2.js                            8.68 KiB / gzip: 3.31 KiB
dist/assets/AddOrEdit-legacy.fb2aeec1.js                        16.25 KiB / gzip: 5.33 KiB
dist/assets/AddOrEdit-legacy.ae79b811.js                        11.95 KiB / gzip: 4.34 KiB
dist/assets/AddOrEdit-legacy.7d774d56.js                        12.13 KiB / gzip: 4.40 KiB
dist/assets/2fa-legacy.c7d5fa02.js                              10.65 KiB / gzip: 3.96 KiB
dist/assets/Messenger-legacy.cd6e3bd5.js                        9.98 KiB / gzip: 3.76 KiB
dist/assets/List-legacy.c0eef5ed.js                             6.45 KiB / gzip: 2.73 KiB
dist/assets/helper-legacy.2a102d71.js                           21.86 KiB / gzip: 7.11 KiB
dist/assets/index-legacy.7c6f8914.js                            10.78 KiB / gzip: 3.93 KiB
dist/assets/Grid-legacy.ac6682eb.js                             1.34 KiB / gzip: 0.64 KiB
dist/assets/ImageWithError-legacy.f19e6c83.js                   1.32 KiB / gzip: 0.75 KiB
dist/assets/GridItem-legacy.d41bc097.js                         4.67 KiB / gzip: 2.11 KiB
dist/assets/Images-legacy.a5b33c2b.js                           5.14 KiB / gzip: 2.27 KiB
dist/assets/html-legacy.470c0106.js                             1.73 KiB / gzip: 0.94 KiB
dist/assets/markdown-legacy.8fee61aa.js                         1.38 KiB / gzip: 0.78 KiB
dist/assets/markdown_with_word_wrap-legacy.90ab2103.js          1.34 KiB / gzip: 0.76 KiB
dist/assets/url-legacy.b1cdd51e.js                              1.85 KiB / gzip: 0.96 KiB
dist/assets/image-legacy.35854ed6.js                            1.14 KiB / gzip: 0.59 KiB
dist/assets/text-editor-legacy.f7c81cab.js                      18.05 KiB / gzip: 6.16 KiB
dist/assets/Metas-legacy.77d2f851.js                            10.39 KiB / gzip: 3.89 KiB
dist/assets/ipa-legacy.116ce51d.js                              2.21 KiB / gzip: 1.11 KiB
dist/assets/plist-legacy.7013fbf7.js                            1.77 KiB / gzip: 0.94 KiB
dist/assets/aliyun_video-legacy.d1c061ce.js                     15.82 KiB / gzip: 5.94 KiB
dist/assets/aliyun_office-legacy.e15685c1.js                    8.76 KiB / gzip: 3.39 KiB
dist/assets/PackageDownload-legacy.9d29d368.js                  20.10 KiB / gzip: 7.37 KiB
dist/assets/index-legacy.4fb51281.js                            65.34 KiB / gzip: 25.22 KiB
dist/assets/audio-legacy.617c8286.js                            72.91 KiB / gzip: 16.86 KiB
dist/assets/archive-legacy.fef29e7e.js                          16.81 KiB / gzip: 6.23 KiB
dist/assets/Folder-legacy.6d6d4233.js                           152.16 KiB / gzip: 41.39 KiB
dist/assets/video_box-legacy.2a81fcf3.js                        186.89 KiB / gzip: 47.65 KiB
dist/assets/video-legacy.f992bf4d.js                            166.73 KiB / gzip: 40.14 KiB
dist/assets/polyfills-legacy.c0ac6345.js                        122.45 KiB / gzip: 49.09 KiB
dist/assets/video360-legacy.9487d978.js                         141.09 KiB / gzip: 37.34 KiB
dist/assets/asciinema-legacy.54bdaea0.js                        224.27 KiB / gzip: 75.44 KiB
dist/assets/hls-legacy.6a56d705.js                              450.21 KiB / gzip: 125.16 KiB
dist/assets/index-legacy.936d6dac.js                            1301.34 KiB / gzip: 376.41 KiB

(!) Some chunks are larger than 500 KiB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
dist/assets/loading.298ad3ff.gif                         4.08 KiB
dist/assets/subtitles-octopus-worker.f95f2186.js         390.32 KiB
dist/assets/TimesNewRoman.d9fb32eb.ttf                   814.69 KiB
dist/assets/lg.22b72ba5.ttf                              4.64 KiB
dist/assets/subtitles-octopus-worker.62892886.wasm       2251.80 KiB
dist/assets/lg.fefc5c0d.woff                             4.72 KiB
dist/assets/lg.f2fe1c00.svg                              12.53 KiB
dist/assets/SourceHanSansCN-Bold.b5627435.woff2          4885.68 KiB
dist/index.html                                          3.87 KiB
dist/assets/useTitle.04509d4a.js                         0.49 KiB / gzip: 0.32 KiB
dist/assets/Layout.7755a0d6.js                           38.10 KiB / gzip: 11.59 KiB
dist/assets/index.1056eb81.js                            10.90 KiB / gzip: 3.43 KiB
dist/assets/FolderTree.97a5600e.js                       3.99 KiB / gzip: 1.64 KiB
dist/assets/index.fcdb2e0c.js                            0.85 KiB / gzip: 0.42 KiB
dist/assets/index.1ae82cbe.js                            3.80 KiB / gzip: 0.60 KiB
dist/assets/index.18d11b71.js                            13.46 KiB / gzip: 3.58 KiB
dist/assets/index.1be2be6e.js                            7.63 KiB / gzip: 3.03 KiB
dist/assets/webauthn-json.browser-ponyfill.1c672167.js   2.31 KiB / gzip: 0.96 KiB
dist/assets/index.6d593f69.js                            0.26 KiB / gzip: 0.20 KiB
dist/assets/Upload.88cd47e3.js                           6.35 KiB / gzip: 2.57 KiB
dist/assets/icon.73927bec.js                             4.89 KiB / gzip: 2.35 KiB
dist/assets/solid-contextmenu.1a9909ad.js                7.18 KiB / gzip: 2.80 KiB
dist/assets/entry.1b279e48.js                            43.70 KiB / gzip: 12.94 KiB
dist/assets/Paginator.bfef356e.js                        2.42 KiB / gzip: 0.88 KiB
dist/assets/_commonjs-dynamic-modules.30ae7933.js        0.23 KiB / gzip: 0.19 KiB
dist/assets/Password.f58aa6f2.js                         0.91 KiB / gzip: 0.49 KiB
dist/assets/PackageDownload.44c241c4.js                  9.06 KiB / gzip: 3.87 KiB
dist/assets/Common.9d95a242.js                           1.32 KiB / gzip: 0.69 KiB
dist/assets/SettingItem.1e7b0ae9.js                      2.51 KiB / gzip: 0.89 KiB
dist/assets/ResponsiveGrid.b941b66e.js                   0.28 KiB / gzip: 0.24 KiB
dist/assets/item_type.ee87ae79.js                        0.13 KiB / gzip: 0.13 KiB
dist/assets/Profile.1ef73d0c.js                          5.86 KiB / gzip: 2.08 KiB
dist/assets/PublicKeys.aa724f13.js                       3.80 KiB / gzip: 1.33 KiB
dist/assets/S3.ab33a94c.js                               3.84 KiB / gzip: 1.49 KiB
dist/assets/File.f5d32644.js                             32.94 KiB / gzip: 11.91 KiB
dist/assets/Other.39ea5f01.js                            5.32 KiB / gzip: 1.35 KiB
dist/assets/offline_download.7df4a0f7.js                 0.50 KiB / gzip: 0.31 KiB
dist/assets/helper.0b0c151e.js                           12.57 KiB / gzip: 4.09 KiB
dist/assets/Upload.8b5f6d6a.js                           0.43 KiB / gzip: 0.30 KiB
dist/assets/Copy.cccaf31d.js                             0.49 KiB / gzip: 0.33 KiB
dist/assets/Decompress.03cf1b39.js                       0.48 KiB / gzip: 0.30 KiB
dist/assets/Users.62b74a5b.js                            2.64 KiB / gzip: 1.03 KiB
dist/assets/DeletePopover.68cb1615.js                    0.65 KiB / gzip: 0.32 KiB
dist/assets/Wether.30b8e049.js                           0.21 KiB / gzip: 0.18 KiB
dist/assets/Storages.4d5a6b48.js                         4.73 KiB / gzip: 1.62 KiB
dist/assets/Metas.e3d02a4d.js                            1.74 KiB / gzip: 0.75 KiB
dist/assets/indexes.5c420aa7.js                          5.07 KiB / gzip: 1.76 KiB
dist/assets/backup-restore.47e6b252.js                   5.44 KiB / gzip: 2.20 KiB
dist/assets/About.dc9db9d5.js                            0.38 KiB / gzip: 0.27 KiB
dist/assets/AddOrEdit.280a1851.js                        5.42 KiB / gzip: 1.76 KiB
dist/assets/AddOrEdit.c823c86c.js                        3.05 KiB / gzip: 1.14 KiB
dist/assets/AddOrEdit.c83e1c75.js                        2.75 KiB / gzip: 1.09 KiB
dist/assets/2fa.0d33b831.js                              1.28 KiB / gzip: 0.66 KiB
dist/assets/Messenger.6af0146b.js                        1.31 KiB / gzip: 0.67 KiB
dist/assets/List.e25c48aa.js                             4.29 KiB / gzip: 1.88 KiB
dist/assets/helper.08b28ce5.js                           14.27 KiB / gzip: 5.15 KiB
dist/assets/Grid.af8e42ec.js                             1.01 KiB / gzip: 0.58 KiB
dist/assets/GridItem.f929167a.js                         2.64 KiB / gzip: 1.24 KiB
dist/assets/ImageWithError.c8ddfc9e.js                   0.24 KiB / gzip: 0.19 KiB
dist/assets/index.af7c6586.js                            2.10 KiB / gzip: 1.00 KiB
dist/assets/Images.4d76d9e7.js                           3.14 KiB / gzip: 1.42 KiB
dist/assets/html.caa4d6eb.js                             0.63 KiB / gzip: 0.37 KiB
dist/assets/markdown.652235fd.js                         0.30 KiB / gzip: 0.22 KiB
dist/assets/markdown_with_word_wrap.bca087d1.js          0.27 KiB / gzip: 0.21 KiB
dist/assets/url.0a1752a5.js                              0.66 KiB / gzip: 0.39 KiB
dist/assets/text-editor.664a3972.js                      9.77 KiB / gzip: 3.64 KiB
dist/assets/image.88d385c6.js                            0.89 KiB / gzip: 0.52 KiB
dist/assets/ipa.70338e47.js                              0.97 KiB / gzip: 0.53 KiB
dist/assets/plist.15e217c3.js                            0.58 KiB / gzip: 0.36 KiB
dist/assets/aliyun_office.70ace93f.js                    0.49 KiB / gzip: 0.34 KiB
dist/assets/archive.765e4a95.js                          6.17 KiB / gzip: 2.61 KiB
dist/assets/index.c4c82a28.css                           19.49 KiB / gzip: 4.17 KiB
dist/assets/audio.e5b5af14.css                           13.23 KiB / gzip: 2.62 KiB
dist/assets/video360.f0192288.css                        11.89 KiB / gzip: 2.95 KiB
dist/assets/aliyun_video.32da817e.js                     6.65 KiB / gzip: 2.78 KiB
dist/assets/Folder.b511ba9e.css                          35.83 KiB / gzip: 8.55 KiB
dist/assets/audio.bb14d170.js                            58.88 KiB / gzip: 14.85 KiB
dist/assets/asciinema.53412307.css                       43.92 KiB / gzip: 6.44 KiB
dist/assets/index.fbea3931.js                            68.04 KiB / gzip: 25.39 KiB
dist/assets/Folder.f3edb1a6.js                           118.31 KiB / gzip: 30.92 KiB
dist/assets/video360.d08b1ec2.js                         106.93 KiB / gzip: 29.89 KiB
dist/assets/video.c5f2d3c8.js                            158.12 KiB / gzip: 40.35 KiB
dist/assets/video_box.ee0d7099.js                        167.80 KiB / gzip: 42.56 KiB
dist/assets/asciinema.b8af48d8.js                        156.63 KiB / gzip: 63.20 KiB
dist/assets/hls.a5fea8e9.js                              414.28 KiB / gzip: 124.02 KiB
dist/assets/index.15bf09bf.js                            1191.03 KiB / gzip: 358.63 KiB

(!) Some chunks are larger than 500 KiB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
@66788zzz ➜ /workspaces/codespaces-blank/alist-web (main) $ 

3.编译后端

3.1 编译后端的准备

先将编译好的前端文件,移动到后端目录里面,再进行编译
方法一:手动将前端(alist-web)里面的dist文件夹,移动到后端(alist)public文件夹
方法二:使用命令将前端(alist-web)里面的dist文件夹,移动到后端(alist)public文件夹

cp -r /workspaces/codespaces-blank/alist-web/dist /workspaces/codespaces-blank/alist/public/

以上两种方法任选其一

3.2 编译后端

先cd到后端文件夹(alist文件夹),或者手动打开后端文件夹终端

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" .

复制以上代码输入至终端
编译后端
粘贴进去后,他会像下面这个图这样,粘贴好了之后需要回车运行,稍等1-2分钟就会好(第一次会比较慢【1-2分钟】,再编译就快了)
运行代码

运行反馈

@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ appName="alist"
rsion=$(go version | sed 's/go version //')
gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD)
gitCommit=$(git log --pretty=format:"%h" -1)
ver@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ builtAt="$(date +'%F %T %z')"
sion=$(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@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ goVersion=$(go version | sed 's/go version //')
 -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" .@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD)
@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ gitCommit=$(git log --pretty=format:"%h" -1)
@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ version=$(git describe --long --tags --dirty --always)
@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ 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')
@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ 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' \
> "
@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ go build -ldflags="$ldflags" .
go: downloading github.com/KirCute/ftpserverlib-pasvportmap v1.25.0
go: downloading github.com/KirCute/sftpd-alist v0.0.12
go: downloading github.com/charmbracelet/bubbles v0.20.0
go: downloading github.com/charmbracelet/bubbletea v1.1.0
go: downloading github.com/charmbracelet/lipgloss v0.13.0
go: downloading github.com/gin-gonic/gin v1.10.0
go: downloading github.com/go-resty/resty/v2 v2.14.0
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading github.com/spf13/cobra v1.8.1
go: downloading github.com/taruti/bytepool v0.0.0-20160310082835-5e3a9ea56543
go: downloading golang.org/x/crypto v0.31.0
go: downloading github.com/caarlos0/env/v9 v9.0.0
go: downloading github.com/natefinch/lumberjack v2.0.0+incompatible
go: downloading github.com/xhofe/tache v0.1.3
go: downloading gorm.io/driver/mysql v1.5.7
go: downloading gorm.io/driver/postgres v1.5.9
go: downloading gorm.io/driver/sqlite v1.5.6
go: downloading gorm.io/gorm v1.25.11
go: downloading github.com/pkg/errors v0.9.1
go: downloading github.com/go-webauthn/webauthn v0.11.1
go: downloading github.com/Xhofe/go-cache v0.0.0-20240804043513-b1a71927bc21
go: downloading github.com/deckarep/golang-set/v2 v2.6.0
go: downloading github.com/json-iterator/go v1.1.12
go: downloading golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e
go: downloading golang.org/x/oauth2 v0.22.0
go: downloading github.com/google/uuid v1.6.0
go: downloading github.com/gin-contrib/cors v1.7.2
go: downloading github.com/fclairamb/go-log v0.5.0
go: downloading github.com/spf13/afero v1.11.0
go: downloading golang.org/x/sys v0.28.0
go: downloading github.com/mattn/go-runewidth v0.0.16
go: downloading github.com/charmbracelet/x/ansi v0.2.3
go: downloading github.com/charmbracelet/x/term v0.2.0
go: downloading github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6
go: downloading github.com/muesli/cancelreader v0.2.2
go: downloading golang.org/x/sync v0.10.0
go: downloading github.com/gin-contrib/sse v0.1.0
go: downloading github.com/mattn/go-isatty v0.0.20
go: downloading golang.org/x/net v0.28.0
go: downloading github.com/muesli/termenv v0.15.2
go: downloading github.com/rivo/uniseg v0.4.7
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/SheltonZhu/115driver v1.0.32
go: downloading github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
go: downloading github.com/gaoyb7/115drive-webdav v0.1.8
go: downloading github.com/orzogc/fake115uploader v0.6.2
go: downloading golang.org/x/time v0.8.0
go: downloading github.com/aws/aws-sdk-go v1.55.5
go: downloading github.com/avast/retry-go v3.0.0+incompatible
go: downloading github.com/dustinxie/ecc v0.0.0-20210511000915-959544187564
go: downloading github.com/Xhofe/rateg v0.0.0-20230728072201-251a4e1adad4
go: downloading google.golang.org/appengine v1.6.8
go: downloading github.com/rclone/rclone v1.67.0
go: downloading github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394
go: downloading github.com/jlaffaye/ftp v0.2.0
go: downloading github.com/golang-jwt/jwt/v4 v4.5.0
go: downloading github.com/city404/v6-public-rpc-proto/go v0.0.0-20240817070657-90f8e24b653e
go: downloading github.com/ipfs/go-cid v0.4.1
go: downloading github.com/zzzhr1990/go-common-entity v0.0.0-20221216044934-fd1c571e3a22
go: downloading google.golang.org/grpc v1.66.0
go: downloading github.com/foxxorcat/mopan-sdk-go v0.1.6
go: downloading github.com/ipfs/go-ipfs-api v0.7.0
go: downloading github.com/larksuite/oapi-sdk-go/v3 v3.3.1
go: downloading github.com/disintegration/imaging v1.6.2
go: downloading github.com/alist-org/times v0.0.0-20240721124654-efa0c7d3ad92
go: downloading github.com/otiai10/copy v1.14.0
go: downloading github.com/u2takey/ffmpeg-go v0.5.0
go: downloading golang.org/x/image v0.19.0
go: downloading github.com/pquerna/otp v1.4.0
go: downloading github.com/t3rm1n4l/go-mega v0.0.0-20240219080617-d494b6a8ace7
go: downloading github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8
go: downloading github.com/minio/sio v0.4.0
go: downloading github.com/pkg/sftp v1.13.6
go: downloading github.com/hirochachacha/go-smb2 v1.1.0
go: downloading github.com/upyun/go-sdk/v3 v3.0.4
go: downloading github.com/foxxorcat/weiyun-sdk-go v0.1.3
go: downloading github.com/xhofe/wopan-sdk-go v0.1.3
go: downloading github.com/mholt/archives v0.1.0
go: downloading github.com/kdomanski/iso9660 v0.4.0
go: downloading github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d
go: downloading github.com/yeka/zip v0.0.0-20231116150916-03d6312748a9
go: downloading golang.org/x/text v0.21.0
go: downloading github.com/dlclark/regexp2 v1.11.4
go: downloading github.com/maruel/natural v1.1.1
go: downloading github.com/jaevor/go-nanoid v1.3.0
go: downloading github.com/xhofe/gsync v0.0.0-20230917091818-2111ceb38a25
go: downloading github.com/go-sql-driver/mysql v1.7.0
go: downloading github.com/jackc/pgx/v5 v5.5.5
go: downloading github.com/mattn/go-sqlite3 v1.14.22
go: downloading github.com/jinzhu/now v1.1.5
go: downloading github.com/jinzhu/inflection v1.0.0
go: downloading github.com/hekmon/transmissionrpc/v3 v3.0.0
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: downloading github.com/modern-go/reflect2 v1.0.2
go: downloading github.com/coreos/go-oidc v2.2.1+incompatible
go: downloading gopkg.in/ldap.v3 v3.1.0
go: downloading github.com/alist-org/gofakes3 v0.0.7
go: downloading github.com/ncw/swift/v2 v2.0.3
go: downloading github.com/go-playground/validator/v10 v10.20.0
go: downloading github.com/pelletier/go-toml/v2 v2.2.2
go: downloading github.com/ugorji/go/codec v1.2.12
go: downloading google.golang.org/protobuf v1.34.2
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/aymanbagabas/go-osc52/v2 v2.0.1
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
go: downloading github.com/bluele/gcache v0.0.2
go: downloading github.com/aead/ecdh v0.2.0
go: downloading github.com/andreburgaud/crypt2go v1.8.0
go: downloading github.com/pierrec/lz4/v4 v4.1.21
go: downloading github.com/golang/protobuf v1.5.4
go: downloading github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd
go: downloading github.com/rfjakob/eme v1.1.2
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading github.com/multiformats/go-multibase v0.2.0
go: downloading github.com/multiformats/go-multihash v0.2.3
go: downloading github.com/multiformats/go-varint v0.0.7
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117
go: downloading github.com/hashicorp/go-version v1.6.0
go: downloading github.com/blang/semver/v4 v4.0.0
go: downloading github.com/ipfs/boxo v0.12.0
go: downloading github.com/libp2p/go-libp2p v0.27.8
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/multiformats/go-multiaddr v0.9.0
go: downloading github.com/u2takey/go-utils v0.3.1
go: downloading github.com/kr/fs v0.1.0
go: downloading github.com/STARRY-S/zip v0.2.1
go: downloading github.com/andybalholm/brotli v1.1.1
go: downloading github.com/bodgit/sevenzip v1.6.0
go: downloading github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707
go: downloading github.com/klauspost/compress v1.17.11
go: downloading github.com/klauspost/pgzip v1.2.6
go: downloading github.com/nwaples/rardecode/v2 v2.0.0-beta.4.0.20241112120701-034e449c6e78
go: downloading github.com/sorairolake/lzip-go v0.3.5
go: downloading github.com/therootcompany/xz v1.0.1
go: downloading github.com/ulikunitz/xz v0.5.12
go: downloading github.com/blevesearch/bleve/v2 v2.4.2
go: downloading github.com/meilisearch/meilisearch-go v0.27.2
go: downloading github.com/jackc/pgpassfile v1.0.0
go: downloading github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a
go: downloading github.com/gorilla/websocket v1.5.3
go: downloading github.com/hashicorp/go-cleanhttp v0.5.2
go: downloading github.com/hekmon/cunits/v2 v2.1.0
go: downloading github.com/go-webauthn/x v0.1.12
go: downloading github.com/golang-jwt/jwt/v5 v5.2.1
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/google/go-tpm v0.9.1
go: downloading github.com/pquerna/cachecontrol v0.1.0
go: downloading gopkg.in/square/go-jose.v2 v2.6.0
go: downloading gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d
go: downloading github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46
go: downloading github.com/gabriel-vasile/mimetype v1.4.3
go: downloading github.com/go-playground/universal-translator v0.18.1
go: downloading github.com/leodido/go-urn v1.4.0
go: downloading github.com/jmespath/go-jmespath v0.4.0
go: downloading github.com/prometheus/client_golang v1.19.1
go: downloading github.com/jzelinskie/whirlpool v0.0.0-20201016144138-0675e54bb004
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/mr-tron/base58 v1.2.0
go: downloading github.com/multiformats/go-base32 v0.1.0
go: downloading github.com/multiformats/go-base36 v0.2.0
go: downloading github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3
go: downloading github.com/libp2p/go-flow-metrics v0.1.0
go: downloading github.com/multiformats/go-multicodec v0.9.0
go: downloading github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc
go: downloading github.com/geoffgarside/ber v1.1.0
go: downloading github.com/bodgit/plumbing v1.3.0
go: downloading github.com/bodgit/windows v1.0.1
go: downloading go4.org v0.0.0-20230225012048-214862532bf5
go: downloading github.com/blevesearch/bleve_index_api v1.1.10
go: downloading github.com/blevesearch/geo v0.1.20
go: downloading github.com/jackc/puddle/v2 v2.2.1
go: downloading github.com/mailru/easyjson v0.7.7
go: downloading github.com/valyala/fasthttp v1.37.1-0.20220607072126-8a320890c08d
go: downloading github.com/fxamacker/cbor/v2 v2.7.0
go: downloading github.com/go-playground/locales v0.14.1
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.3.0
go: downloading github.com/prometheus/client_model v0.5.0
go: downloading github.com/prometheus/common v0.48.0
go: downloading github.com/prometheus/procfs v0.12.0
go: downloading github.com/coreos/go-semver v0.3.1
go: downloading github.com/mattn/go-colorable v0.1.13
go: downloading golang.org/x/term v0.27.0
go: downloading github.com/benbjohnson/clock v1.3.0
go: downloading github.com/multiformats/go-multistream v0.4.1
go: downloading github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0
go: downloading github.com/minio/sha256-simd v1.0.1
go: downloading github.com/libp2p/go-buffer-pool v0.1.0
go: downloading github.com/hashicorp/golang-lru/v2 v2.0.7
go: downloading github.com/RoaringBitmap/roaring v1.9.3
go: downloading github.com/blevesearch/scorch_segment_api/v2 v2.2.15
go: downloading github.com/blevesearch/vellum v1.0.10
go: downloading github.com/blevesearch/zapx/v11 v11.3.10
go: downloading github.com/blevesearch/zapx/v12 v12.3.10
go: downloading github.com/blevesearch/zapx/v13 v13.3.10
go: downloading github.com/blevesearch/zapx/v14 v14.3.10
go: downloading github.com/blevesearch/zapx/v15 v15.3.13
go: downloading github.com/blevesearch/zapx/v16 v16.1.5
go: downloading go.etcd.io/bbolt v1.3.8
go: downloading github.com/blevesearch/upsidedown_store_api v1.0.2
go: downloading github.com/blevesearch/gtreap v0.1.1
go: downloading github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
go: downloading github.com/josharian/intern v1.0.0
go: downloading github.com/valyala/bytebufferpool v1.0.0
go: downloading github.com/x448/float16 v0.8.4
go: downloading github.com/shirou/gopsutil/v3 v3.24.4
go: downloading github.com/abbot/go-http-auth v0.4.0
go: downloading github.com/go-chi/chi/v5 v5.0.12
go: downloading lukechampine.com/blake3 v1.1.7
go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading github.com/klauspost/cpuid/v2 v2.2.7
go: downloading github.com/bits-and-blooms/bitset v1.12.0
go: downloading github.com/blevesearch/mmap-go v1.0.4
go: downloading github.com/golang/snappy v0.0.4
go: downloading github.com/blevesearch/snowballstem v0.9.0
go: downloading github.com/blevesearch/segment v0.9.1
go: downloading github.com/blevesearch/go-porterstemmer v1.0.3
@66788zzz ➜ /workspaces/codespaces-blank/alist (main) $ 


编译好后我们左侧里面就会看到我们编译好的Alist二进制文件
二进制文件

3.3 编译结束

先把新编译好的 alist 二进制文件移动出去,不然会看起来很乱
先授权chmod +x alist
再获取账号密码./alist admin
最后启动项目./alist server
这时右下角会出现按钮,直接打开就会跳转链接,不过这个是私人的,会效验GitHub账号和目前是否匹配。可以在端口处设为公开。
Alist Server
打开之后,我们看到Alist界面就成功了。教程到此结束

4.我的网盘&交流群

4.1 简单网盘

欢迎前往我的网盘里玩:https://pan.ios1.top/

4.2 有偿代搭网盘

可以选择是否进行编译

  • 联系微信:lyy66788zzz
  • 私聊TG的双向Bot:@iOSjdy_bot

4.3 添加交流群组


参考地址:AnWen's Docs

END
本文作者: 文章标题:Alist网盘 - Linux编译教程
本文地址:https://blog.ios1.top/archives/30.html
版权说明:若无注明,本文皆简单博客原创,转载请保留文章出处。
最后修改:2025 年 02 月 05 日
赞赏支持,更有情怀