以前自己折腾的时候主要是 Ubuntu / Debian,自己有记录一份 Ubuntu / Debian 下 Aria2 的编译安装流程~不过 CentOS 的话,因为是 RedHat 系,所以有蛮多不一样的地方,于是就一边摸索一边记录下来了~
那么第一步就是安装各种依赖了,当然还有 autotools 和 libtool 也是需要的/
sudo yum install expat-devel libssh2-devel libxml2-devel \
c-ares-devel zlib-devel gnutls-devel nettle-devel \
gmp-devel libsqlite3x-devel automake autoconf \
gettext-devel libtool
第二步则是安装 GCC 8.0 了喵~因为 Aria2 需要 C++14 的编译支持,而 CentOS 默认的似乎是 GCC 4.9.0 的样子
sudo yum install centos-release-scl sudo yum install devtoolset-8-gcc devtoolset-8-gcc-c++
安装好之后,就可以先切换到 GCC 8.0 的环境下来操作了/
sudo scl enable devtoolset-8 -- zsh
第三步就很简单了,git clone 下来 Aria2 的 repo,然后正常编译安装就好~
git clone --depth=1 https://github.com/aria2/aria2.git cd aria2 autoreconf -i && ./configure --enable-libaria2 && \ make -j`nproc` && sudo make install
下面就来到了第四步~这里假设希望的 Aria2 的下载目录和 session 目录都是 /mnt/vdb/aria2
~先创建名为 aria2
的用户和 group,然后创建好对应的下载目录和 session 文件,并且将下载目录和 session 文件的所属用户和所属组都设置为 aria2
,同时设置 aria2
用户和组对该下载目录可读可写。
sudo adduser --system --home /nonexistent --shell /bin/false --no-create-home --user-group aria2 sudo mkdir -p /mnt/vdb/aria2 && sudo touch /mnt/vdb/aria2/.aria2.session sudo chown -R aria2:aria2 /mnt/vdb/aria2 sudo chmod -R 664 /mnt/vdb/aria2
当然为了方便,可以将自己也加入到 aria2
组里~
sudo usermod -a -G "$(whoami)"
然后将 Aria2 的配置文件放到 /mnt/vdb/aria2.conf
cat <<EOF | sudo tee /mnt/vdb/aria2/aria2.conf dir=/mnt/vdb/aria2 disk-cache=128M file-allocation=trunc continue=true max-concurrent-downloads=10 max-connection-per-server=16 min-split-size=1M split=32 max-overall-download-limit=0 max-download-limit=0 disable-ipv6=true input-file=/mnt/vdb/aria2/.aria2.session save-session=/mnt/vdb/aria2/.aria2.session save-session-interval=60 enable-rpc=true rpc-listen-all=true rpc-allow-origin-all=true rpc-listen-port=23333 rpc-secret=YOUR_SECRET follow-torrent=true bt-max-peers=1024 enable-dht=true bt-save-metadata=true EOF
其中,高亮部分则是用于 RPC 连接 Aria2 时的 secret,假如 Aria2 运行在 1.2.3.4:23333
上的话,在设置了 rpc-secret
之后,就是使用
http://token:[email protected]:23333/jsonrpc
这个地址去连接~
不过不要忘了设置 CentOS 的防火墙~
sudo firewall-cmd --zone=public --add-port=23333/tcp --permanent sudo firewall-cmd --reload
如果觉得 HTTP API 不安全的话,还可以利用 Lets Encrypt 申请一份 SSL 证书~具体如何申请证书这里就不作赘述了~
假设证书在 /etc/example.com/fullchain.pem
,而对应的私钥在 /etc/example/privkey.pem
,那么在 Aria2 的配置文件里加入以下几行就可以~
rpc-secure=true rpc-certificate=/etc/example.com/fullchain.pem rpc-private-key=/etc/example.com/privkey.pem
此时 RPC 方式连接 Aria2 就是
https://token:[email protected]:5678/jsonrpc
最后的话,可以设置 Aria2 的 systemd 服务~
cat <<EOF | sudo tee /etc/systemd/system/aria2.service [Unit] Description=Aria2 After=network-online.target [Service] User=aria2 ExecStart=/usr/local/bin/aria2c --conf-path=/mnt/vdb/aria2/aria2.conf RestartSec=5 Restart=always [Install] WantedBy=multi-user.target EOF
最后启用并且 start 就没问题了w
sudo systemctl enable aria2 sudo systemctl start aria2 sudo systemctl status aria2
这个 主题...
粉嫩少女心啊
Indeed:) But I can not say that I'm an MtF because I haven't started HRT yet.
However, according to WikiPedia, In the 1920s, some groups had been describing pink as a masculine color, an equivalent of the red that was considered to be for men, but lighter for boys
2T?这么大的vps?