|
#1
|
|||
|
|||
Ubuntu 14/16 Debian 8 Seedbox Guide and Script
Ubuntu 14/16 Debian 8 Seedbox Guide and Script
This guide will take you through the installation of everything you need to get your seedbox up and running. Incuded is an option to use a script, if you do not wish to manually go through the guide. It has been tested with clean installs of Ubuntu 14, and 16, and Debian 8 Now works with Ubuntu 16 Services that will be setup are 1. vsftpd - ftp server 2. libtorrent/rtorrent 3. rutorrent 4. Nginx 5. autodl-irssi I use nginx as a web server. It uses less system resources, and I find it easier to configure than apache2. I don't think the difference is huge, given that we will have at most a handful of users, accessing our server, but unless you really want to stick with Apache I would recommend nginx, it is what I am currently using on my live seedbox. It uses latest versions of all software at time of posting. As you go through the guide make sure you follow the instructions for your OS. When you have completed the guide, and everything is working, I suggest a reboot Tip: in Nano use Ctrl-\ to do a find and replace, and use Ctrl-k to delete a line I will pretty this up with formatting and colours when I get a chance. Contents 1. Installation with script 2. Secure access to your server 3. Prepare System 4. Installing FTP - VSFTPD 5. Install rtorrent 6. Install rutorrent 7. Install Webserver - Nginx (include section on https download) 8. Autodl-irssi 9. Start irssi and rtorrent on boot 10. Add new user 1. Installation Script (optional) I have writtena an installation script that automatically runs through sections 2-9. This is not a fork of seed box from scratch, it is a simple script that automates the commands used in this guide. It will install vsftps, rtorrent, rutorrent, autodl-irssi, and nginx, as well as all the configuration, so on completion of the script your seedbox will be ready for use. This script has been tested on Ubuntu 12, 13, 14, 15, 16, 17 and Debian 7, 8 It takes about 10 minutes to run. Run the script from root, or if you have a sudo user already set up you can run it from there. If for some reason it is interrupted you can run it again to completion. First download and run the setup script Code: wget --no-check-certificate https://raw.githubusercontent.com/ar...master/rtsetup sudo bash rtsetup and then to run the main script, needs to be run as root or using sudo Code: sudo rtinst For more information on this script as well as information on additional utility scripts installed please look at the readme file located on github rtinst/README.md at master * arakasi72/rtinst * GitHub For manual installation begin here 2. Secure access to your server 2.1 Log into your server Log into your server with a terminal client like Putty. Fill in the following details in Putty: host name: The IP address or the host name e.g. ksxxxxxx.kimsufi.ovh.com protocol: SSH (port 22) username: root password: use the password your vendor provided 2.2 Create an User account Root logins are a security risk, so we will want to create an user account rather than login as the root user every time. In this tutorial, always replace "<username>" with the actual name that you wish to use. e.g. if your user name will be "Yogi" then the command would be "useradd -m Yogi", without the quotes. Choose a password, when prompted. Install sudo Code: apt-get -y install sudo For all systems Code: adduser --gecos "" <username> groupadd sshuser adduser <username> sudo adduser <username> sshuser Save and exit 2.3 Secure SSH logins Code: nano /etc/ssh/sshd_config Change the following lines in the sshd_config file. You should choose a high port number in the 20000 - 65535 range. e.g. 21976 Code: Port 21976 PermitRootLogin no X11Forwarding no If the line 'PasswordAuthentication no' is there, comment it out Code: #PasswordAuthentication no Then add these lines at the end of the sshd_config file: Code: UseDNS no AllowGroups sudo sshuser Save and exit 2.4 Restart the SSH daemon Code: service ssh restart log in with your new user 3. Prepare System 3.1 Upgrade packages You should now be logged in with the user you created. Everything you need to do can be done with this user and the sudo command. For ALL versions First of all lets make sure all the existing services and programs on our system are up to date. Code: sudo apt-get update && sudo apt-get -y upgrade sudo apt-get clean && sudo apt-get autoclean 3.2 Install Dependencies Now we are going to install the packages we are going to need in order to make all our programs work, the following is all 1 line For all systems except Ubuntu16 Code: sudo apt-get -y install nano autoconf build-essential ca-certificates comerr-dev curl cfv dtach htop irssi libcloog-ppl-dev libcppunit-dev libcurl3 libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev libtool libxml2-dev ncurses-base ncurses-term ntp patch pkg-config php5-fpm php5 php5-cli php5-dev php5-curl php5-geoip php5-mcrypt php5-xmlrpc python-scgi screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo python-software-properties software-properties-common aptitude php5-json nginx-full apache2-utils git libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libjson-rpc-perl libarchive-zip-perl For Ubuntu16 and 17 Code: sudo apt-get -y install nano autoconf build-essential ca-certificates comerr-dev curl cfv dtach htop irssi libcloog-ppl-dev libcppunit-dev libcurl3 libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev libtool libxml2-dev ncurses-base ncurses-term ntp patch pkg-config php7.0-fpm php7.0 php7.0-cli php7.0-dev php7.0-curl php-geoip php7.0-mcrypt php7.0-xmlrpc python-scgi screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo python-software-properties software-properties-common aptitude php7.0-json nginx-full apache2-utils git libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libjson-rpc-perl libarchive-zip-perl 3.3 Raise file limits We will raise the file limits, to ensure we do not have issues, when dealing with torrents with lots of small files, like archives. Code: sudo sed -i '/# End of file/ i\* hard nofile 32768\n* soft nofile 32768\n' /etc/security/limits.conf 3.4 Generate certificate files We will now generate certificates which will be used by your ftp server and web server to make ssl connections, encrypting your traffic to and from the server. First we will make a copy of the standard config used to generate certificates, we can then edit the copy and keep the original clean. Code: sudo cp /etc/ssl/openssl.cnf /etc/ssl/ruweb.cnf Now open up the file we created using your preferred file editor Code: sudo nano /etc/ssl/ruweb.cnf and add the following to the end of the file, use your own IP addresses and/or domains. Use all applicable addresses and domains, for a second IP use IP.2 = ... and so on: [ v3_ca ] subjectAltName = @alt_names [ alt_names ] IP.1 = 123.123.123.123 DNS.1 = example.com save and exit. Now we can generate the certificates, replace the IP address with your own IP or domain name: Code: sudo openssl req -x509 -nodes -days 3650 -subj /CN=123.123.123.123 -config /etc/ssl/ruweb.cnf -newkey rsa:2048 -keyout /etc/ssl/private/ruweb.key -out /etc/ssl/ruweb.crt 4. Installing FTP - VSFTPD 4.1 Install vsftpd If you wish to chroot users which means restrict them to their home directory, for Ubuntu 12.04, and Debian 7.6 you will need to include a backport feature. This is only required if you wish to use chroot. Code: sudo apt-get -y install vsftpd 4.2 Configure vsftpd Code: sudo nano /etc/vsftpd.conf Make changes to the following lines. If they are commented out with a #, delete the # to uncomment, or add them if they are not there and then save & exit: Code: listen=yes listen_ipv6=NO anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 If you wish to restrict users to their home directory also uncomment/add Code: chroot_local_user=YES allow_writeable_chroot=YES To secure using TL/SSL uncomment/add/edit. listen_port=43421 is the port you will use to access, and you will need to specify this in your ftp client. You can change it to something else if you like. Code: rsa_cert_file=/etc/ssl/ruweb.crt rsa_private_key_file=/etc/ssl/private/ruweb.key ssl_enable=YES allow_anon_ssl=NO force_local_data_ssl=YES force_local_logins_ssl=YES ssl_sslv2=YES ssl_sslv3=YES ssl_tlsv1=YES require_ssl_reuse=NO listen_port=43421 ssl_ciphers=HIGH Save and exit 4.3 restart vsftpd Code: sudo service vsftpd restart 5 Install rtorrent & libtorrent 5.1 Get rtorrent packages Enter the following to get the libtorrent and rtorrent packages. Make sure these are the versions that you want, before you begin. These are the latest versions at time of writing. Code: cd ~ mkdir source cd source svn co https://svn.code.sf.net/p/xmlrpc-c/code/stable xmlrpc curl http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz | tar xz curl http://rtorrent.net/downloads/rtorrent-0.9.6.tar.gz | tar xz 5.2 Configure and make xmlrpc Code: cd xmlrpc ./configure --prefix=/usr --disable-cplusplus make sudo make install 5.3 Configure and make libtorrent Code: cd ../libtorrent-0.13.6 ./autogen.sh ./configure --prefix=/usr make -j2 sudo make install 5.4 Configure and make rtorrent Code: cd ../rtorrent-0.9.6 ./autogen.sh ./configure --prefix=/usr --with-xmlrpc-c make -j2 sudo make install sudo ldconfig 5.5 Set up directories Code: cd ~ && mkdir rtorrent && cd rtorrent mkdir .session download watch 5.6 Edit the rtorrent configuration file Code: nano ~/.rtorrent.rc Paste the following content into the .rtorrent.rc file. This should get you started, it is the .rtorrent.rc I use. The fine tuning of settings that one should use will depend on your set-up, and is not going to be addressed here. Code: # This is the rtorrent configuration file installed by rtinst script - https://github.com/arakasi72/rtinst# This file is installed to ~/.rtorrent.rc # Enable/modify the options as needed, uncomment the options you wish to enable. # This configuration will work well with most systems, but optimal settings are dependant on specific server setup ### Set Directories method.insert = cfg.basedir, private|const|string, (cat,"/home/<user name>/rtorrent/") method.insert = cfg.watch, private|const|string, (cat,(cfg.basedir),"watch/") #method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/") #method.insert = cfg.logfile, private|const|string, (cat,(c fg.logs),"rtorrent-",(system.time),".log") session.path.set = (cat,(cfg.basedir),".session") directory.default.set = (cat,(cfg.basedir),"download") schedule = watch_directory,5,5,((load.start,(cat,(cfg.watch), "*.torrent"))) ### BitTorrent # Global upload and download rate in KiB, `0` for unlimited throttle.global_down.max_rate.set = 0 throttle.global_up.max_rate.set = 0 # Maximum number of simultaneous downloads and uploads slots throttle.max_downloads.global.set = 150 throttle.max_uploads.global.set = 150 # Maximum and minimum number of peers to connect to per torrent while downloading throttle.min_peers.normal.set = 30 throttle.max_peers.normal.set = 150 # Same as above but for seeding completed torrents (seeds per torrent) throttle.min_peers.seed.set = -1 throttle.max_peers.seed.set = -1 ### Networking network.port_range.set = 51001-51250 network.port_random.set = yes dht.mode.set = disable protocol.pex.set = no trackers.use_udp.set = yes # network.scgi.open_port = localhost:5000 network.scgi.open_port = 127.0.0.1:5000 network.http.ssl_verify_peer.set = 0 protocol.encryption.set = allow_incoming,enable_retry,prefer_plaintext network.max_open_files.set = 4096 network.max_open_sockets.set = 1536 network.http.max_open.set = 48 network.send_buffer.size.set = 4M network.receive_buffer.size.set = 4M ### Memory Settings pieces.hash.on_completion.set = no pieces.preload.type.set = 1 pieces.memory.max.set = 3500M ### Logging: # Levels = critical error warn notice info debug # Groups = connection_* dht_* peer_* rpc_* storage_* thread_* tracker_* torrent_* #print = (cat,"Logging to ",(cfg.logfile)) #log.open_file = "log", (cfg.logfile) #log.add_output = "info", "log" #log.add_output = "tracker_debug", "log" ### The following line initialises rutorrent plugins without needing to open the web interface execute = {sh,-c,/usr/bin/php /var/www/rutorrent/php/initplugins.php <user name> &} #EOF Save and exit And insert your username into the file Code: perl -pi -e "s/<user name>/$LOGNAME/g" ~/.rtorrent.rc 5.7 Check that rtorrent starts properly Code: rtorrent After checking, close rtorrent with CTRL-Q If you get an error, note the error and fix the configuration. The most likely causes will be an invalid <username>, invalid path in .rtorrent.rc or a permissions issue 5.8 Start rtorrent with screen Code: screen -d -m -S rtorrent rtorrent 6. Install rutorrent 6.1 Install rutorrent Create the directory Code: sudo mkdir /var/www && cd /var/www It is important that you do not change the directory throughout this section (6 Install rutorrent), until instructed to by this guide Code: sudo git clone https://github.com/Novik/ruTorrent.git rutorrent 6.2 Configure rutorrent configuration files Code: sudo mkdir /var/www/rutorrent/conf/users/$LOGNAME sudo mkdir /var/www/rutorrent/conf/users/$LOGNAME/plugins sudo rm rutorrent/conf/config.php sudo nano rutorrent/conf/config.php Replace the contents of config.php with the following: Code: <?php // configuration parameters // for snoopy client @define('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0', true); @define('HTTP_TIME_OUT', 30, true); // in seconds @define('HTTP_USE_GZIP', true, true); $httpIP = null; // IP string. Or null for any. @define('RPC_TIME_OUT', 5, true); // in seconds @define('LOG_RPC_CALLS', false, true); @define('LOG_RPC_FAULTS', true, true); // for php @define('PHP_USE_GZIP', false, true); @define('PHP_GZIP_LEVEL', 2, true); $do_diagnostic = true; $log_file = '/tmp/rutorrent_errors.log'; // path to log file (comment or leave blank to disable logging) $saveUploadedTorrents = true; // Save uploaded torrents to profile/torrents directory or not $overwriteUploadedTorrents = false; // Overwrite existing uploaded torrents in profile/torrents directory or make unique name // $topDirectory = '/home'; // Upper available directory. Absolute path with trail slash. $forbidUserSettings = false; //$scgi_port = 5000; $scgi_host = "127.0.0.1"; // For web->rtorrent link through unix domain socket // (scgi_local in rtorrent conf file), change variables // above to something like this: // //$scgi_port = 0; //$scgi_host = "unix:///tmp/rtorrent.sock"; //$XMLRPCMountPoint = "/RPC2"; // DO NOT DELETE THIS LINE!!! DO NOT COMMENT THIS LINE!!! $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. ); $localhosts = array( // list of local interfaces "127.0.0.1", "localhost", ); $profilePath = '../share'; // Path to user profiles $profileMask = 0777; // Mask for files and directory creation in user profiles. // Both Webserver and rtorrent users must have read-write access to it. // For example, if Webserver and rtorrent users are in the same group then the value may be 0770. ?> Save and exit And now create the user specific config file Code: sudo nano /var/www/rutorrent/conf/users/$LOGNAME/config.php and replace contents with the following. Code: <?php $topDirectory = '/home/<user name>'; $scgi_port = 5000; $XMLRPCMountPoint = "/RPC2"; ?> Save and exit. and replace in your actual username Code: sudo perl -pi -e "s/<user name>/$LOGNAME/g" /var/www/rutorrent/conf/users/$LOGNAME/config.php 6.3 Configure rutorrent plugins Code: cd rutorrent sudo nano conf/plugins.ini Replace the contents of plugins.ini with the following: NOTE: You can go in and edit this if you wish to change the defaults I have set here. Code: ;; Plugins' permissions.;; If flag is not found in plugin section, corresponding flag from "default" section is used. ;; If flag is not found in "default" section, it is assumed to be "yes". ;; ;; For setting individual plugin permissions you must write something like that: ;; ;; [ratio] ;; enabled = yes ;; also may be "user-defined", in this case user can control plugin's state from UI ;; canChangeToolbar = yes ;; canChangeMenu = yes ;; canChangeOptions = no ;; canChangeTabs = yes ;; canChangeColumns = yes ;; canChangeStatusBar = yes ;; canChangeCategory = yes ;; canBeShutdowned = yes [default] enabled = user-defined canChangeToolbar = yes canChangeMenu = yes canChangeOptions = yes canChangeTabs = yes canChangeColumns = yes canChangeStatusBar = yes canChangeCategory = yes canBeShutdowned = yes ;; Default [autodl-irssi] enabled = user-defined [cookies] enabled = user-defined [cpuload] enabled = user-defined [create] enabled = user-defined [data] enabled = user-defined [diskspace] enabled = user-defined [edit] enabled = user-defined [extratio] enabled = user-defined [extsearch] enabled = user-defined [filedrop] enabled = user-defined [geoip] enabled = user-defined [lookat] enabled = user-defined [mediainfo] enabled = user-defined [ratio] enabled = user-defined [rss] enabled = user-defined [rssurlrewrite] enabled = user-defined [screenshots] enabled = no [show_peers_like_wtorrent] enabled = user-defined [throttle] enabled = user-defined [trafic] enabled = user-defined [unpack] enabled = user-defined ;; Enabled [_getdir] enabled = yes canBeShutdowned =no [_noty] enabled = yes canBeShutdowned =no [_task] enabled = yes canBeShutdowned =no [autotools] enabled = yes [datadir] enabled = yes [erasedata] enabled = yes [httprpc] enabled = yes canBeShutdowned = no [seedingtime] enabled = yes [source] enabled = yes [theme] enabled = yes [tracklabels] enabled = yes ;; Disabled [check_port] enabled = no [chunks] enabled = no [feeds] enabled = no [history] enabled = no [ipad] enabled = no [loginmgr] enabled = no [retrackers] enabled = no [rpc] enabled = no [rutracker_check] enabled = no [scheduler] enabled = no Save and exit 6.4 Transfer ownership of rutorrent files to webserver so that they are accessible Code: sudo chown -R www-data:www-data /var/www sudo chmod -R 755 /var/www/rutorrent Rutorrent is now installed but you cannot access it until we have set up a web server. 7. Setup nginx Webserver If you would prefer to use apache2 complete section 10 instead of this section. This author recommends using nginx as it is lighter on resource and easier to configure. 7.1 Configure your rutorrent login Choose a user name and password for your rutorrent login. Enter a password when prompted. Code: sudo htpasswd -c /etc/nginx/.htpasswd $LOGNAME sudo chown www-data:www-data /etc/nginx/.htpasswd sudo chmod 644 /etc/nginx/.htpasswd 7.2 Configure Nginx We will set some basic configurations. Code: sudo nano /etc/nginx/nginx.conf Make sure the following items are set to these values, uncomment or add them if needed Code: user www-data www-data; pid /var/run/nginx.pid; sendfile on; tcp_nopush on; tcp_nodelay on; server_tokens off; client_max_body_size 40m; access_log off; error_log /var/log/nginx/error.log crit; We also need to update the max file size we just set here to 40m in php to the same value. For Ubuntu16 and 17 Code: sudo sed -i "/upload_max_filesize/ c\upload_max_filesize = 40M" /etc/php/7.0/fpm/php.ini For all other systems Code: sudo sed -i "/upload_max_filesize/ c\upload_max_filesize = 40M" /etc/php5/fpm/php.ini and for Ubuntu 14 only php access settings (these can be changed on any system, but must be done on 14.10) If changing on Ubuntu16 or 17 the file is located at /etc/php/7.0/fpm/pool.d/www.conf Code: sudo nano /etc/php5/fpm/pool.d/www.conf and make sure the following variables are uncommented and set to: Code: listen.owner = www-data listen.group = www-data listen.mode = 0660 save and exit 7.3 Configure nginx Site File For all versions Code: sudo cp /usr/share/nginx/html/* /var/www For all versions Code: sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old sudo nano /etc/nginx/sites-available/default Replace contents of the site file with the following. Code: server { listen 80; root /var/www; index index.html index.php index.htm; error_page 403 = @DenieD; #Below enter IP address or block to allow, eg LAN and/or VPN blocks allow 10.0.0.0/8; allow 172.16.0.0/12; allow 192.168.0.0/16; deny all; location @DenieD { return 301 https://$host$request_uri; } location / { try_files $uri $uri/ =404; } location /rutorrent { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; include /etc/nginx/conf.d/php; include /etc/nginx/conf.d/cache; } #include /etc/nginx/sites-available/dload-loc; location ~ /\.ht { deny all; } } server { listen 443 ssl; root /var/www; index index.html index.php index.htm; client_max_body_size 40m; ssl_certificate /etc/ssl/ruweb.crt; ssl_certificate_key /etc/ssl/private/ruweb.key; ssl_session_timeout 5m; location / { try_files $uri $uri/ =404; } location /rutorrent { client_max_body_size 40m; auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; include /etc/nginx/conf.d/php; include /etc/nginx/conf.d/cache; } #include /etc/nginx/sites-available/dload-loc; location ~ /\.ht { deny all; } } save and exit Now we will create the files for php and caching, that are 'included' in the rutorrent location in the main site file. Code: sudo nano /etc/nginx/conf.d/php and replace the contents with the following NOTE: Ubuntu 16 and 17 find and uncomment the line ‘fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;’ and delete or comment out the line below it ‘fastcgi_pass unix:/var/run/php5-fpm.sock;’ Code: location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; } save and exit Code: sudo nano /etc/nginx/conf.d/cache and replace the contents with Code: location ~* \.(jpg|jpeg|gif|css|png|js|woff|ttf|svg|eot)$ { expires 365d; } 7.4 Restart nginx For Ubuntu16 and 17 Code: sudo service nginx restart && sudo service php7.0-fpm restart For all other systems Code: sudo service nginx restart && sudo service php5-fpm restart Make sure rtorrent is running and log into RuTorrent by going to http://<Server IP>/rutorrent. 7.6 HTTPS Download If you wish to access your home directory via the web to download files, follow this section. I recommend using ftp for downloads, but this is an alternative if for what ever reason ftp is a problem for you. I am using the same password file that we set up for rutorrent. We need to add the location for users home directory. Code: sudo nano /etc/nginx/sites-available/dload-loc and replace contents with the following Code: location ~ ^/download/(.+?)(/.*)?$ { alias /home/$1$2; charset UTF-8; set $user $1; if ($remote_user = '') { break; } if ($user != $remote_user) { return 403; } auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; index index.html index.htm; autoindex on; } save and exit. To enable download nano into the site file Code: sudo nano /etc/nginx/sites-available/default and uncomment the line Code: #include /etc/nginx/sites-available/dload-loc; and reload nginx Code: sudo service nginx reload (to disable do the same except comment out the line) Set permissions on directories so the web server can access them, the ~ in the command below is the current users home directory, and will also change permissions on all subdirectories. Code: find ~ -type d -print0 | xargs -0 chmod 755 You should now be able to access your home directory at https://<Server IP>/download/<user name> 8 Autodl-irssi Autodl-irssi is a powerful program that can be set up to automatically download torrents that match your description. It is more powerful than and recommended over RSS for trackers that have an IRC announce channel. 8.1 Install Autodl-irssi Code: mkdir -p ~/.irssi/scripts/autorun cd ~/.irssi/scripts curl -sL http://git.io/vlcND | grep -Po '(?<="browser_download_url": ")(.*-v[\d.]+.zip)' | xargs wget --quiet -O autodl-irssi.zip unzip -o autodl-irssi.zip rm autodl-irssi.zip cp autodl-irssi.pl autorun/ mkdir -p ~/.autodl touch ~/.autodl/autodl.cfg && touch ~/.autodl/autodl2.cfg 8.2 Install the rutorrent plugin for Autodl-irssi Code: cd /var/www/rutorrent/plugins sudo git clone https://github.com/autodl-community/...-rutorrent.git autodl-irssi sudo mkdir /var/www/rutorrent/conf/users/$LOGNAME/plugins/autodl-irssi sudo cp autodl-irssi/_conf.php /var/www/rutorrent/conf/users/$LOGNAME/plugins/autodl-irssi/conf.php 8.3 Transfer ownership of Autodl-irssi to the webserver Code: sudo chown -R www-data:www-data /var/www 8.4 Configure Autodl-irssi passwords. Edit the autodl-irssi conf.php file to add a port and password. Code: sudo nano /var/www/rutorrent/conf/users/$LOGNAME/plugins/autodl-irssi/conf.php Replace the content of conf.php file with the following You can change the port number and password to ones of your choice. Code: <?php $autodlPort = 38800; $autodlPassword = "fab7Rxtpp"; ?> Save and exit Edit the ~/.autodl/autodl2.cfg file Code: cd ~/.autodl nano autodl2.cfg Copy the following content into the autodl.cfg file Note that the GUI port and password must match the ones from the conf.php file Code: [options] gui-server-port = 38800 gui-server-password = fab7Rxtpp Save and exit 8.5 Start IRSSI If you want to use irssi for other things it is very customisable, but that is a whole separate subject. For now we will just start it Code: screen -d -m -S irssi irssi If rtorrent is not already running go ahead and start that to. Code: screen -d -m -S rtorrent rtorrent Now login to your rutorrent web interface and make sure it is working 9 Start irssi and rtorrent on boot We want to start these services automatically when the system boots. 9.1 Create script file Code: sudo nano /usr/local/bin/rtcheck and add the following Code: #!/bin/bash # rTorrent Auto Restart PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin FILE="$HOME/rtorrent/.session/rtorrent.lock" service_running(){ pgrep -fx -u $LOGNAME $1 > /dev/null } for arg do if ! ( service_running $arg ) then if [[ $arg = "rtorrent" && -a $FILE ]] then echo "Removing $FILE" rm -f $FILE fi echo "Starting $arg" screen -d -m -S $arg $arg else echo "$arg already running" fi done save and exit Make it executable Code: sudo chmod 755 /usr/local/bin/rtcheck 9.2 Add to crontab To open crontab type Code: crontab -e And add the following line at the end of the file Code: @reboot sleep 5; /usr/local/bin/rtcheck irssi rtorrent Save and exit Now both services will start on reboot. If they don't then it is probably due to start-up order of services. Change the line to Code: @reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent This should fix it, with a 10 second delay before running. If you just want to start rtorrent, you can remove the irssi argument like in the next example If you want to regularly check that rtorrent is running and start it if it is not, you could also add the line Code: */5 * * * * /usr/local/bin/rtcheck rtorrent This will check every 5 minutes. 10. Add New User This section will cover adding an additional user, and all the configuration. This does not cover using individual IP's for each user. This is something I can add if their is a demand for it. To make this easier we will set a variable for the new user name before we begin, which we can then user throughout this process. Code: newuser=<new username> 10.1 Add user Code: sudo adduser --gecos "" $newuser if you want to grant them ssh access then Code: sudo adduser $newuser sshuser 10.2 rtorrent First we will create the rtorrent directories Code: sudo mkdir /home/$newuser/rtorrent sudo mkdir /home/$newuser/rtorrent/downloads sudo mkdir /home/$newuser/rtorrent/.session sudo mkdir /home/$newuser/rtorrent/watch Now we need to set the .rtorrent.rc file. Use the same template as in section 5.6 of this guide. We need to configure unique ports for rtorrent, scgi. In this example we will use port 5001 for scgi and for the rtorrent port range, 51251-51500. You can use other ports just make sure they are unique to this user. Code: sudo nano /home/$newuser/.rtorrent.rc copy in the text from the template in section 5.6 and then find and change the following to our new ports. Code: port_range = 51251-51500 network.scgi.open_port = 127.0.0.1:5001 save and exit then replace <user name> in the file with our new user name. Code: sudo perl -pi -e "s/<user name>/$newuser/g" /home/$newuser/.rtorrent.rc 10.3 rutorrent First we will make the directory Code: sudo mkdir /var/www/rutorrent/conf/users/$newuser sudo mkdir /var/www/rutorrent/conf/users/$newuser/plugins and create the user confing file, where we will use the same scgi port as we did in the rtorrent config, and also use a unique RPC mount. In this example RPC3 Code: sudo nano /var/www/rutorrent/conf/users/$newuser/config.php And replace the content with the following, replacing <username> with the actual user's name Code: <?php $topDirectory = '/home/<username>'; $scgi_port = 5001; $XMLRPCMountPoint = "/RPC3"; ?> save and exit And add our user to the rutorrent password file Code: sudo htpasswd /etc/nginx/.htpasswd $newuser 10.4 autodl-irssi We will create the directories we need and download the autodl scripts Code: sudo mkdir /var/www/rutorrent/conf/users/$newuser/plugins/autodl-irssi sudo mkdir -p /home/$newuser/.irssi/scripts/autorun cd /home/$newuser/.irssi/scripts curl -sL http://git.io/vlcND | grep -Po '(?<="browser_download_url": ")(.*-v[\d.]+.zip)' | xargs wget --quiet -O autodl-irssi.zip sudo unzip -o autodl-irssi.zip sudo rm autodl-irssi.zip sudo cp autodl-irssi.pl autorun/ sudo mkdir -p /home/$newuser/.autodl sudo touch /home/$newuser/.autodl/autodl.cfg sudo touch /home/$newuser/.autodl/autodl2.cfg Now we will add the autodl config. We need to set a port and password, which are unique to this user. Code: sudo nano /home/$newuser/.autodl/autodl2.cfg and replace contents with the following, you can change the values. Code: [options] gui-server-port = 36755 gui-server-password = ct7HRww3 Save and exit now we need to use the same port and password in the rutorrent autodl config Code: sudo nano /var/www/rutorrent/conf/users/$newuser/plugins/autodl-irssi/conf.php and replace the contents with the following Code: <?php $autodlPort = 36755; $autodlPassword = "ct7HRww3"; ?> 10.5 Permissions Now we need to set ownership and permissions Code: sudo chown -R $newuser:$newuser /home/$newuser sudo chown -R www-data:www-data /var/www/rutorrent/conf/users/$newuser sudo chmod -R 755 /var/www/rutorrent/conf/users/$newuser 10.6 Schedule with crontab And finally add the cron jobs so rtorrent and irssi are started automatically Code: sudo crontab -u $newuser -e and add the lines Code: @reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent */10 * * * * /usr/local/bin/rtcheck irssi rtorrent Check everything is working and send all the relevant info to the new user. https://www.torrent-invites.com/foru...ide-and-script |
#2
|
|||
|
|||
awesome ... :)
you wouldn't have centos7 installation guide? would you?? i've tried libtorrent and other ones but non was active url link to proceed :( i'd like to install utorrent on a centos7 dedicated server if you could lead me to a guide or help in making one m8 |
The Following User Says Thank You to MasterMan For This Useful Post: | ||
BamBam0077 (9th March 2022)
|
#3
|
|||
|
|||
Hi
HAd a quick look and seems all pretty standard. Only one thing that is deprecated is in the the installation of autodl-irssi, autodl2.cfg is no longer referenced. It's simply autodl.cfg now. In some cases as well you may need to install irssi as well so on ubuntu/debian its depending if you are in root or not, (use sudo if not root) apt-get install irssi |
The Following User Says Thank You to TLO For This Useful Post: | ||
BamBam0077 (9th March 2022)
|
#4
|
|||
|
|||
tested and works very smoothly on ubuntu 18 too
thnx m8 for the info Last edited by MasterMan; 9th March 2022 at 05:35. Reason: tested afterwards |
The Following User Says Thank You to MasterMan For This Useful Post: | ||
BamBam0077 (9th March 2022)
|
#5
|
|||
|
|||
Quote:
|
#6
|
|||
|
|||
i'm getting this messgae;
Quote:
i've googled enough and nothing makes any sense! could it be ubuntu 18 or rutorrent or etc ..??? if you or anyone knows what to do, PLZ chip in :) Last edited by MasterMan; 11th March 2022 at 05:10. |
#7
|
|||
|
|||
Where are you seeing this error?
|
#8
|
|||
|
|||
it was on rutorrent client when was seeding torrent(s) but problem solved already m8 Bump: these links are dead with 404 message :( https://rakshasa.github.io/rtorrent/downloads/libtorrent-0.13.6.tar.gz and this one https://rakshasa.github.io/rtorrent/downloads/rtorrent-0.9.6.tar.gz any ideas where to get them instead?? thnx m8 |
|
|