ame

Compiling qbittorrent nox for CentOS from source
Install Dependencies yum groupinstall "Development Tools"...
扫描右侧二维码阅读全文
09
2019/11

Compiling qbittorrent nox for CentOS from source

Install Dependencies

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

Install libtorrent

其他版本可以到 https://github.com/arvidn/libtorrent 获取、
推荐libtorrent 1.1.12版本

wget https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_1_12/libtorrent-rasterbar-1.1.12.tar.gz
tar xf libtorrent-rasterbar-1.1.12.tar.gz
cd libtorrent-rasterbar-1.1.12
./configure --disable-debug --prefix=/usr CXXFLAGS=-std=c++11
make -j$(nproc)
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

透過SCL安裝GCC

https://gcc.gnu.org/
GNU編譯器(GCC)是一套程式語言編譯器,需要用於編譯qBittorrent的源碼。
qBittorrent4.1.4需要C++14進行編譯
CentOS7自帶的GCC4.8.5只支援到C++11,所以稍後會透過SCL安裝GCC8.2 (支援C++14)

yum install centos-release-scl -y
yum install devtoolset-8-gcc* -y
scl enable devtoolset-8 bash

Grab latest qbittorrent

cd 
git clone https://github.com/qbittorrent/qBittorrent.git (or git pull if already cloned)
cd qBittorrent
./configure --prefix=/usr --disable-gui CPPFLAGS=-I/usr/include/qt5
make
make install
cd

编译安装好后退出SCL的GCC環境

exit

运行qbittorrent-nox,试一下是否正常工作

浏览器打开http://yourip:8080
默认用户名:admin
默认密码:adminadmin

Set up qbittorrent as a deamon

nano /usr/lib/systemd/system/qbittorrent.service

写入

[Unit]
Description==qBittorrent torrent server
After=network.target

[Service]
LimitNOFILE=512000
User=root
ExecStart=/usr/bin/qbittorrent-nox
ExecStop=/usr/bin/killall -w qbittorrent-nox

[Install]
WantedBy=multi-user.target

启用这个Unti

systemctl enable qbittorrent
systemctl start qbittorrent

Firewall (optional)

打不開WebUI的需設定Firewall:

firewall-cmd --permanent --add-port=8080/tcp

打開qBittorrent的8999監聽端口:

firewall-cmd --permanent --add-port=8999/tcp

載入設定:

firewall-cmd --reload

創建下載文件夾和設置權限

mkdir /home/Downloads
chmod 777 /home/Downloads

参考文章

https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qbittorrent-nox-for-CentOS-from-source
https://github.com/qbittorrent/qBittorrent/wiki/Setting-up-qBittorrent-as-a-daemon-on-CentOS-7
https://npchk.info/centos7-qbittorrent/

Last modification:December 4th, 2019 at 03:15 pm

Leave a Comment