Alist搭建

下载程序

有些无聊,偶然在github上看到一个名为 Alist 的文档管理项目。本来想装载群晖上,处于安全考虑还是算了,决定还是挂在目前利用率不高的另外一台腾讯云主机上。

github有时候大姨妈来了速度很慢,原打算直接用wegt命令把文件下载到服务器,但是还是很慢,无奈还是打开浏览器手动下载,然后手动上传。

1
2
3
C:\Users\叶捷>scp F:\BQB\alist-linux-amd64.tar.gz root@yeatsj.com:/www/alist
root@yeatsj.com's password:
alist-linux-amd64.tar.gz 100% 11MB 7.1MB/s 00:01

虽然费劲,接下来按照官方文档的内容执行。

解压并授权

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@VM-0-2-centos alist]# ls
alist-linux-amd64.tar.gz
[root@VM-0-2-centos alist]# pwd
/www/alist
# 解压缩
[root@VM-0-2-centos alist]# tar -zxvf alist-linux-amd64.tar.gz
alist
[root@VM-0-2-centos alist]# ls
alist alist-linux-amd64.tar.gz
# 授权
[root@VM-0-2-centos alist]# chmod +x alist
[root@VM-0-2-centos alist]# ./alist server
INFO[2022-11-10 20:58:32] reading config file: data/config.json
INFO[2022-11-10 20:58:32] config file not exists, creating default config file
INFO[2022-11-10 20:58:32] load config from env with prefix: ALIST_
INFO[2022-11-10 20:58:32] init logrus...
INFO[2022-11-10 20:58:32] Successfully created the admin user and the initial password is: KfXt0x8i
INFO[2022-11-10 20:58:32] Aria2 not ready.
INFO[2022-11-10 20:58:32] start server @ 0.0.0.0:5244

根据官方说法看到 start server@0.0.0.0:5244的输出,之后没有报错,说明操作成功。 第一次运行时会输出初始密码。程序默认监听 5244 端口。 现在打开http://ip:5244` 可以看到登录页面。
这里我立马上线看了一下,结果发现没有,懵逼了一会醒悟过来是安全组没开这个端口。然后成功刷新出网页了。

网页这里有个登录选项,这里我们先Crtl +c把程序中断,需要运行下述命令获取默认的随机密码。

1
./alist admin

登录后关于webDav的内容见webDav

守护进程

主要是防止后面服务宕机重启。

使用任意方式编辑 /usr/lib/systemd/system/alist.service 并添加如下内容,其中 path_alist 为 AList 所在的路径

我一般就直接vim了

1
vim /usr/lib/systemd/system/alist.service

修改下path_alist的路径

1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=alist
After=network.target

[Service]
Type=simple
WorkingDirectory=/www/alist
ExecStart=path_alist/alist server
Restart=on-failure

[Install]
WantedBy=multi-user.target

ESC, 然后键入下述命令,保存退出。

1
:wq

重载配置

1
2
3
4
5
6
# 重载配置
[root@VM-0-2-centos alist]# systemctl daemon-reload
# 启动程序
[root@VM-0-2-centos alist]# systemctl start alist
# 看下程序启动没
[root@VM-0-2-centos alist]# curl yeatsj.com:5244

看到命令行刷新的网页基本上就搞定了。

接下停止服务,设置开机自启,然后启动服务。

1
2
3
[root@VM-0-2-centos alist]# systemctl stop alist
[root@VM-0-2-centos alist]# systemctl enable alist
[root@VM-0-2-centos alist]# systemctl start alist

登录网站

到这里登录网站,打开 http://ip:5244 可以看到登录页面。
然后修改密码和用户名以及其它配置就看自己了。
关于储存的方式又很多。这里还是跳转到 webDav