Jan 25

MLDonkey – Open Source eDonkey Client – P2P- Debian – Ubuntu – Linux.

 

MLDonkey is an open source, multi-protocol, peer-to-peer file sharing application that runs as a back-end server application on many platforms. It can be controlled through a user interface provided by one of many separate front-ends, including a Web interface, telnet interface and over a dozen native client programs.

 

Install MLDonkey from repository (fast method).

sudo apt-get install mldonkey-server
sudo apt-get install -f

Now You can configure MLDonkey – jump to point 5.

 

Install MLDonkey from source.

 

1. Create user for MLDonkey.

MLDonkey home directory /opt/mldonkey.

sudo useradd -d /opt/mldonkey -m mldonkey

 

Check user UID.

sudo id -u mldonkey
e.g: 2003

 

2 Install Objective-Caml.

cd /opt
sudo wget --trust-server-names caml.inria.fr/distrib/ocaml-4.01/ocaml-4.01.0.tar.bz2
sudo tar xvf ocaml-4.01.0.tar.bz2
cd ocaml-4.01.0

 

sudo ./configure
sudo make world.opt
sudo make install

 

3. Install MLDonkey.

cd /opt/mldonkey
sudo wget --trust-server-names http://sourceforge.net/projects/mldonkey/files/mldonkey/3.1.5/mldonkey-3.1.5.tar.bz2/download -O /opt/mldonkey/mldonkey-3.1.5.tar.bz2
sudo tar xvf mldonkey-3.1.5.tar.bz2
sudo mv mldonkey-3.1.5 mldonkey
cd mldonkey

 

sudo ./configure
sudo make

sudo mv ./mlnet /usr/local/bin

Change files permission.

sudo chown -R mldonkey:mldonkey /opt/mldonkey

 

4. Create autostart init.d script for MLDonkey.

sudo nano /etc/default/mldonkey
# MLDonkey configuration file
# This file is loaded by /etc/init.d/mldonkey-server.
# This file is managed using ucf(1).

MLDONKEY_DIR=/opt/mldonkey/.mldonkey
MLDONKEY_USER=mldonkey
MLDONKEY_GROUP=mldonkey
MLDONKEY_UMASK=0022
LAUNCH_AT_STARTUP=true

 


sudo nano /etc/init.d/mldonkey
#!/bin/sh
#
# Original file :
#    Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#    Modified for Debian GNU/Linux
#    by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:  @(#)skeleton  1.9.1  08-Apr-2002  miquels@cistron.nl
#
#
# This file has been rewritten by Sylvain Le Gall <gildor@debian.org>
# and Samuel Mimram <smimram@debian.org> for the mldonkey package.
#
### BEGIN INIT INFO
# Provides:          mldonkey-server
# Required-Start:    $network $remote_fs
# Required-Stop:     $network $remote_fs
# Should-Start:      $local_fs
# Should-Stop:       $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Server for the mldonkey peer-to-peer downloader.
# Description:       Server for the mldonkey peer-to-peer downloader.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=mlnet
EXEC=/usr/local/bin/$NAME
DESC="MLDonkey"
CONFIG=/etc/default/mldonkey
PIDDIR=/opt/mldonkey/.mldonkey
PIDFILE=$PIDDIR/$NAME.pid
LOGFILE=/var/log/mldonkey/mldonkey.log
SERVERLOG=/var/log/mldonkey/mlnet.log

test -e $CONFIG || exit 0

set -e

Warn ()
{
    echo "$*" >&2
}

Error ()
{
    code=$1
    shift

    echo "."
    Warn "$DESC: $NAME [ERROR] $@"
    exit $code
}

StartErrorCheck ()
{
    if [ -f "$SERVERLOG" ] && tail -n 2 "$SERVERLOG" | grep -qi 'aborting' ; then
        Warn "$DESC: $NAME [ERROR] server start error"
        tail --verbose $SERVERLOG
        exit 1
    fi
}
. $CONFIG

# Look for the default locale
if [ -f "/etc/default/locale" ]; then
 . /etc/default/locale
 export LANG
fi

if [ -n "$MLDONKEY_UMASK" ]; then
 umask $MLDONKEY_UMASK
fi
# /var/run might be on tempfs, see #354701.
if [ ! -d /var/run/mldonkey ]; then
 mkdir -m 755 /var/run/mldonkey
fi
if [ ! -d /var/log/mldonkey ]; then
 mkdir -m 755 /var/log/mldonkey
fi
if [ -n "$MLDONKEY_USER" ] && [ -n "$MLDONKEY_GROUP" ]; then
 chown -R $MLDONKEY_USER:$MLDONKEY_GROUP /var/run/mldonkey
 chown -R $MLDONKEY_USER:$MLDONKEY_GROUP /var/log/mldonkey
fi

WRAPPER_OPTIONS="--iosched idle"

# Set configuration value, from CONFIG
if [ -n "$MLDONKEY_USER" ] && [ -n "$MLDONKEY_GROUP" ]; then
 WRAPPER_OPTIONS="$WRAPPER_OPTIONS --chuid $MLDONKEY_USER:$MLDONKEY_GROUP"
fi

if [ -n "$MLDONKEY_DIR" ]; then
 WRAPPER_OPTIONS="$WRAPPER_OPTIONS --chdir $MLDONKEY_DIR"
fi

if [ -n "$MLDONKEY_GROUP" ]; then
  WRAPPER_OPTIONS="$WRAPPER_OPTIONS --group $MLDONKEY_GROUP"
fi

if [ -n "$MLDONKEY_UMASK" ]; then
  WRAPPER_OPTIONS="$WRAPPER_OPTIONS --umask $MLDONKEY_UMASK"
fi

if [ -n "$MLDONKEY_NICENESS" ]; then
  WRAPPER_OPTIONS="$WRAPPER_OPTIONS --nicelevel $MLDONKEY_NICENESS"
fi

case "$1" in
  start|force-start)
    echo -n "Starting $DESC: $NAME"

    if [ "x$LAUNCH_AT_STARTUP" != "xtrue" ] && [ "x$1" = "xstart" ]; then
      Error 0 "configuration file prevent $NAME to be started (use force-start)."
    fi

    if [ -z "$MLDONKEY_DIR" ] || [ ! -d "$MLDONKEY_DIR" ]; then
      if [ -z "$MLDONKEY_DIR" ]; then
        MLDONKEY_DIR="(unset)"
      fi
      Error 1 "$MLDONKEY_DIR is not a valid directory."
    fi

    if [ ! -f "$MLDONKEY_DIR/downloads.ini" ]; then
      Error 1 "$MLDONKEY_DIR/downloads.ini is not a valid file."
    fi
 USER=`/usr/bin/stat --format="%U" "$MLDONKEY_DIR/downloads.ini"`
 WRAPPER_OPTIONS="$WRAPPER_OPTIONS --user $USER"

 start-stop-daemon --start $WRAPPER_OPTIONS \
 --pidfile $PIDFILE --background --exec $EXEC \
 -- -log_file $SERVERLOG -pid $PIDDIR 2>&1

 StartErrorCheck

 echo "."
 ;;

 stop)
 echo -n "Stopping $DESC: $NAME"
 start-stop-daemon --stop --oknodo --pidfile $PIDFILE --retry 30
 echo "."
 ;;

 force-reload|restart)
 $0 stop
 $0 start
 ;;

 *)
 Error 1 "Usage: $0 {start|stop|restart|force-reload|force-start}"
 ;;
esac

exit 0


Change permissions for new scripts.

sudo chmod +x /etc/init.d/mldonkey
sudo chmod +x /etc/default/mldonkey

 

Start MLDonkey.

sudo /etc/init.d/mldonkey start

 

5. Configure MLDonkey.

Log in to MLDonkey using telnet.
Change admin password using command below useradd admin PASSWORD.
Add your internal netowork e.g 192.168.0.0/24 to allow users from your network access to WebUI MLDonkey.

sudo telnet 127.0.0.1 4000

Connected to 127.0.0.1.
Escape character is ‘^]’.
Welcome to MLDonkey 3.1.5
Welcome on mldonkey command-line


useradd admin PASSWORD

Password of user admin changed


set allowed_ips "127.0.0.1 192.168.0.0/24"

option allowed_ips value changed


save

options and sources saved

exit

Connection closed by foreign host.

6. Configure Apache2 server as Proxy with SSL.

Create configfile /etc/apache2/sites-available/mldonkey and add the following records ect.

sudo nano /etc/apache2/sites-available/mldonkey
<VirtualHost *:443>
ServerName mldonkey.yourhost.com
SSLEngine On
SSLCertificateKeyFile ssl/apache.pem
SSLCertificateFile ssl/apache.pem
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / http://192.168.0.5:4080/
ProxyPassReverse / http://mldonkey_host/
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log common
</VirtualHost>

sudo ln -s /etc/apache2/sites-available/mldonkey /etc/apache2/sites-enabled/mldonkey
sudo /etc/init.d/apache2 restart

 

7. Configure firewall – Iptables.

 

Location of configfiles: /opt/mldonkey/./mldonkey.
To change the port, edit the files whose names are also the names of P2P newtorks e.g:

To change port for bittorrent network edit configfile:

sudo nano /opt/mldonkey/./mldonkey.bittorrent.ini
...
client_port = 6882
...

 

eDonkey2000 networkconfigfile: donkey.ini:

  • TCP port 4662 client to client exchange.
  • UDP port 4672 for clients, where to listen for source asking.
  • TCP port 4661 for servers, it is the default port to listen.
  • UDP port 4665 for servers, it is 4661 + 4, where to listen for source asking requests.
  • UDP port 65535 for server access (reference is found in preferences.ini in emule\config)

 

Overnet networkconfigfile: donkey.ini, section Overnet:

  • TCP port 4662 to connect to other clients.
  • The UDP port used for searching and publishing has no default.

 

KAD networkconfigfile: donkey.ini, section Kademlia:

  • TCP port 6419 to connect to other clients.
  • UDP port 6429 used to searching and publishing.

 

Gnutella networkconfigfile: gnutella.ini:

  • TCP port 634

 

Gnutella2 networkconfigfile: gnutella2.ini:

  • TCP port, no default
  • UDP port, the same number of TCP port

 

BitTorrent networkconfigfile: bittorrent.ini:

  • TCP port 6881

 

Fasttrack networkconfigfile: fasttrack.ini:

  • TCP port 1214 is where clients and supernodes listen.

 

OpenNap networkconfigfile: opennap.ini:

  • TCP port 6699 where the client receives PUTs from peers.
  • TCP port 8888 default port for servers.
  • TCP port 8875 for metaserver
  • TCP port 8889 where the ~OpenNap server listen for the stats

 

Direct Connect networkconfigfile: directconnect.ini:

  • TCP port 1412
  • UDP port same as TCP port.

 

Soulseek networkconfigfile: soulseek.ini:

  • TCP port 2234
  • TCP port 5534

 

...
#Donkey
-A INPUT -p TCP --dport 4662 -j ACCEPT
-A INPUT -p UDP --dport 4672 -j ACCEPT
-A INPUT -p TCP --dport 4661 -j ACCEPT
-A INPUT -p UDP --dport 4665 -j ACCEPT
-A INPUT -p TCP --dport 6827 -j ACCEPT
-A INPUT -p UDP --dport 6827 -j ACCEPT
#Overnet
-A INPUT -p TCP --dport 8740 -j ACCEPT
-A INPUT -p UDP --dport 8740 -j ACCEPT
#Kademlia
-A INPUT -p TCP --dport 6419 -j ACCEPT
-A INPUT -p UDP --dport 6429 -j ACCEPT
#Gnutella
-A INPUT -p TCP --dport 634 -j ACCEPT
#Bittorrent
-A INPUT -p TCP --dport 6881 -j ACCEPT
-A INPUT -p TCP --dport 6882 -j ACCEPT
-A INPUT -p UDP --dport 9511 -j ACCEPT
#Fasttrack
-A INPUT -p TCP --dport 1214 -j ACCEPT
#OpenNap
-A INPUT -p TCP --dport 6699 -j ACCEPT
-A INPUT -p TCP --dport 8888 -j ACCEPT
-A INPUT -p TCP --dport 8875 -j ACCEPT
-A INPUT -p TCP --dport 8889 -j ACCEPT
#Direct Connect
-A INPUT -p TCP --dport 1412 -j ACCEPT
-A INPUT -p UDP --dport 1412 -j ACCEPT
-A INPUT -p TCP --dport 4444 -j ACCEPT
-A INPUT -p UDP --dport 4444 -j ACCEPT
#Soulseek
-A INPUT -p TCP --dport 2234 -j ACCEPT
-A INPUT -p TCP --dport 5534 -j ACCEPT
#UDP
-A INPUT -p UDP --dport 65535 -j ACCEPT
...

 

8. Sancho.

Windows client for Mldonkey.

Sancho: http://sancho-gui.sourceforge.net/

 

Source:

1 ping

  1. Free Webmaster Guide

    I ran into this page accidentally, surprisingly, this is a amazing blog :-). The site owner has carried out a superb job of putting it together, the info here is really insightful. You just secured yourself a guarenteed reader.

Leave a Reply

Your email address will not be published.