Monday, September 22, 2008

HowTo: Install and setup MLDonkey on FreeBSD

Update 18-07-2012:
Added details on debugging MLDonkey, namely /var/log/mldonkey.
Added explanation of telnet authentication.

MLDonkey is an open source, free software multi-network peer-to-peer application. Currently the following protocols are supported: eDonkey, Overnet, Bittorrent, Gnutella, Gnutella2, Fasttrack, FileTP and Kademlia.

I wanted to put my 266 Mhz Celeron to good use so I've decided to install MLDonkey without X11 support leaving only the core with both telnet and web interfaces.

Bellow are the steps needed to install MLDonkey on FreeBSD 7.0:
  1. % su
  2. # cd /usr/ports/net-p2p/mldonkey
  3. # make WITHOUT_GUI=yes WITHOUT_X11="YES" WITHOUT_TK="YES" install clean
  4. # rehash
Now that MLDonkey is installed let's activate it at boot time:
  1. # echo 'mlnet_enable="YES"' >> /etc/rc.conf
  2. # echo 'mlnet_user="p2p"' >> /etc/rc.conf
  3. # echo 'mlnet_logfile="/var/log/mldonkey"' >> /etc/rc.conf
  4. # touch /var/log/mldonkey
  5. # chown p2p:p2p /var/log/mldonkey
Notice the mlnet_user option, for added security we'll create a p2p user:
  1. # pw user add p2p
  2. # mkdir /home/p2p
  3. # chown p2p:p2p /home/p2p
Restart the system for the changes to apply.

Now we are going to modify the MLDonkey configuration:
  1. % su
  2. # /usr/local/etc/rc.d/mlnet status
  3. # exit
  4. % telnet 4000
  5. > auth admin ""
  6. > passwd newpassword
  7. > set allowed_ips ""
  8. > save
  9. > exit
Basically, we've checked to see if MLDonkey was running and accessed it through its telnet interface. Initially the application is configured without an admin password, so step 6 takes care of that. On step 7 we set the ips that are allowed to connect to the application, in the example the localhost and all clients in the local network.

In the future to authenticate through telnet:
  1. % telnet 4000
  2. > auth admin "mypasssword"
Replace mypassword with your own but keep it under "".

MLDonkey's web server can be accessed on http://localhost:4080, so fire-up your browser and point to the address. If your planning to access the server from another computer replace localhost bit by the server's ip or hostname.

The following are a few useful commands that can be passed on to MLDonkey:
  1. # /usr/local/etc/rc.d/mlnet start
  2. # /usr/local/etc/rc.d/mlnet stop
  3. # /usr/local/etc/rc.d/mlnet restart
  4. # /usr/local/etc/rc.d/mlnet status
If you come across any problems such as MLDonkey not starting check /var/log/mldonkey as this is file golden in debugging issues.

There are tons of configuration options available both in the telnet and web interfaces so I've opted to mention only the basic stuff. For more information I suggest browsing the project's website at


alexnanow said...

Great tuto!!! Thanks a lot man!!

tangram said...

Thanks Alex.

I'm glad you liked :D