Bonjour a toutes et à tous
Depuis plusieurs semaine, j'essai désespérément de monter un serveur dédié (Kimsufi 2G de chez OVH) en tant que seedbox et serveur Web.
Pour cela j'ai décidé d'utiliser une distribution Debian 6 avec Apache2 et Webmin pour ce qui est du serveur Web.
Ainsi que rTorrent et ruTorrent pour la seedbox.
Sans oublier le FTP et tout ce qui va avec.
Etant donné que à la fin de mon installation tout fonctionne sauf ruTorrent qui n'arrive pas à ce connecter à rTorrent et que je n'arrive pas à trouver le problème ...
Je vais vous détailler tout ce que je fais ici et peut être que vous pourrez m'aider :cheer:
PS : je vais éditer au fur et à mesure que je ré-installe 😛
Donc pour commencer, je me log en root avec SSH sans problème.
Puis j'update et upgrade mon système comme ceci :
apt-get update
apt-get upgrade
J'installe les paquets suivants :
apt-get install apache2 apache2.2-common apache2-utils autoconf automake autotools-dev binutils build-essential bzip2 ca-certificates comerr-dev cpp cpp-4.1 dpkg-dev file g++ gawk gcc gcc-4.1 libapache2-mod-php5 libapache2-mod-scgi libapr1 libaprutil1 libc6-dev libcppunit-dev libcurl3 libcurl4-openssl-dev libexpat1 libidn11 libidn11-dev libkrb5-dev libmagic1 libncurses5 libncurses5-dev libpcre3 libpq5 libsigc++-2.0-dev libsqlite0 libsqlite3-0 libssl-dev libssp0-dev libsvn1 libtool libxml2 linux-libc-dev lynx m4 make mime-support ntp ntpdate openssl patch perl perl-modules php5 php5-cgi php5-cli php5-common php5-curl php5-dev php5-geoip php5-sqlite php5-xmlrpc pkg-config python-scgi screen sqlite ssl-cert subversion ucf unrar-free zlib1g-dev pkg-config unzip htop screen irssi libwww-perl curl sudo
Je créer un nouvel utilisateur que je nommerai
downloader avec le mot de passe 123456 (pour l'exemple)
adduser downloader
J'éleve les droits de l'utilisateur downloader
visudo
et je rajoute cela apres la ligne "root ALL=(ALL) ALL"
downloader ALL=(ALL) ALL
Maintenant je bloque l'utilisateur root et change le port SSHvi /etc/ssh/sshd_config
je modifie cela dans le fichier
Port 21212
Protocol 2
PermitRootLogin no
X11Forwarding no
Et j'ajoute cela a la fin du fichier
UseDNS no
AllowUsers downloader
Je redémarre SSH
/etc/init.d/ssh reload
Je me déconnecte de l'user root et me reconnecte avec downloader sur le bon port SSH.
exit
Maintenant je configure appache2sudo a2enmod ssl
sudo a2enmod auth_digest
sudo a2enmod scgi
Je redemarre apache
sudo /etc/init.d/apache2 restart
J'édite le fichier de configuration de appache
sudo vi /etc/apache2/apache2.conf
et je rajoute cela a la fin du fichier
SCGIMount /RPC2 127.0.0.1:5000
servername localhost
puis je redemarre le serveur
sudo reboot
Je me reconnecte en SSH avec l'utilisateur downloader et je configure Apache pour utiliser le HTTPS
sudo openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
sudo chmod 600 /etc/apache2/apache.pem
J'ajoute un protection par mot de passe
sudo htdigest -c /etc/apache2/passwords gods downloader
Modification du fichier apache
sudo vi /etc/apache2/sites-available/default
par (http://***.***.***.***/ étant l'ip de mon serveur)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
<Location /rutorrent>
AuthType Digest
AuthName "gods"
AuthDigestDomain /var/www/rutorrent/ http://***.***.***.***/rutorrent
AuthDigestProvider file
AuthUserFile /etc/apache2/passwords
Require valid-user
SetEnv R_ENV "/var/www/rutorrent"
</Location>
</VirtualHost>
un autre fichier a modifier
sudo vi /etc/apache2/sites-available/default-ssl
par (http://***.***.***.***/ étant l'ip de mon serveur)
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/apache.pem
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
<Location /rutorrent>
AuthType Digest
AuthName "gods"
AuthDigestDomain /var/www/rutorrent/ http://***.***.***.***/rutorrent
AuthDigestProvider file
AuthUserFile /etc/apache2/passwords
Require valid-user
SetEnv R_ENV "/var/www/rutorrent"
</Location>
</VirtualHost>
</IfModule>
Je permet a apache d'utiliser HTTPS
sudo a2ensite default-ssl
et je recharge apache
sudo /etc/init.d/apache2 reload
Installation de Webmin
J'ajoute le depot webmin a la liste des sources
sudo vi /etc/apt/sources.list
deb http://download.webmin.com/download/repository sarge contrib
Je recupere et ajoute la clé pgp de ce dépot
wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
J'installe Webmin
sudo apt-get update
sudo apt-get install webmin
Webmin fonctionne très bien a l'adresse
https://***.***.***.***:10000
Installation de rTorrent
je compile rtorrent en utilisant xmlrpc-c
cd ~/
sudo mkdir source
cd source
sudo svn co https://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/advanced/ xmlrpc-c
sudo wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.6.tar.gz
sudo wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.6.tar.gz
sudo tar -xvzf libtorrent-0.12.6.tar.gz
sudo tar -xvzf rtorrent-0.8.6.tar.gz
sudo rm *.tar.gz
Je configure et compile xmlrpc-c
cd xmlrpc-c
sudo ./configure --disable-cplusplus
sudo make
sudo make install
configuration et compilation de libtorrent
cd ../libtorrent-0.12.6
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
configuration et compilation de rotorrent
cd ../rtorrent-0.8.6
sudo ./autogen.sh
sudo ./configure --with-xmlrpc-c
sudo make
sudo make install
je recharge la config
sudo ldconfig
Je créer le fichier de configuration de rTorrent
sudo vi ~/.rtorrent.rc
Et je met cela dedans
# 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.
#
# Based on original .rtorrent.rc file from http://libtorrent.rakshasa.no/
# Modified by Lemonberry for rtGui http://rtgui.googlecode.com/
#
# This assumes the following directory structure:
#
# /Torrents/Downloading - temporaray location for torrents while downloading (see "directory")
# /Torrents/Complete - Torrents are moved here when complete (see "on_finished")
# /Torrents/TorrentFiles/Auto - The 'autoload' directory for rtorrent to use. Place a file
# in here, and rtorrent loads it #automatically. (see "schedule = watch_directory")
# /Torrents/Downloading/rtorrent.session - for storing rtorrent session information
#
# 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 = -1
max_peers_seed = -1
# Maximum number of simultanious uploads per torrent.
max_uploads = 50
# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 0
# Default directory to save the downloaded torrents.
directory = /home/downloads/downloader
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /home/downloads/downloader/.session
# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=/home/downloads/downloader/watch/*.torrent
schedule = untied_directory,5,5,stop_untied=
# Close torrents when diskspace is low. */
schedule = low_diskspace,5,60,close_low_diskspace=100M
# Stop torrents when reaching upload ratio in percent,
# when also reaching total upload in bytes, or when
# reaching final upload ratio in percent.
# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0
#schedule = ratio,60,60,stop_on_ratio=200,200M,2000
# When the torrent finishes, it executes "mv -n <base_path> ~/Download/"
# and then sets the destination directory to "~/Download/". (0.7.7+)
# on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/home/downloads/downloader/complete/ ;d.set_directory=/home/downloads/downloader/complete/"
# 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 = 55995-56000
# Start opening ports at a random position within the port range.
#port_random = yes
scgi_port = 127.0.0.1:5000
# 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 = no
# 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,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 = disable
# UDP port to use for DHT.
#
# dht_port = 6881
# Enable peer exchange (for torrents not marked private)
#
peer_exchange = no
#
# 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
# Max number of files to keep open simultaniously.
#max_open_files = 128
# Number of sockets to simultaneously keep open.
#max_open_sockets = <no default>
# Example of scheduling commands: Switch between two ip's every 5
# seconds.
#schedule = "ip_tick1,5,10,ip=torretta"
#schedule = "ip_tick2,10,10,ip=lampedusa"
# Remove a scheduled event.
#schedule_remove = "ip_tick1"
Je créer les répertoires de téléchargement de l'utilisateur downloader
sudo mkdir /home/downloads
sudo mkdir /home/downloads/downloader
sudo mkdir /home/downloads/downloader/watch
sudo mkdir /home/downloads/downloader/.session
sudo chown -R downloader:downloader downloader
Je vérifie que rTorrent demarre bien et que le fichier de config n'est pas beugué
sudo rtorrent
J'installe le script de démarrage de rtorrent
sudo vi /etc/init.d/rtorrent
dans lequel je met le script
#!/bin/sh
#############
###<Notes>###
#############
# This script depends on screen.
# For the stop function to work, you must set an
# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc.
# If you typically just start rtorrent with just "rtorrent" on the
# command line, all you need to change is the "user" option.
# Attach to the screen session as your user with
# "screen -dr rtorrent". Change "rtorrent" with srnname option.
# Licensed under the GPLv2 by lostnihilist: lostnihilist _at_ gmail _dot_ com
##############
###</Notes>###
##############
#######################
##Start Configuration##
#######################
# You can specify your configuration in a different file
# (so that it is saved with upgrades, saved in your home directory,
# or whateve reason you want to)
# by commenting out/deleting the configuration lines and placing them
# in a text file (say /home/user/.rtorrent.init.conf) exactly as you would
# have written them here (you can leave the comments if you desire
# and then uncommenting the following line correcting the path/filename
# for the one you used. note the space after the ".".
# . /etc/rtorrent.init.conf
#Do not put a space on either side of the equal signs e.g.
# user = user
# will not work
# system user to run as
user="downloader"
# the system group to run as, not implemented, see d_start for beginning implementation
# group=`id -ng "$user"`
# the full path to the filename where you store your rtorrent configuration
config="`su -c 'echo $HOME' $user`/.rtorrent.rc"
# set of options to run with
options=""
# default directory for screen, needs to be an absolute path
base="`su -c 'echo $HOME' $user`"
# name of screen session
srnname="rtorrent"
# file to log to (makes for easier debugging if something goes wrong)
logfile="/var/log/rtorrentInit.log"
#######################
###END CONFIGURATION###
#######################
PATH=/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin
DESC="rtorrent"
NAME=rtorrent
DAEMON=$NAME
SCRIPTNAME=/etc/init.d/$NAME
checkcnfg() {
exists=0
for i in `echo "$PATH" | tr ':' '\n'` ; do
if [ -f $i/$NAME ] ; then
exists=1
break
fi
done
if [ $exists -eq 0 ] ; then
echo "cannot find rtorrent binary in PATH $PATH" | tee -a "$logfile" >&2
exit 3
fi
if ! [ -r "${config}" ] ; then
echo "cannot find readable config ${config}. check that it is there and permissions are appropriate" | tee -a "$logfile" >&2
exit 3
fi
session=`getsession "$config"`
if ! [ -d "${session}" ] ; then
echo "cannot find readable session directory ${session} from config ${config}. check permissions" | tee -a "$logfile" >&2
exit 3
fi
}
d_start() {
[ -d "${base}" ] && cd "${base}"
stty stop undef && stty start undef
su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "screen -dm -S ${srnname} 2>&1 1>/dev/null" ${user} | tee -a "$logfile" >&2
# this works for the screen command, but starting rtorrent below adopts screen session gid
# even if it is not the screen session we started (e.g. running under an undesirable gid
#su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "sg \"$group\" -c \"screen -fn -dm -S ${srnname} 2>&1 1>/dev/null\"" ${user} | tee -a "$logfile" >&2
su -c "screen -S "${srnname}" -X screen rtorrent ${options} 2>&1 1>/dev/null" ${user} | tee -a "$logfile" >&2
}
d_stop() {
session=`getsession "$config"`
if ! [ -s ${session}/rtorrent.lock ] ; then
return
fi
pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"`
if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn't belong to another process
kill -s INT ${pid}
fi
}
getsession() {
session=`cat "$1" | grep "^[[:space:]]*session[[:space:]]*=" | sed "s/^[[:space:]]*session[[:space:]]*=[[:space:]]*//" `
echo $session
}
checkcnfg
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Je change le propriétaire du fichier et je le rend exécutable
sudo chown root:root /etc/init.d/rtorrent
sudo chmod a+x /etc/init.d/rtorrent
J'ajoute ce script au démarrage du serveur
cd /etc/init.d
sudo update-rc.d rtorrent defaults
A ce moment là le serveur me retourne : "
insserv: warning: script 'rtorrent' missing LSB tags and overrides" ...
Je test le script et je vérifie qu'il a bien démarré
sudo /etc/init.d/rtorrent start
sudo htop
Installation de ruTorrent
Je recupere la dernière version de ruTorrent
cd /var/www/
sudo svn checkout http://rutorrent.googlecode.com/svn/trunk/rutorrent/
cd rutorrent
sudo rm -R plugins
sudo svn checkout http://rutorrent.googlecode.com/svn/trunk/plugins/
Je spécifie l'emplacement de curl dans la config de ruTorrent (/usr/bin/curl)
whereis curl
sudo vi /var/www/rutorrent/conf/config.php
Je configure ruTorrent pour utiliser MKTorrent
cd /tmp
sudo wget http://downloads.sourceforge.net/mktorrent/mktorrent-1.0.tar.gz
sudo tar -xzvf mktorrent-1.0.tar.gz
cd mktorrent-1.0
sudo make USE_OPENSSL=1 USE_LONG_OPTIONS=1 USE_LARGE_FILES=1
sudo make install
Je supprime le fichier de config du plugin et je le recréer
sudo rm -R /var/www/rutorrent/plugins/create/conf.php
sudo vi /var/www/rutorrent/plugins/create/conf.php
dans lequel je met ceci
<?php
// configuration parameters
define('MAX_CONSOLE_SIZE',25,true);
$useExternal = "mktorrent";
$pathToCreatetorrent = '/usr/local/bin/mktorrent';
$pathToExternals["pgrep"] = ''; // Something like /usr/bin/pgrep. If empty, will be foun$
?>
Je met a jours les liens et les permissions
sudo ldconfig
sudo chown -R www-data:www-data /var/www/rutorrent
sudo chmod -R 777 /var/www/rutorrent
A ce stade là, j'ai bien accès a ruTorrent avec mes identifiant mais j'ai le droit a l'erreur suivante : "
La liste des torrents n'est pas encore disponible, la connexion à rTorrent n'a pas été établie."
Donc je ne sais pas quoi faire, je ne suis pas certain que de continuer l'installation du FTP changera quelque chose ... si quelqu'un à une idée