Setting up qBittorrent on Ubuntu

<h3></h3>
<h3>Install</h3>
qBittorrent is now available in official Ubuntu repositories. More up-to-date packages are published on our stable and unstable PPAs. The stable PPA supports Ubuntu 14.04 LTS (only the libtorrent-rasterbar package), 16.04 LTS, 17.04, 17.10 and 18.04 LTS.

Quick instructions To use these PPAs please use the following command and make sure your version is supported:

qBittorrent Stable

$ sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable

Then install qBittorrent by doing this:

$ sudo apt-get update && sudo apt-get install qbittorrent-nox
<h3>User</h3> Assuming you want qbittorent to run as its own user (better for security purposes), let's create the user that qbittorrent will run under and give it a password when prompted. Just press Return for values you want to leave blank:
sudo adduser qbtuser
Adding user `qbtuser' ...
Adding new group `qbtuser' (1003) ...
Adding new user qbtuser' (1003) with group qbtuser' ...
Creating home directory `/home/qbtuser' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for qbtuser
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

<h3>Create Service</h3>
First, create a file: /etc/systemd/system/qbittorrent.service

[Unit]
Description=qBittorrent Daemon Service
After=network.target

[Service]
User=qbtuser    # 可以不用新建qbuser,這裡要做相應修改
ExecStart=/usr/bin/qbittorrent-nox
ExecStop=/usr/bin/killall -w qbittorrent-nox

[Install]
WantedBy=multi-user.target

Normally after editing services we'd issue a reload command but since it will also invoke qbittorrent before we initialized the configuration, we'll give it a skip for now. If you ever make changes to the services file, update systemctl with:

$ sudo systemctl daemon-reload

<h3>Initializing Configuration</h3>
Before we continue, let's run qbittorrent so that it can ask us to accept the disclaimer, and save and create the config file to remember this setting. Doing this will create and save the configuration files under:

/home/qbtuser/.config/qBittorrent/

First we impersonate the qbtuser:

$ sudo su qbtuser

And run qbittorrent:

$ qbittorrent-nox

You should see the following:

 Legal Notice 
qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.

No further notices will be issued.

Press 'y' key to accept and continue...

Press y key and you should see:

 Information 
To control qBittorrent, access the Web UI at http://localhost:8080
The Web UI administrator user name is: admin
The Web UI administrator password is still the default one: adminadmin
This is a security risk, please consider changing your password from program preferences.
03/02/2016 15:51:03 - The Web UI is listening on port 8080
03/02/2016 15:51:04 - qBittorrent is successfully listening on ...

Without doing anything further, you should be able to point a web browser (on the same network) to the IP of your server: http://ip-of-server:8080 and log in with:

User: admin
Password: adminadmin

You should now see the web interface.

Back at the server's command line, exit out of qbittorrent-nox instance with Ctrl-c

Now, stop impersonating the qbittorrent user to return to our account with sudo access:

$ exit

<h3>Enable service:</h3>
Now start the service,

$ sudo systemctl start qbittorrent

Verify it is running:

$ sudo systemctl status qbittorrent

Quit out of the above screen by pressing q

Enable it to start up on boot:

$ sudo systemctl enable qbittorrent 轉自:https://github.com/qbittorrent/qBittorrent/wiki/Setting-up-qBittorrent-on-Ubuntu-server-as-daemon-with-Web-interface-(15.04-and-newer)
none
最后修改于:2020年11月24日 19:17

添加新评论