# AList 搭建与 WebDAV 挂载手册 --- ## 一、Windows 上搭建 AList ### 1.1 下载 AList 从 [AList GitHub Releases](https://github.com/alist-org/alist/releases) 下载 Windows 版本(`alist-windows-amd64.zip`),解压到目标目录,例如 `D:\alist`。 ### 1.2 初始化并启动 ```powershell # 进入 alist 目录 cd D:\alist # 初始化(生成配置文件 data/ 目录) .\alist.exe server # 初始化完成后会输出默认管理员密码,务必记录 # 按 Ctrl+C 停止 ``` ### 1.3 修改端口为 80 编辑 `D:\alist\data\config.json`,找到 `"port"` 字段,将其改为 `80`: ```json { "port": 80, ... } ``` ### 1.4 设置管理员密码 ```powershell cd D:\alist .\alist.exe admin set <你的密码> ``` ### 1.5 配置 Windows 开机自启(WinSW) 使用 WinSW 将 AList 注册为 Windows 服务。 **步骤一:下载 WinSW** 从 [WinSW Releases](https://github.com/winsw/winsw/releases) 下载 `WinSW-x64.exe`,放到 `D:\alist` 目录下,重命名为 `alist-service.exe`。 **步骤二:创建服务配置文件** 在 `D:\alist` 下创建 `alist-service.xml`: ```xml alist AList AList 文件列表服务 D:\alist\alist.exe server D:\alist Automatic ``` **步骤三:安装并启动服务** 以**管理员身份**打开 PowerShell: ```powershell cd D:\alist # 安装服务 .\alist-service.exe install # 启动服务 .\alist-service.exe start # 查看服务状态 .\alist-service.exe status ``` > 验证:浏览器访问 `http://localhost`,看到 AList 登录页面即表示成功。 --- ## 二、Linux 上使用 rclone 挂载 WebDAV ### 2.1 安装 rclone ```bash # 一键安装脚本(推荐) curl https://rclone.org/install.sh | sudo bash # 或通过包管理器 # Debian/Ubuntu sudo apt install -y rclone # RHEL/CentOS/Fedora sudo dnf install -y rclone ``` ### 2.2 配置 rclone 连接 AList WebDAV ```bash rclone config ``` 交互式配置流程: ``` n) New remote name> alist Type of storage> webdav url> http://192.168.1.100:80/dav vendor> other user> admin Password> y) Yes, type in my own password password> <你的AList密码> bearer_token> (留空直接回车) Edit advanced config? n) No Keep this "alist" remote? y) Yes q) Quit config ``` 配置完成后验证连接: ```bash # 列出 AList 根目录 rclone ls alist:/ # 以树形结构查看 rclone tree alist:/ ``` ### 2.3 创建挂载目录 ```bash mkdir -p ~/Desktop/NAS ``` ### 2.4 手动挂载测试 ```bash # 挂载到本地目录 rclone mount alist:/ ~/alist-webdav --vfs-cache-mode writes --daemon # 验证挂载 ls ~/alist-webdav df -h ~/alist-webdav # 卸载 fusermount -u ~/alist-webdav ``` 常用挂载参数说明: | 参数 | 说明 | |------|------| | `--vfs-cache-mode writes` | 缓存模式(`off`/`minimal`/`writes`/`full`),`writes` 适合一般读写 | | `--daemon` | 后台运行 | | `--allow-other` | 允许其他用户访问挂载点(需配合 `/etc/fuse.conf` 中 `user_allow_other`) | | `--buffer-size 32M` | 缓冲区大小 | | `--dir-cache-time 1h` | 目录缓存时间 | | `--log-file /tmp/rclone-alist.log` | 日志输出路径 | | `--log-level INFO` | 日志级别 | ### 2.5 使用 desktop 文件实现开机自动挂载 创建 desktop 自启文件 `~/.config/autostart/nas.desktop`: ```bash cat ~/.config/autostart/nas.desktop [Desktop Entry] Actions=new-window;unmount; Categories=Utility; Comment=Browse the NAS file system Exec=sh -c 'mkdir -p /home/nas/Desktop/nas && rclone mount alist-xhz: /home/nas/Desktop/nas --daemon --vfs-cache-mode writes --allow-non-empty' GenericName=NAS Icon=dde-file-manager MimeType=inode/directory; Name=NAS StartupNotify=true Terminal=false Type=Application Version=1.0 X-Deepin-DEComponent=true X-Deepin-Vendor=deepin # Translations: # Do not manually modify! ``` > **重要**:将上述 `Exec` 字段中的 `/home/<你的用户名>/` 替换为实际家目录路径(运行 `echo $HOME` 查看)。