Spis treści
- 1. Tworzenie nowego użytkownika „rtorrent” i nowy katalog domowy.
- 2. Aktualizacja systemu przed instalacją rtorrent.
- 3. Instalacja serwera Apache2, PHP7, itp .
- 4. Instalacja rtorrent.
- 5. Tworzenie folderów potrzebnych do poprawnego funkcjonowania rTorrenta i ruTorrenta.
- 6. Tworzenie pliku z konfiguracją użytkownika .rtorrent.rc.
- 7. Instalacja i konfiguracja ruTorrent.
- 8. Instalacja baz GeoIP.
- 9. Tworzenie konfiguracji i zabezpieczanie dostępu do ruTorrent hasłem.
- 10. Tworzenie dostępu do strony ruTorrent.
- 11. Aktywacja modułów serwera Apache2.
- 12. Zabezpieczanie katalogu SCGI (/RPC2).
- 13. Tworzenie skryptu startowego pod systemd.
- 14. Uruchomienie rTorrent.
Important!
Testowane na:
- Debian 9.x.x,
- rTorrent wersja: 9.6,
- Libtorrent wersja: 13.6,
- ruTorrent 3.7 – git,
- Apache 2.4.x.
Dodanie własnego użytkownika do sudo: /etc/sudoers.
su
hasło root’a.
apt-get install sudo nano /etc/sudoers
Przykład:
nazwa_użytkownika ALL=(ALL) ALL
Dodanie unrar do listy APT.
sudo nano /etc/apt/sources.list
Dodanie na koniec kazdego linka: main contrib non-free w konfiguracji listy APT .
deb http://http.debian.net/debian stretch-backports main contrib non-free
Aktualizacja i instalacja unrar.
sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install unrar
1. Tworzenie nowego użytkownika „rtorrent” i nowy katalog domowy.
Katalog domowy: /opt/rtorrent.
Debian 9.5+.
sudo adduser --disabled-login --disabled-password --home /opt/rtorrent --system rtorrent
Debian 8-9.
sudo adduser -s /sbin/nologin --home /opt/rtorrent rtorrent
2. Aktualizacja systemu przed instalacją rtorrent.
sudo apt-get update sudo apt-get upgrade
3. Instalacja serwera Apache2, PHP7, itp .
sudo apt-get -y install php php-geoip php7.0-cli php7.0-json php7.0-curl php7.0-cgi php7.0-mbstring libapache2-mod-php libapache2-mod-scgi libapache2-mod-xsendfile apache2 unrar unzip libav-tools ffmpeg mediainfo curl screen sqlite3 git net-tools sox
4. Instalacja rtorrent.
sudo apt-get -y install rtorrent libtorrent19 libxmlrpc-core-c3
5. Tworzenie folderów potrzebnych do poprawnego funkcjonowania rTorrenta i ruTorrenta.
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}
6. Tworzenie pliku z konfiguracją użytkownika .rtorrent.rc.
Katalog domyślny: /opt/rtorrent/.
sudo wget --no-check-certificate https://terminal28.com/download/.rtorrent.rc-new -O /opt/rtorrent/.rtorrent.rc sudo chmod 777 /opt/rtorrent/.rtorrent.rc
Przykładowy plik konfiguracyjny .rtorrent.rc:
# Port SCGI scgi_port = localhost:5000 #This is an example resource file for rTorrent. Copy to # ~/.rtorrent.rc and enable/modify the options as needed. Remember to # uncomment the options you wish to enable. # Maximum and minimum number of peers to connect to per torrent. # throttle.min_peers.normal.set = 40 throttle.max_peers.normal.set = 100 # Same as above but for seeding completed torrents (-1 = same as downloading) # throttle.min_peers.seed.set = 10 throttle.max_peers.seed.set = 100 # Maximum number of simultanious uploads per torrent. # throttle.max_uploads.set = 15 # Global upload and download rate in KiB. "0" for unlimited. # throttle.global_down.max_rate.set_kb = 0 throttle.global_up.max_rate.set_kb = 8 # Default directory to save the downloaded torrents. # directory.default.set = /opt/rtorrent/download # Default session directory. Make sure you don't run multiple instance # of rtorrent using the same session directory. Perhaps using a # relative path? # session.path.set = /opt/rtorrent/session # Watch a directory for new torrents, and stop those that have been # deleted. # schedule2 = watch_directory,5,5,load_start=/opt/rtorrent/session/*.torrent schedule2 = untied_directory,5,5,stop_untied= # Close torrents when diskspace is low. # schedule2 = low_diskspace,5,60,close_low_diskspace=2000M # The ip address reported to the tracker. # #network.local_address.set = 127.0.0.1 #network.local_address.set = rakshasa.no # The ip address the listening socket and outgoing connections is # bound to. # #network.bind_address.set = 127.0.0.1 #network.bind_address.set = rakshasa.no # Port range to use for listening. # network.port_range.set = 6890-6999 # Start opening ports at a random position within the port range. # network.port_random.set = no # Check hash for finished torrents. Might be usefull until the bug is # fixed that causes lack of diskspace not to be properly reported. # pieces.hash.on_completion.set = no # Set whether the client should try to connect to UDP trackers. # trackers.use_udp.set = yes # Alternative calls to bind and ip that should handle dynamic ip's. # #schedule2 = ip_tick,0,1800,ip=rakshasa #schedule2 = bind_tick,0,1800,bind=rakshasa # Encryption options, set to none (default) or any combination of the following: # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext # # The example value allows incoming encrypted connections, starts unencrypted # outgoing connections but retries with encryption if they fail, preferring # plaintext to RC4 encryption after the encrypted handshake # protocol.encryption.set = allow_incoming,enable_retry,prefer_plaintext # Enable DHT support for trackerless torrents or when all trackers are down. # May be set to "disable" (completely disable DHT), "off" (do not start DHT), # "auto" (start and stop DHT as needed), or "on" (start DHT immediately). # The default is "off". For DHT to work, a session directory must be defined. # dht.mode.set = auto # UDP port to use for DHT. # dht.port.set = 6881 # Enable peer exchange (for torrents not marked private) # protocol.pex.set = yes # Set downlad list layout style. ("full", "compact") # #ui.torrent_list.layout.set = "full"
7. Instalacja i konfiguracja ruTorrent.
7.1. ruTorrent via GIT.
sudo git clone https://github.com/Novik/ruTorrent.git /var/www/rutorrent/ sudo chown -R www-data:www-data /var/www/rutorrent
7.2. 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.
Niektóre aplikacje mogą znajdować się w innych lokalizacjach niż są zazwyczaj domyślnie.
Najlepiej jest użyć komendy whereis do wyszukiwania plików i sprawdzić gdzie znajdują się pliki binarne:
whereis gzip
Przykład: gzip: /bin/gzip /usr/share/man/man1/gzip.1.gz /usr/share/info/gzip.info.gz
$pathToExternals = array( "php" => '/usr/bin/php', // Something like /usr/bin/php. If empty, will be found in PATH. "curl" => '/usr/bin/curl', // Something like /usr/bin/curl. If empty, will be found in PATH. "gzip" => 'bin/gzip', // Something like /usr/bin/gzip. If empty, will be found in PATH. "id" => '/usr/bin/id', // Something like /usr/bin/id. If empty, will be found in PATH. "stat" => '/usr/bin/stat', // Something like /usr/bin/stat. If empty, will be found in PATH. );
8. Instalacja baz GeoIP.
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
9. Tworzenie konfiguracji i zabezpieczanie dostępu do ruTorrent 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
11. Aktywacja modułów serwera Apache2.
sudo a2enmod auth_digest sudo a2enmod authn_file sudo a2enmod xsendfile sudo a2enmod scgi
12. Zabezpieczanie katalogu 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 katalogu SCGI.
cd /etc/apache2/passwords-available
sudo htpasswd -c rtorrentscgi nazwa_użytkownika
Linkujemy plik konfiguracyjny rtorrentscgi z katalogu passwords-available do passwords-enabled.
sudo ln -s /etc/apache2/passwords-available/rtorrentscgi /etc/apache2/passwords-enabled/rtorrentscgi
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 maszyny 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 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 serwer Apache2.
sudo service apache2 restart
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=002 Type=forking RemainAfterExit=yes KillMode=none User=rtorrent ExecStartPre=-/bin/rm -f /opt/rtorrent/session/rtorrent.lock ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent ExecStop=/usr/bin/killall -w -s 2 /usr/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 - restar
14. Uruchomienie rTorrent.
sudo service rtorrent start
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 16229/rtorrent tcp 0 0 0.0.0.0:6890 0.0.0.0:* LISTEN 16229/rtorrent udp 0 0 0.0.0.0:6881 0.0.0.0:* 16229/rtorrent
Dostęp do strony ruTorrent:
http://adres_IP/rutorrent
lub
http://twoja_domena/rutorrent
Powinieneś być poproszony o nazwę użytkownika i hasł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.
9 Komentarzy
Skip to comment form
Witam,
Zainstalowałem rtorrent + rutorrent i działa OK.
Próbowałem też uzysakć dostęp do rtorrenta za pomocą telefonu z androidem z zainstalowaną aplikacją transdroid ale niestety nie działa.
Czy wskazany wyżej link do poradnika:
http://pl.terminal28.com/rtorrent-transdroid-dostep-do-rtorrenta-z-telefonu
jest aktualny?
Próbuje wstawić w ustawieniach aplikacji Transdrone jako
Nazwę hosta lub IP: (adres który działa w rutorrent) czyli
twoja_domena/rutorrent
ale nie mogę się połączyć. ..
Inne ustawienia które mam
port: 80
typ serwera: rTorrent
SCGI mount point: /RPC2
login i hasło z rutorrenta
Poprzednio korzystałem z Transdrone z rutorent zainstalowanym na innej maszynie wtedy jako 'Nazwę hosta lub IP': miałem tylko 'twoja domena' bez slesza w nazwie '/rutorrent' Może to mu przeszkadza?
Na samym dole tutoriala masz opis dostepu do rutorrenta przez www.
http://adres_IP/rutorrent lub http://twoja_domena/rutorrent
Masz 2 opcje do wyboru:
1. wpisujesz nazwe ip lub hosta z /rutorrent
2. przenosisz rutorrenta z katalogu /var/www/rutorrent do katalogu gównego /var/www,
w konfigu sudo nano /etc/apache2/sites-available/rutorrent.conf usuwasz:
Alias /rutorrent /var/www/rutorrent/
zmieniasz Directory /var/www/rutorrent/ na /var/www/.
Dzięki za poradnik i za odpowiedź 🙂
Zrobiłem trochę inaczej i Transdrone działa 🙂
Mianowicie zmieniłem zawartość pliku /etc/apache2/sites-available/rutorrent.conf.
Utworzyłem wirtualnego hosta:
Listen *:5001
DocumentRoot /var/www/rutorrent/
Require all granted
w telefonie podaje tylko moja-domena oraz port 5001.
Co ciekawe na komputerze z WIN działają oba adresy
http:/moja-domena(localhost):5001/
http://moja-domena(localhost)/rutorrent/
Korzystając z Transdroide łącze się za pomocą mojej domowej sieci WIFI.
Aby łączyć się z 'zewnątrz' spróbuje skonfigurować połączenie za pomocą openVPN.
Pozdrawiam, B
Cześć,
Po wcześniejszych pozytywnych doświadczeniach próbuje zainstalować rutorrent+rtorrent z tego poradnika na Ubuntu 18.10
Tym razem utknąłem i nie mogę połączyć się z rtorrentem poprzez mod_scgi. Od razu zaznaczę, że za pomocą pluginów rpc i httprpc rtorrent i rutorrent łączą się i widać torrenty jednak kiedy wyłączę oba pluginy i chcę korzystać wyłącznie z mod_scgi torrenty nie pojawiają się i mam komunikat w rutorrencie:
[26.10.2018 16:56:11] Bad response from server: (500 [error,list]) 500 Internal Server Error Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Apache/2.4.34 (Ubuntu) Server at akacja Port 80
Wiem, że w tym czasie rtorrent i rutorrent są połączone bo ru torrent pokazuje poprawnie wersję trorrenta i libtorrenta oraz otwarty port.
W logu apache2 widzę:
[Fri Oct 26 16:45:52.963379 2018] [authn_file:error] [pid 20754] (2)No such file or directory: [client 10.10.10.14:57630] AH01620: Could not open password file: /etc/apache2/passwords-enabled/rtorrentscgi, referer: http://10.10.10.1/rutorrent/
Wszystko sprawdziłem 2 razy i nie wiem co może być nie tak. Dlaczego z rpc i httprpc działa a z natywnym mod_scgi nie chce… Prośba o sugestę co można byłoby jeszcze sprawdzić by ru torrent z mod_scgi ruszył.
Dzięki,
bern
Author
może jest jakas literówka albo nie zrobiłeś symlinka..
sudo ln -s /etc/apache2/passwords-available/rtorrentscgi /etc/apache2/passwords-enabled/rtorrentscgi
Witam
Czy można zmienić katalog domowy na „home/user” i tam trzymać rtorrenta.rc oraz katalog rtorrent z session itp?
Pozdrawiam
Author
można, wtedy wszystko konfigurujesz pod tego użytkownika..
Cześć,
już kilka razy instalowałem ze wcześniejszych poradników rtorrent na raspberry pi, ale teraz coś mi nie idzie:(
Raspbian buster.
1. Po dodaniu usera tym polecenia
sudo adduser –disabled-login –disabled-password –home /opt/rtorrent –system rtorrent
to nie mogę potem:
sudo chown rtorrent:rtorrent -R /opt/rtorrent/{session,watch,download}
komunikat jaki dostaję to: Błędna grupa.
2. Generalnie nie startuje mi rtorrent, ale nie ma też komunikatu błędu. Gdzie mogę znaleźć logi?
Please help 🙂
Author
Przy disabled-login, disabled-password, home i system są 2 myślniki/kreski (dashe).
Tutorial pokazuje jednen dłuższy myślnik/kreskę (dasha). Po Kilku aktualizacjach CMS’a i skórek coś sie posypało..
Dzieki za uwagę juz szukam rozwiazania zeby to poprawić..
sudo adduser –disabled-login –disabled-password –home /opt/rtorrent –system rtorrent