Advertisement
blaize

Install rTorrent + NginX + ruTorrent + Secure ruTorrent

Feb 27th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.69 KB | None | 0 0
  1. Part 1 – Install rTorrent + NginX + ruTorrent
  2. June 11, 2014/0 Comments/in Debian, Linux, Seedbox /by G33K
  3.  
  4. *System Update
  5. --------------
  6. apt-get update
  7. apt-get upgrade
  8.  
  9. *Check if Apache installed by Default
  10. dpkg -s apache
  11.  
  12. If apache is not installed it will show something like this :
  13. --------------
  14. dpkg-query: package 'apache' is not installed and no information is available
  15. Use dpkg --info (= dpkg-deb --info) to examine archive files,
  16. and dpkg --contents (= dpkg-deb --contents) to list their contents.
  17.  
  18. If installed, delete it by this command
  19. --------------
  20. service apache2 stop
  21.  
  22. apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
  23.  
  24. apt-get remove apache2
  25.  
  26. apt-get autoremove
  27.  
  28. ========================
  29.  
  30. *Install sudo
  31. --------------
  32. apt-get install sudo
  33.  
  34. *Install Build Essential
  35. --------------
  36. sudo apt-get install build-essential subversion automake libtool libcppunit-dev libcurl3-dev libsigc++-2.0-dev libcppunit-dev curl libncurses-dev
  37.  
  38. *Install NginX
  39. --------------
  40. sudo apt-get install nginx-full
  41.  
  42. *Install nano
  43. --------------
  44. sudo apt-get install nano
  45.  
  46. *Install Screen
  47. --------------
  48. sudo apt-get install screen
  49.  
  50. *Install Zip/Unzip/Unrar/7-Zip
  51. --------------
  52. sudo apt-get install unzip unrar-free p7zip-full
  53.  
  54. *Install MediaInfo
  55. --------------
  56. sudo apt-get install mediainfo
  57.  
  58. *Install php
  59. --------------
  60. sudo apt-get install php5-fpm php5-cli php5-geoip php5 php5-curl php-xml-rss php5-xmlrpc php5-sqlite sqlite
  61.  
  62. * Install GeoIP
  63. --------------
  64. sudo wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
  65. sudo gunzip GeoLiteCity.dat.gz
  66. sudo mkdir -v /usr/share/GeoIP
  67. sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
  68.  
  69. ========================
  70.  
  71. * Install XMLRPC.
  72. --------------
  73. sudo mkdir install
  74. cd install
  75. sudo svn checkout http://svn.code.sf.net/p/xmlrpc-c/code/stable xmlrpc-c
  76. cd xmlrpc-c
  77. sudo ./configure --disable-cplusplus
  78. sudo make
  79. sudo make install
  80.  
  81. * Install rTorrent.
  82.  
  83. Install libtorrent
  84. --------------
  85. cd ..
  86. sudo wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.4.tar.gz
  87. sudo tar xvf libtorrent-0.13.4.tar.gz
  88. cd libtorrent-0.13.4
  89. sudo ./autogen.sh
  90. sudo ./configure
  91. sudo make
  92. sudo make install
  93.  
  94. Install rTorrent
  95. --------------
  96. cd ..
  97. sudo wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.4.tar.gz
  98. sudo tar xvf rtorrent-0.9.4.tar.gz
  99. cd rtorrent-0.9.4
  100. sudo ./autogen.sh
  101. sudo ./configure --with-xmlrpc-c
  102. sudo make
  103. sudo make install
  104. sudo ldconfig
  105.  
  106. ========================
  107.  
  108. *Create Directories
  109. --------------
  110. mkdir -p ~/rtorrent/{.session,watch,download}
  111.  
  112. *Edit rTorrent Config File
  113. --------------
  114. nano ~/.rtorrent.rc
  115.    
  116. directory = /var/www/download
  117. session = /var/www/session
  118. #schedule = watch_directory,5,5,load_start=/home/username/rtorrent/watch/*.torrent
  119. port_range = 6882-6892
  120. upload_rate = 0
  121. download_rate = 0
  122. use_udp_trackers = yes
  123. max_uploads = 200
  124. min_peers=10
  125. max_peers=400
  126. check_hash = no
  127.  
  128. # DHT
  129. peer_exchange = yes
  130. dht_port = 1026
  131. dht = auto
  132.  
  133. # Encryption
  134. encryption = allow_incoming,try_outgoing,require,require_RC4,prefer_plaintext,enable_retry
  135.  
  136. # SCGI
  137. scgi_port = localhost:5000
  138.  
  139. *Change Permission for rTorrent Config File
  140. sudo chmod 777 /root/.rtorrent.rc
  141.  
  142. *Create Download Directory
  143. --------------
  144. sudo mkdir /var/www
  145. sudo mkdir /var/www/session
  146. sudo mkdir /var/www/rutorrent
  147. sudo mkdir /var/www/download
  148. sudo chown www-data:www-data /var/www
  149. sudo chown www-data:www-data /var/www/session
  150. sudo chown www-data:www-data /var/www/rutorrent
  151. sudo chown www-data:www-data /var/www/download
  152.  
  153. *Download ruTorrent & Plugins
  154. --------------
  155. cd
  156. wget http://dl.bintray.com/novik65/generic/rutorrent-3.6.tar.gz
  157. wget http://dl.bintray.com/novik65/generic/plugins-3.6.tar.gz
  158.  
  159. *Unzip ruTorrent & Plugins to /var/www & Change Permission
  160. --------------
  161. sudo tar xvf rutorrent-3.6.tar.gz -C /var/www
  162. sudo tar xvf plugins-3.6.tar.gz -C /var/www/rutorrent
  163. sudo chown www-data:www-data -R /var/www/rutorrent
  164.  
  165. *Configure ruTorrent
  166. --------------
  167. sudo nano /var/www/rutorrent/conf/config.php
  168.  
  169. $pathToExternals = array(
  170. "php"     => '/usr/bin/php',            // Something like /usr/bin/php. If empty, will be found in PATH.
  171. "curl"    => '/usr/bin/curl',            // Something like /usr/bin/curl. If empty, will be found in PATH.
  172. "gzip"    => '/usr/bin/gzip',            // Something like /usr/bin/gzip. If empty, will be found in PATH.
  173. "id"    => '/usr/bin/id',            // Something like /usr/bin/id. If empty, will be found in PATH.
  174. "stat"    => '/usr/bin/stat',            // Something like /usr/bin/stat. If empty, will be found in PATH.
  175. );
  176.  
  177. * Start rTorrent via Screen
  178. --------------
  179. screen -fa -d -m rtorrent
  180.  
  181. * Testing rTorrent
  182. --------------
  183. sudo netstat -npl | grep rtorrent
  184.  
  185. *Configure NginX for ruTorrent
  186. --------------
  187. nano /etc/nginx/sites-available/default
  188.    
  189. server {
  190.      
  191.     root /var/www;
  192.     index index.html index.php index.htm;
  193.      
  194.     server_name localhost;
  195.  
  196.     location / {
  197.         autoindex on;
  198.         try_files $uri $uri/ /index.html;
  199.     }
  200.      
  201.     location /var/www/download {
  202.         autoindex on;
  203.     }
  204.      
  205.     location /RPC2 {
  206.         include scgi_params;
  207.         scgi_pass 127.0.0.1:5000;
  208.     }
  209.      
  210.  
  211.     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  212.      
  213.     location ~ \.php$ {
  214.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  215.     #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  216.     #
  217.     #   # With php5-cgi alone:
  218.     #   fastcgi_pass 127.0.0.1:9000;
  219.     #   # With php5-fpm:
  220.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  221.         fastcgi_index index.php;
  222.         include fastcgi_params;
  223.     }
  224.  
  225.      
  226. }
  227.  
  228.  
  229. * Install Apache Utilities
  230. --------------
  231. sudo apt-get install apache2-utils
  232.  
  233. * Create User Name & Password for ruTorrent Directory Access
  234. --------------
  235. sudo htpasswd -c /var/www/rutorrent/.htpasswd root
  236.  
  237. * Add this in NginX Server Block
  238.    
  239. location /rutorrent {
  240.         auth_basic "Restricted";;
  241.         auth_basic_user_file /var/www/rutorrent/.htpasswd;
  242. }
  243.  
  244.  
  245. * Restart Nginx and PHP
  246. --------------
  247. sudo service nginx restart
  248. sudo service php5-fpm restart
  249.  
  250. * Complie and Install ffmpeg
  251.  
  252. sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
  253. mkdir ~/ffmpeg_sources
  254. cd ~/ffmpeg_sources
  255. wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
  256. tar xjvf ffmpeg-snapshot.tar.bz2
  257. cd ffmpeg
  258. ./configure
  259. make
  260. make install
  261. make distclean
  262. hash -r
  263.  
  264. ruTorrent can be accessed by browsing to http://ip_address/rutorrent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement