Installing MLDonkey

From PrimeatechWiki
Jump to: navigation, search

The MLDonkey in the repository is version 2.9.5 and, after installing it to the SheevaPlug, I had trouble getting the KAD to work. I thought about building from source but found that the QNAP NAS uses the same platform as the SheevaPlug and there are already precompiled cores in the forums here. I decided to give it a try and so I installed it and it has been running with no problems. It is version 3.0.0 and Donkey, KAD and Bittorrent work out of the box.

Installation

Download the precompiled core in the forum here.

There are four cores there and I am using the "normal" one (with gd not compiled).

MLDonkey should be run as an user, so create an user called "mldonkey" and its home dir:

root@debian:~# mkdir -p /home/mldonkey/.mldonkey
root@debian:~# adduser mldonkey

Extract "mldonkey-distrib-3.0.0.CVS" in the "normal" dir in the archive to the mldonkey dir and list its contents:

root@debian:/home/mldonkey/mldonkey-distrib-3.0.0.CVS# ls -l

You should find the core called "mlnet" and it should be made executable:

root@debian:/home/mldonkey/mldonkey-distrib-3.0.0.CVS# chmod +x mlnet

Copy mlnet to .mldonkey and go to .mldonkey to run it:

root@debian:/home/mldonkey/mldonkey-distrib-3.0.0.CVS# cp mlnet ../.mldonkey
root@debian:/home/mldonkey/mldonkey-distrib-3.0.0.CVS# cd ../.mldonkey
root@debian:/home/mldonkey/.mldonkey# ./mlnet

It will create loads of files in the dir. If it gets as far as "Core Started" then end it with Ctrl-C. Open up the new configuration file which should have been created called downloads.ini with a text editor. Find "Section: STARTUP" and look for "run_as_user" and make it equal mldonkey. Look down a bit for "run_as_useruid" and make it equal the UID of mldonkey. Also look for "run_as_group" and make it equal to users and make "run_as_groupgid" equal to 100. Use the id command to find the uid and gid of mldonkey:

# id mldonkey

Then change the owner and group of the /home/mldonkey and its files:

# chown -R mldonkey:users /home/mldonkey

Use an editor to open donkey.ini and bittorrent.ini to make a note of the ports used. If you are behind a router you will have to forward those ports to the plug.

Sancho Screenshot

Accessing MLDonkey

Run mlnet again in .mldonkey and access mldonkey from another machine by telnet <ip_of_plug> 4000 or by browser to http://<ip_of_plug>:4080

Alternatively, you can use a client gui called sancho to access MLDonkey. Configure sancho to connect to <ip_of_plug> port 4001.

Running MLDonkey in a Wrapper

MLDonkey is a badly-behaving program for an unixish environment in that sense that it expects to find it's configuration and state files from it's current work directory. In order to make MLDonkey run nicely in Linux we should start the core in a wrapper.

Move mlnet to /usr/bin:

root@debian:/home/mldonkey/.mldonkey# mv mlnet /usr/bin

Copy the wrapper that came with the Debian package here to /etc/init.d and make it executable and run at boot:

# chmod +x /etc/init.d/mldonkey-server
# update-rc.d mldonkey start 98 2 3 4 5 . stop 20 0 1 6 .

Adding Unicode Support

Note the lines:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

have been added to the wrapper script to enable unicode filenames.

Config File for Wrapper

The wrapper uses a config file at /etc/default/mldonkey-server, so create a file called mldonkey-server in /etc/default with the following lines:

MLDONKEY_DIR=/home/mldonkey/.mldonkey
MLDONKEY_USER=mldonkey
MLDONKEY_GROUP=users
MLDONKEY_UMASK=0022
LAUNCH_AT_STARTUP=true
MLDONKEY_NICENESS=0

You are now able to execute /etc/init.d/mldonkey {start|stop|restart|force-reload}.