Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #http://pastebin.ubuntu.com/798506/
- clear
- if [ "$(id -u)" != "0" ]; then
- echo
- echo "This script must be run as root." 1>&2
- echo
- exit 1
- fi
- con=0
- while [ $con -eq 0 ]; do
- echo -n "Please type a valid system user: "
- read -e user
- uid=$(cat /etc/passwd | grep "$user": | cut -d: -f3)
- if [ -z $(cat /etc/passwd | grep "$user":) ]; then
- echo
- echo "This user does not exist!"
- elif [ $uid -lt 999 ]; then
- echo
- echo "That user's UID is too low!"
- elif [ $user == nobody ]; then
- echo
- echo "You cant use 'nobody' as user!"
- else
- con=1
- fi
- done
- homedir=$(cat /etc/passwd | grep "$user": | cut -d: -f6)
- apt-get install openssl subversion apache2 build-essential libsigc++-2.0-dev libcurl4-openssl-dev automake libtool libcppunit-dev libncurses5-dev libapache2-mod-scgi php5 php5-curl php5-cli libapache2-mod-php5 screen
- svn checkout http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable xmlrpc-c
- cd xmlrpc-c
- ./configure --disable-cplusplus
- make
- make install
- cd ..
- rm -rv xmlrpc-c
- wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.9.tar.gz
- tar -zxvf libtorrent-0.12.9.tar.gz
- cd libtorrent-0.12.9
- ./autogen.sh
- ./configure
- make
- make install
- cd ..
- rm -rv libtorrent-0.12.9*
- wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.9.tar.gz
- tar -zxvf rtorrent-0.8.9.tar.gz
- cd rtorrent-0.8.9
- ./autogen.sh
- ./configure --with-xmlrpc-c
- make
- make install
- ldconfig
- cd ..
- rm -rv rtorrent-0.8.9*
- if [ ! -d "$homedir"/.rtorrent-session ]; then
- mkdir "$homedir"/.rtorrent-session
- chown "$user"."$user" "$homedir"/.rtorrent-session
- else
- chown "$user"."$user" "$homedir"/.rtorrent-session
- fi
- if [ ! -d "$homedir"/Downloads ]; then
- mkdir "$homedir"/Downloads
- chown "$user"."$user" "$homedir"/Downloads
- else
- chown "$user"."$user" "$homedir"/Downloads
- fi
- echo "# 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.
- #min_peers = 40
- #max_peers = 100
- # Same as above but for seeding completed torrents (-1 = same as downloading)
- #min_peers_seed = 10
- #max_peers_seed = 50
- # Maximum number of simultanious uploads per torrent.
- #max_uploads = 15
- # Global upload and download rate in KiB. "0" for unlimited.
- #download_rate = 0
- #upload_rate = 0
- # Default directory to save the downloaded torrents.
- directory = ~/Downloads
- # Default session directory. Make sure you don't run multiple instance
- # of rtorrent using the same session directory. Perhaps using a
- # relative path?
- session = ~/.rtorrent-session
- # Watch a directory for new torrents, and stop those that have been
- # deleted.
- #schedule = watch_directory,5,5,load_start=./watch/*.torrent
- #schedule = untied_directory,5,5,stop_untied=
- # Close torrents when diskspace is low.
- schedule = low_diskspace,5,60,close_low_diskspace=100M
- # The ip address reported to the tracker.
- #ip = 127.0.0.1
- #ip = rakshasa.no
- # The ip address the listening socket and outgoing connections is
- # bound to.
- #bind = 127.0.0.1
- #bind = rakshasa.no
- # Port range to use for listening.
- port_range = 6790-6999
- # Start opening ports at a random position within the port range.
- #port_random = no
- # Check hash for finished torrents. Might be usefull until the bug is
- # fixed that causes lack of diskspace not to be properly reported.
- #check_hash = no
- # Set whetever the client should try to connect to UDP trackers.
- #use_udp_trackers = yes
- # Alternative calls to bind and ip that should handle dynamic ip's.
- #schedule = ip_tick,0,1800,ip=rakshasa
- #schedule = 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
- #
- encryption = allow_incoming,enable_retry,try_outgoing
- # 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 = auto
- # UDP port to use for DHT.
- #
- # dht_port = 6881
- # Enable peer exchange (for torrents not marked private)
- #
- # peer_exchange = yes
- #
- # Do not modify the following parameters unless you know what you're doing.
- #
- # Hash read-ahead controls how many MB to request the kernel to read
- # ahead. If the value is too low the disk may not be fully utilized,
- # while if too high the kernel might not be able to keep the read
- # pages in memory thus end up trashing.
- #hash_read_ahead = 10
- # Interval between attempts to check the hash, in milliseconds.
- #hash_interval = 100
- # Number of attempts to check the hash while using the mincore status,
- # before forcing. Overworked systems might need lower values to get a
- # decent hash checking rate.
- #hash_max_tries = 10
- scgi_port = 127.0.0.1:5000" > $homedir/.rtorrent.rc
- chown "$user"."$user" "$homedir"/.rtorrent.rc
- if [ -z "$(cat /etc/apache2/apache2.conf | grep 'SCGIMount /RPC2 127.0.0.1:5000')" ]; then
- echo "
- # rutorrent
- SCGIMount /RPC2 127.0.0.1:5000" >> /etc/apache2/apache2.conf
- fi
- if [ ! -h /etc/apache2/mods-enabled/scgi.load ]; then
- ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load
- fi
- wget http://rutorrent.googlecode.com/files/rutorrent-3.3.tar.gz
- tar -zxvf rutorrent-3.3.tar.gz
- if [ -d /var/www/rutorrent ]; then
- rm -r /var/www/rutorrent
- fi
- mv -f rutorrent /var/www/
- rm -v rutorrent-3.3.tar.gz
- wget http://rutorrent-tadd-labels.googlecode.com/files/lbll-suite_0.8.1.tar.gz
- wget http://rutorrent.googlecode.com/files/data-3.3.tar.gz
- wget http://rutorrent.googlecode.com/files/erasedata-3.3.tar.gz
- wget http://rutorrent.googlecode.com/files/ratio-3.3.tar.gz
- wget http://rutorrent.googlecode.com/files/seedingtime-3.3.tar.gz
- wget http://rutorrent.googlecode.com/files/tracklabels-3.3.tar.gz
- wget http://srious.biz/nfo.tar.gz
- tar -zxvf lbll-suite_0.8.1.tar.gz
- tar -zxvf data-3.3.tar.gz
- tar -zxvf erasedata-3.3.tar.gz
- tar -zxvf ratio-3.3.tar.gz
- tar -zxvf seedingtime-3.3.tar.gz
- tar -zxvf tracklabels-3.3.tar.gz
- tar -zxvf nfo.tar.gz
- mv lbll-suite data erasedata ratio seedingtime tracklabels nfo /var/www/rutorrent/plugins
- rm lbll-suite_0.8.1.tar.gz data-3.3.tar.gz erasedata-3.3.tar.gz ratio-3.3.tar.gz seedingtime-3.3.tar.gz tracklabels-3.3.tar.gz nfo.tar.gz
- chown -R www-data.www-data /var/www/rutorrent
- echo 'AuthUserFile /var/www/rutorrent/.htpasswd
- AuthName "Tits or GTFO"
- AuthType Basic
- Require Valid-User' > /var/www/rutorrent/.htaccess
- if [ ! -f /etc/apache2/sites-available/rutorrent.script.conf ]; then
- echo "<VirtualHost *:80>
- ServerName *
- ServerAlias *
- DocumentRoot /var/www/
- CustomLog /var/log/apache2/rutorrent.log vhost_combined
- ErrorLog /var/log/apache2/rutorrent_error.log
- <Directory /var/www/rutorrent/>
- Options Indexes FollowSymLinks MultiViews
- AllowOverride AuthConfig
- Order allow,deny
- allow from all
- </Directory>
- </VirtualHost>" > /etc/apache2/sites-available/rutorrent.script.conf
- a2ensite rutorrent.script.conf
- fi
- echo -n "Please type the username for the webinterface, system user not required: "
- read -e htauser
- while true; do
- htpasswd -c /var/www/rutorrent/.htpasswd "$htauser"
- if [ $? = 0 ]; then
- break
- fi
- done
- if [ -z "$(crontab -l | grep rtorrent)" ]; then
- cat <(crontab -l) <(echo "@reboot su $user -c 'screen -d -m -U -fa -S rtorrent rtorrent'") | crontab -
- fi
- service apache2 restart
- echo -e "\033[0;32;148mInstallation is complete..\033[39m"
- echo
- echo "Starting rtorrent.."
- su "$user" -c 'screen -d -m -U -fa -S rtorrent rtorrent'
- echo -e "\033[0;32;148m Done..\033[39m"
- echo
- echo -e "\033[1;34;148mYour downloads is put in the 'Downloads' folder, sessions data in '.rtorrent-session' and
- rtorrent's configuration file is '.rtorrent.rc', all in your home directory.\033[39m"
- echo
- echo -e "\033[1;34;148mIf you want to change configuration for rtorrent, such as download folder, port, etc.,
- you will need to edit the '.rtorrent.rc' file. E.g. 'nano $homedir/.rtorrent.rc'\033[39m"
- tput sgr0
- echo
- if [ -z "$(ip addr | grep eth0)" ]; then
- echo "Visit rutorrent at http://IP.ADDRESS/rutorrent"
- else
- ip=$(ip addr | grep eth0 | grep inet | awk '{print $2}' | cut -d/ -f1)
- echo "Visit rutorrent at http://$ip/rutorrent"
- fi
- echo
- echo -e "\033[0;32;148mA shout out to NT, the greatest Trac.... Eeeeh... Community in the world!\033[39m"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement