This is a HOWTO about configuring an HTPC server using Slackware 13 (my fav distro).
1. First step, install Slackware linux. AlienBOB wrote a nice HOWTO about installing it using an USB flash drive.
2. Create the 'torrent' group. It will be used later to distinguish between which users are allowed to use the torrent downloading feature.
groupadd -g 102 torrent
3. Install libsigc++ library, needed by libtorrent and rtorrent.
cd ~
wget http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.5.tar.gz
tar zxvf libsigc++-2.2.5.tar.gz
cd libsigc++-2.2.5
./configure
make
make install
4. Install XML-RPC library, needed by rtorrent and php (custom builded).
cd ~
svn co http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/advanced xmlrpc-c
OR
wget http://heanet.dl.sourceforge.net/project/xmlrpc-c/Xmlrpc-c%20Super%20Stable/1.06.38/xmlrpc-c-1.06.38.tgz
tar zxvf xmlrpc-c-1.06.38.tgz
cd xmlrpc-c-1.06.38
./configure --disable-wininet-client --disable-libwww-client --disable-abyss-server --disable-cgi-server --disable-abyss-threads --disable-cplusplus
make
make install clean
5. Install libtorrent library, needed by rtorrent.
cd ~
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.6.tar.gz
tar zxvf libtorrent-0.12.6.tar.gz
cd libtorrent-0.12.6
./configure --disable-ipv6
make
make install
6. Install rtorrent
cd ~
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.6.tar.gz
tar zxvf rtorrent-0.8.6.tar.gz
cd rtorrent-0.8.6
./configure --with-xmlrpc-c
make
make install
ln -s /usr/local/lib/libtorrent.so.11.0.6 /usr/lib/libtorrent.so.11
test if rtorrent starts by typing rtorrent (exit with ctrl-q).
7. Configure rtorrent
wget http://libtorrent.rakshasa.no/export/1155/trunk/rtorrent/doc/rtorrent.rc -O /etc/skel/.rtorrent.rc
mkdir /etc/skel/newtorrents
mcedit /etc/skel/.rtorrent.rc
Uncomment and change the following vars:
directory = /mnt/disk/filme
session = /home/torrent/session
schedule = watch_directory,5,5,load_start=/home/torrent/newtorrents/*.torrent
schedule = untied_directory,5,5,stop_untied=
schedule = low_diskspace,5,60,close_low_diskspace=100M
port_range = 6890-6999
port_random = no
use_udp_trackers = yes
encryption = allow_incoming,enable_retry,prefer_plaintext
dht = auto
peer_exchange = yes
Append the following lines:
scgi_port = localhost:5000
encoding_list = UTF-8
8. Configure pppoe (if you're not using pppoe you can skip this step)
Setup the connect params:
pppoe-setup
Test if it works:
pppoe-connect
Stop the connection:
pppoe-stop
Edit /etc/ppp/pppoe.conf and change:
DNSTYPE=SPECIFY
PEERDNS=no
DNS1=193.231.236.30
DNS2=193.231.236.25
If you wanna specify the interface based on MAC address, add the following code:
# set the interface based on MAC address
for i in 0 1 2 3 ; do
if [ "$(cat /sys/class/net/eth$i/address 2>/dev/null)" = "00:e0:4c:ff:ff:ff" ] ; then ETH="eth$i"; fi
done
We want pppoe to be connected automatically so edit /etc/rc.d/rc.inet1 and then search for the start() function and add the pppoe-start command. Also search for the stop() function and add the pppoe-stop command right at the beginning.
If you have a home lan network and you wanna make it inferior to the pppoe connection, edit /etc/rc.d/rc.inet1.conf and append the following code:
# make the LAN interface inferior to PPPOE interface
for i in 0 1 2 3 ; do
if [ "$(cat /sys/class/net/eth$i/address 2>/dev/null)" = "00:27:0e:ff:ff:ff" ] ; then
USE_DHCP[$i]="yes"
DHCP_KEEPGW[$i]="yes"
fi
done
Test the connection by using:
/etc/rc.d/rc.inet1 restart
9. Install PHP enabling the XML-RPC feature.
cd ~
wget http://museum.php.net/php5/php-5.2.8.tar.gz
tar zxvf php-5.2.8.tar.gz
cd php-5.2.8
./configure --enable-fastcgi --enable-force-cgi-redirect --enable-discard-path --disable-ipv6 --with-xmlrpc
make
make install
10. Install the mod_scgi module:
cd ~
wget http://python.ca/scgi/releases/scgi-1.14.tar.gz
tar zxvf scgi-1.14.tar.gz
cd scgi-1.14/apache2/
apxs -i -c mod_scgi.c
10. Install dtach:
cd ~
wget http://switch.dl.sourceforge.net/project/dtach/dtach/0.8/dtach-0.8.tar.gz
tar zxvf dtach-0.8.tar.gz
cd dtach-0.8
./configure
make
10. Configure apache to enable php, mysql, mod_scgi and phpmyadmin.
Edit /etc/httpd/httpd.conf and uncomment this line:
Include /etc/httpd/mod_php.conf
In the "IfModule dir_module" section add index.php.
In the "IfModule alias_module" section add:
Alias /rtorrent /var/www/htdocs/rtorrent
Alias /phpmyadmin /var/www/htdocs/phpmyadmin
Load the scgi module:
LoadModule scgi_module lib/httpd/modules/mod_scgi.so
Append the mounting command:
SCGIMount /RPC2 127.0.0.1:5000
Add directory options
Directory "/var/www/htdocs/rtorrent"
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/httpd/passwd
Require user admin
/Directory
Create admin user:
htpasswd -c /etc/httpd/passwd admin
Restart httpd:
/etc/rc.d/rc.httpd restart
mkdir /etc/skel/session
mkdir /etc/skel/public_html
cp /var/www/htdocs/index.html /etc/skel/public_html/
Install mysql server database:
mysql_install_db
chown -R mysql.mysql /var/lib/mysql
cd /usr
mysqld_safe &
mysql_secure_installation
killall mysqld
/etc/rc.d/rc.mysqld start
Add users:
mysql -p -e "CREATE DATABASE IF NOT EXISTS tvc; CREATE USER 'tvc'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON tvc.* TO 'tvc'@'localhost' WITH GRANT OPTION;"
11. Make rtorrent start/stop automatically
Edit /etc/rc.d/rc.M and append this code:
# Start rTorrent
if [ -x /etc/rc.d/rc.rtorrent ]; then
. /etc/rc.d/rc.rtorrent start
fi
Edit /etc/rc.d/rc.0 and add this code somewhere at the beginning:
# Stop rTorrent
if [ -x /etc/rc.d/rc.rtorrent ]; then
. /etc/rc.d/rc.rtorrent stop
fi
Tuesday, March 30, 2010
Subscribe to:
Posts (Atom)