首頁 / 精華文章 / [CentOS]在VPS上安裝BT軟體qBittorrent

[CentOS]在VPS上安裝BT軟體qBittorrent

以前介紹過強大的BT軟體Transmission,也介紹過搭配FlexGet變身成超強BT下載機!!! 😎
可是瑞帆,年代都好久了啊 :kao 但Transmission自從2.92版本爆出漏洞後,更新速度就很緩慢,我對它就也沒了好感,所以就想著重新搞一套,剛好就看到了採用libtorrent-rasterbar做核心的qBittorrent,同樣自帶網頁介面,各版本支援性更高,在CentOS 6.10 (Final)7.6.1810安裝上也順利成功運行,所以把過程做個紀錄
1. 安裝依賴套件

yum groupinstall -y "Development Tools"
yum install -y qt-devel boost-devel openssl-devel qt5-qtbase-devel qt5-linguist GeoIP-update

2. 手動鞭譯安裝libtorrent-rasterbar

cd /usr/src
wget https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_1_12/libtorrent-rasterbar-1.1.12.tar.gz
tar -zxf libtorrent-rasterbar-*.tar.gz
cd libtorrent-rasterbar-*
./configure --prefix=/usr CXXFLAGS=-std=c++11
make && make install
ln -s /usr/lib/pkgconfig/libtorrent-rasterbar.pc /usr/lib64/pkgconfig/libtorrent-rasterbar.pc
ln -s /usr/lib/libtorrent-rasterbar.so.9 /usr/lib64/libtorrent-rasterbar.so.9

3. 手動鞭譯安裝qBittorrent

cd /usr/src
wget -O qBittorrent-release-3.3.16.tar.gz https://github.com/qbittorrent/qBittorrent/archive/release-3.3.16.tar.gz
tar -zxf qBittorrent-release-*.tar.gz
cd qBittorrent-release-*
./configure --prefix=/usr --disable-gui CPPFLAGS=-I/usr/include/qt5
make && make install

4. 建立qBittorrent設定檔

mkdir -p ~/.config/qBittorrent
cat > ~/.config/qBittorrent/qBittorrent.conf <<- EOF
&#91;Preferences&#93;
WebUI\Enabled=true
EOF&#91;/code&#93;
5. 新增qBittorrent服務啟動腳本要用到的使用者,密碼部分要輸入兩次!
&#91;code lang="shell"&#93;useradd qBittorrent
passwd qBittorrent&#91;/code&#93;
6. 建立qBittorrent服務啟動腳本,網頁介面用的port改為<font size="3" color="#e60000">8998</font>(預設是8080)
cat > /etc/systemd/system/qbittorrent.service <<- EOF
&#91;Unit&#93;
Description=qBittorrent torrent server
&#91;Service&#93;
User=qBittorrent
ExecStart=/usr/bin/qbittorrent-nox --webui-port=8998
Restart=on-abort
&#91;Install&#93;
WantedBy=multi-user.target
EOF&#91;/code&#93;
7. 設定防火牆,將自訂的網頁介面用的8998連接埠加入白名單(預設是8080),8999是qBittorrent用的通訊埠
&#91;code lang="shell"&#93;service iptables stop
iptables -A INPUT -p tcp --dport 8998 -j ACCEPT
iptables -A INPUT -p udp --dport 8999 -j ACCEPT
service iptables save
systemctl restart iptables
###firewalld請改成下列指令
firewall-cmd --permanent --add-port=8998/tcp
firewall-cmd --permanent --add-port=8999/udp
firewall-cmd --reload&#91;/code&#93;
8. 啟用qBittorrent服務啟動腳本並啟動
&#91;code lang="shell"&#93;chmod +x /etc/systemd/system/qbittorrent.service
systemctl enable qbittorrent
systemctl daemon-reload
systemctl start qbittorrent&#91;/code&#93;
9. 進入網頁介面,<font size="3" color="#e60000">記得一定要先改密碼</font>
http://你的IP:8998
預設帳號:admin
預設密碼:adminadmin
Tools >> Options >> Web UI
User Interface Language // 修改成正體中文
Authentication // 修改密碼
10. 打完收工,回到SSH畫面,清潔溜溜 😝
cd /usr/src
rm -fr libtorrent-rasterbar-* qBittorrent-release-*

額外的指令

檢查qBittorrent啟動狀態

systemctl status qbittorrent -l
ps ax | grep qbittorrent-*
netstat -atunp | grep qbittorrent-*
(可選)最佳化系統的吞吐量、支撐能力

ulimit -n 51200
sysctl -w net.core.default_qdisc=fq
sysctl -w net.core.rmem_default=65536
sysctl -w net.core.wmem_default=65536
sysctl -w net.core.rmem_max=67108864
sysctl -w net.core.wmem_max=67108864
sysctl -w net.core.netdev_max_backlog=4096
sysctl -w net.ipv4.tcp_congestion_control=htcp
sysctl -w net.ipv4.tcp_mtu_probing=1
sysctl -w net.ipv4.tcp_rmem='4096 87380 33554432'
sysctl -w net.ipv4.tcp_wmem='4096 65536 33554432'
###個人常用的最佳化指令開始
sysctl -w net.core.optmem_max=25165824
sysctl -w net.core.somaxconn=4096
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv4.route.flush=1
sysctl -w net.ipv4.tcp_fastopen=3
sysctl -w net.ipv4.tcp_fin_timeout=30
sysctl -w net.ipv4.tcp_keepalive_time=1200
sysctl -w net.ipv4.tcp_max_syn_backlog=4096
sysctl -w net.ipv4.tcp_max_tw_buckets=1440000
sysctl -w net.ipv4.tcp_mtu_probing=1
sysctl -w net.ipv4.tcp_syncookies=1
sysctl -w net.ipv4.tcp_tw_recycle=0
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w fs.file-max=2097152
###個人常用的最佳化指令結束
sysctl --system
ref.

Comments

comments

關於 窮苦人家的小孩

In every democracy, the people get the government they deserve. ~Alexis de Tocqueville
上一篇:
下一篇:

您可能會喜歡

在VMware快速部署CentOS 7或是Windows 10

首先說CentOS,下載osb …

發佈留言