Spis treści
- 1. Tworzymy nowego użytkownika „rtorrent” i nowy katalog domowy.
- 2. Instalacja programów i paczek.
- 3. Instalacja i włączanie modułu scgi.
- 4. Instalacja XMLRPC.
- 5. Instalacja rTorrent.
- 6. Tworzenie folderów potrzebnych do poprawnego funkcjonowania rTorrenta.
- 7. Tworzenie i edycja pliku z konfiguracją użytkownika .rtorrent.rc.
- 8. Instalacja ruTorrent.
- 9. Tworzenie konfiguracji i zabezpieczanie dostępu do strony hasłem.
- 10. Tworzenie dostępu do strony ruTorrent.
- 11. Zabezpieczanie foleru SCGI (/RPC2).
- 12. Instalacja Screen.
- 13. Tworzenie skryptu startowego pod systemd.
- 14. Dostęp do strony./etc/apache2
Important!
Testowane na:
- Debian 8.x.x,
- rTorrent wersja: 9.4,
- Libtorrent wersja: 13.4,
- Xmlrpc: svn-stable,
- ruTorrent 3.6 – 3.7,
- Apache 2.4.x.
Dodanie użytkownika do /etc/sudoers.
su
hasło root’a.
nano /etc/sudoers
Przykład:
nazwa_użytkownika ALL=(ALL) ALL
1. Tworzymy nowego użytkownika „rtorrent” i nowy katalog domowy.
Katalog domowy: /opt/rtorrent.
sudo adduser --home /opt/rtorrent rtorrent
2. Instalacja programów i paczek.
sudo apt-get update sudo apt-get upgrade
sudo apt-get install subversion build-essential automake libtool libcppunit-dev libcurl3-dev sudo apt-get install libsigc++-2.0-dev libcppunit-dev unzip unrar-free curl libncurses-dev sudo apt-get install apache2 apache2-utils php5 php5-cli php5-curl php-xml-rss php5-xmlrpc sudo apt-get install php5-sqlite sqlite libapache2-mod-php5 libapache2-mod-xsendfile
3. Instalacja i włączanie modułu scgi.
sudo apt-get install libapache2-mod-scgi ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load sudo /etc/init.d/apache2 restart
4. Instalacja XMLRPC.
cd $HOME sudo mkdir install cd install sudo svn checkout http://svn.code.sf.net/p/xmlrpc-c/code/stable xmlrpc-c cd xmlrpc-c sudo ./configure --disable-cplusplus sudo make sudo make install
5. Instalacja rTorrent.
5.1. Instalacja bibliotek Libtorrent.
cd .. sudo wget https://github.com/rakshasa/libtorrent/archive/0.13.4.tar.gz -O libtorrent-0.13.4.tar.gz sudo tar xvf libtorrent-0.13.4.tar.gz cd libtorrent-0.13.4 sudo ./autogen.sh sudo ./configure sudo make sudo make install
5.2. Instalacja rTorrent.
cd .. sudo wget https://github.com/rakshasa/rtorrent/archive/0.9.4.tar.gz -O rtorrent-0.9.4.tar.gz sudo tar xvf rtorrent-0.9.4.tar.gz cd rtorrent-0.9.4 sudo ./autogen.sh sudo ./configure --with-xmlrpc-c sudo make sudo make install sudo ldconfig
6. Tworzenie folderów potrzebnych do poprawnego funkcjonowania rTorrenta.
sudo mkdir -p /opt/rtorrent/{session,watch,download} sudo chmod 777 -R /opt/rtorrent/{session,watch,download} sudo chown rtorrent:rtorrent -R /opt/rtorrent/{session,watch,download}
7. Tworzenie i edycja pliku z konfiguracją użytkownika .rtorrent.rc.
sudo wget https://raw.githubusercontent.com/rakshasa/rtorrent/master/doc/rtorrent.rc -O /opt/rtorrent/.rtorrent.rc
sudo nano /opt/rtorrent/.rtorrent.rc
Edytujemy: directory, session, watch_directory, port_range i dodajemy port scgi: scgi_port.
directory = /opt/rtorrent/download
session = /opt/rtorrent/session
#schedule = watch_directory,5,5,load_start=/opt/rtorrent/watch/*.torrent
port_range = 6882-6892
upload_rate = 0
download_rate = 0
use_udp_trackers = yes
max_uploads = 200
min_peers=10
max_peers=400
check_hash = no
# DHT
peer_exchange = yes
dht_port = 1026
dht = auto
# Encryption
encryption = allow_incoming,try_outgoing,require,require_RC4,prefer_plaintext,enable_retry
system.file_allocate.set = yes
system.method.insert=checkdirs1,simple,"not=\"$equal={d.get_custom1=,d.get_base_path=}\""
system.method.insert=movecheck1,simple,"and={checkdirs1=,d.get_complete=,d.get_custom1=}"
system.method.insert=movedir1,simple,"d.set_directory=$d.get_custom1=;execute=mv,-u,$d.get_base_path=,$d.get_cust$
system.method.set_key=event.download.hash_done,move_hashed1,"branch={$movecheck1=,movedir1=}"
# SCGI
scgi_port = localhost:5000
sudo chmod 777 /opt/rtorrent/.rtorrent.rc
8. Instalacja ruTorrent.
8.1. ruTorrent via GIT.
sudo apt-get install git sudo git clone https://github.com/Novik/ruTorrent.git /var/www/rutorrent/ sudo chown -R www-data:www-data /var/www/rutorrent
LUB
8.2. ruTorrent ver. 3.7.
cd .. sudo wget https://bintray.com/artifact/download/novik65/generic/ruTorrent-3.7.zip sudo unzip ruTorrent-3.7.zip sudo mv ruTorrent-master /var/www/rutorrent sudo chown -R www-data:www-data /var/www/rutorrent
LUB
8.3. ruTorrent ver. 3.6.
cd .. sudo wget http://dl.bintray.com/novik65/generic/rutorrent-3.6.tar.gz sudo tar xvf rutorrent-3.6.tar.gz sudo mv rutorrent /var/www sudo wget http://dl.bintray.com/novik65/generic/plugins-3.6.tar.gz sudo tar xvf plugins-3.6.tar.gz sudo mv plugins /var/www/rutorrent sudo chown -R www-data:www-data /var/www/rutorrent
LUB
8.4. ruTorrent ver. 3.5.
cd .. sudo wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/rutorrent/rutorrent-3.5.tar.gz sudo tar xvf rutorrent-3.5.tar.gz sudo mv rutorrent /var/www sudo wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/rutorrent/plugins-3.5.tar.gz sudo tar xvf plugins-3.5.tar.gz sudo mv plugins /var/www/rutorrent sudo rm -rf /var/www/rutorrent/plugins/darkpal sudo chown -R www-data:www-data /var/www/rutorrent
8.5. ruTorrent mobile.
Dostęp do ruTorrent, rTorrent z tel. iPhone i starszych modeli tel. innych firm.
Dostęp do ruTorrent, rTorrent z tel. z systemem Android.
http://pl.terminal28.com/rtorrent-transdroid-dostep-do-rtorrenta-z-telefonu
Zmiana ustawień odnośnie informacji o zajętości dysku/katalogu do którego ściągamy pliki.
Edytujemy plik konfiguracyjny ruTorrent’a i zmieniamy ścieżkę do dysku/katalogu do którego ściągamy pliki. Zastępujemy sciężkę do katalogu root „/” katalogiem ze ściagniętymi plikami.
sudo nano /var/www/rutorrent/conf/config.php
$topDirectory = '/opt/rtorrent/download'; // Upper available directory. Absolute path with trail slash.
Od tego momentu w lewym dolnym rogu ruTorrent będzie pokazywał prawidłową informacje o zajetości dysku/katalogu.
8.6. Instalacja pluginu mediainfo.
sudo apt-get install mediainfo
8.7. Instalacja GeoIP i ffmpeg.
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz sudo gunzip GeoLiteCity.dat.gz sudo mkdir -v /usr/share/GeoIP sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat sudo apt-get install php5-geoip libav-tools
sudo ln -s /usr/bin/avconv /usr/bin/ffmpeg
9. Tworzenie konfiguracji i zabezpieczanie dostępu do strony hasłem.
cd /var/www/rutorrent
Tworzenie pliku z szyfrowanym hasłem .htpasswd
sudo htpasswd -c /var/www/rutorrent/.htpasswd nazwa_użytkownika
Edytujemy plik /var/www/rutorrent/.htaccess i dodajemy wpis, który informuje apache2 o plikach i lokalizacjach chronionych hasłem.
sudo nano /var/www/rutorrent/.htaccess
...
AuthUserFile /var/www/rutorrent/.htpasswd AuthName "ruTorrent_login" AuthType Basic require valid-user
...
10. Tworzenie dostępu do strony ruTorrent.
Tworzymy plik konfiguracyjny /etc/apache2/sites-available/rutorrent,
konfigurujemy alias do strony rutorrent.
sudo nano /etc/apache2/sites-available/rutorrent.conf
# ruTorrent #=========================================================================== <IfModule alias_module> Alias /rutorrent /var/www/rutorrent/ <Directory /var/www/rutorrent/> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride all Require all granted </Directory> </IfModule> #===========================================================================
sudo ln -s /etc/apache2/sites-available/rutorrent.conf /etc/apache2/sites-enabled/rutorrent.conf
Włączamy moduły auth_digest i authn_file:
sudo a2enmod auth_digest sudo a2enmod authn_file
Restart apache2:
sudo /etc/init.d/apache2 restart
11. Zabezpieczanie foleru SCGI (/RPC2).
Tworzenie folderów: passwords-available, passwords-enabled w /etc/apache2.
sudo mkdir -p /etc/apache2/passwords-{available,enabled}
Przechodzimy do folderu /etc/apache2/passwords-available aby utworzyć nowe hasło do SCGI.
cd /etc/apache2/passwords-available
sudo htpasswd -c rtorrentscgi.conf nazwa_użytkownika
Linkujemy folder passwords-available do passwords-enabled.
cd ../passwords-enabled sudo ln -s ../passwords-available/rtorrentscgi.conf
Edytujemy plik /etc/apache2/sites-available/rtorrentscgi i dodajemy wpis, który informuje apache2 o plikach, lokalizacji SCGI chronionej hasłem i ustawiamy dostęp konfiguracji tylko z maszynie lokalnej.
sudo nano /etc/apache2/sites-available/rtorrentscgi.conf
#rTorrent lokalizacja hasła do SCGI #=========================================================================== <LocationMatch "/RPC2"> AuthType Basic AuthName "rtorrentscgi" AuthUserFile /etc/apache2/passwords-enabled/rtorrentscgi.conf Require valid-user BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On Require ip 127.0.0.1 </LocationMatch> #===========================================================================
# SCGI PORT #=========================================================================== #LoadModule scgi_module /usr/lib/apache2/modules/mod_scgi.so SCGIMount /RPC2 127.0.0.1:5000 #===========================================================================
sudo ln -s /etc/apache2/sites-available/rtorrentscgi.conf /etc/apache2/sites-enabled/rtorrentscgi.conf
Restartujemy apache2.
sudo /etc/init.d/apache2 restart
12. Instalacja Screen.
sudo apt-get install screen
Uruchomienie sesji rTorrenta w tle
screen -fa -d -m rtorrent
Test nasłuchiwania rtorrenta:
sudo netstat -npl | grep rtorrent
Prawidłowa odpowiedź..
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 6642/rtorrent tcp 0 0 0.0.0.0:6892 0.0.0.0:* LISTEN 6642/rtorrent
13. Tworzenie skryptu startowego pod systemd.
Automatyczne uruchamianie rTorrenta wraz ze startem systemu (serwera) oraz możliwość zatrzymywania, restartowania, i uruchamiania programu.
Tworzymy skrypt startowy pod systemd.
sudo nano /etc/systemd/system/rtorrent.service
[Unit] Description=rTorrent After=network.target [Service] UMask=077 Type=forking KillMode=none User=rtorrent ExecStartPre=-/bin/rm -f /opt/rtorrent/session/rtorrent.lock ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/local/bin/rtorrent ExecStop=/usr/bin/killall -w -s 2 /usr/local/bin/rtorrent WorkingDirectory=/opt/rtorrent/ [Install] WantedBy=multi-user.target
Włączenie skryptu podczas uruchamiania systemu.
sudo systemctl enable rtorrent.service
Podczas następnego startu systemu (serwera) rTorrent zostanie automatycznie uruchomiony w sesji screen’a
Komendy:
sudo service rtorrent start - uruchamianie sudo service rtorrent stop - zatrzymywanie sudo service rtorrent restart - restart
lub
sudo systemctl start rtorrent - uruchamianie sudo systemctl stop rtorrent - zatrzymywanie sudo systemctl restart rtorrent - restart
14. Dostęp do strony./etc/apache2
http://adres_IP/rutorrent
lub
http://twoja_domena/rutorrent
Powinieneś być poproszony o nazwę użytkownika i hasło
Źródło:
http://rakshasa.github.io/rtorrent/
http://code.google.com/p/rutorrent/
http://code.google.com/p/avalanche-rt/
Notice
Jeśli ten artykuł pomógł Ci, masz co do niego jakieś wątpliwości lub pytania „Zostaw komentarz”, a na pewno na niego odpowiem.
Wspomóż rozwój tego serwisu darowizną:
Wszelkie pozyskane fundusze idą na opłacenie miesięcznego abonamentu za sprzęt na, którym stoi serwer.
8 Komentarzy
Skip to comment form
Witam
Gratuluje poradnika wszysko jasno i kalrownie opisane, mam tylko problem z auto startem. Nie uruchamia się po restarcie a w logach mam to
sudo less /var/log/syslog | grep rtorrent
May 20 10:00:18 ********** rtorrent[617]: Starting rtorrent: rtorrentstty: standardowe wejście: Niewłaściwy ioctl dla urządzenia
May 20 10:00:18 ********** rtorrent[617]: .
Pozdrawiam
Author
Zaktualizowałem tutorial, zamiast skryptu startowego z init.d jest nowy skrypt startowy pod systemd, zobacz punkt 13.
Czy wszystko zawarte w poradniku nadal jest aktualne?
Przymierzam się właśnie do takiej konfiguracji serwera pod rtorrent+rutorrent
póki co to tak..
Zauważyłem, że wszystkie ścieżki /var/www muszę zamieniać na /var/www/html bo inaczej nie otwiera mi przeglądarka katalogów. Coś robię źle?
Wszystko jest ok poza apache2.
Od wersji 2.4.. (nie pamiętam) w configu /etc/apache2/sites-available/000-default.conf DocumentRoot to /var/www/html, więc zmień sobie to w apache2 na /var/www albo wszystkie w tutorialu /var/www zmiań na /var/www/html.
blokuje mnie w pkt 4
po poleceniu sudo svn checkout http …
A xmlrpc-c/lib/expat/xmltok/xmltok_impl.c
svn: E175002: Żądanie GET nie powiodło się: 404 Not Found
Coś ze strony serwera ? Bo wczoraj nie odpowiadał w ogóle i od razu wyskakiwał error.
„svn: E000104: Unable to connect to a repository at URL 'http://svn.code.sf.net/p/xmlrpc-c/code/stable'
svn: E000104: Błąd podczas wykonywania kontekstu: Połączenie zerwane przez drugą stronę”
A może można skąd innąd pobrać ?
Przepraszam za banalne pytania 🙂
wina serwera na którym jest xmlrpc-c