====== Installing MLDonkey 3.2.1 ======
How to have MLDonkey running on a **Debian 12 Bookworm**.
===== Compiling the source code =====
The compilation procedure can be executed on a development machine, where you install all the required packages. Then you can copy only the **mlnet** binary into the production host.
Download the source code from the new **[[https://github.com/ygrek/mldonkey|GitHub repository]]** (the old [[http://mldonkey.sourceforge.net/|Sourceforge repository]] was abandoned in August 2023). We downloaded the tag **Release 3.2.1**.
mkdir -p /usr/local/src/mldonkey
cd /usr/local/src/mldonkey
wget https://github.com/ygrek/mldonkey/archive/refs/tags/release-3-2-1.zip
unzip mldonkey-release-3-2-1.zip
Some Debian packages are required to make the basic compile. We don't need the **GUI**, so we compile to have only the **Command Line Interface** (CLI) and the **web interface**; the package ''liblablgtk2-gnome-ocaml-dev'' referred by the build instructions is not required:
apt install ocaml camlp4 libnum-ocaml-dev
You may want to install some additional libraries to get more options working:
apt install libmagic-dev libgd-dev libbz2-dev
/usr/local/src/mldonkey/mldonkey-release-3-2-1
./configure
make
make install
The binary **mlnet** can be copied into another machine **(/usr/local/bin/** is the suggested directory). You can verify tha all the libraries are insalled using the command **ldd mlnet**.
===== Running as non-privileged user =====
mkdir /var/lib/mldonkey
addgroup --system mldonkey
adduser --system --home /var/lib/mldonkey --no-create-home \
--shell /usr/sbin/nologin --ingroup mldonkey mldonkey
chown -h mldonkey:mldonkey /var/lib/mldonkey
chown -R mldonkey:mldonkey /var/lib/mldonkey/
su --shell=/bin/bash - mldonkey
If the program is started by the root user, you can force a setuid to the non privileged user by settings into the **downloads.ini** the following option (in the example the 128 is the GID of the MLDonkey user):
run_as_useruid = 128
FIXME Need to create a **systemd unit** to start the program.
==== Logging ====
mkdir /var/log/mldonkey
chown -R mldonkey:mldonkey /var/log/mldonkey
FIXME Need to create the **/etc/logrotate.d/mldonkey-server** logrotate file.
===== Opening the firewall =====
===== Using the Command Line Interface =====
telnet localhost 4000
> auth admin MySecret
Full access enabled
===== Initializing the server list =====
As explaind into this [[https://www.emule-security.org/e107_plugins/faq/faq.php?0.cat.6.5|eMule FAQ]], you need a list of some servers to initialize your client to the p2p network.
The default URL used by MLDonkey to fetch the server list is **[[http://www.gruk.org/server.met.gz]]**, but it seems outdated now (October 2024). So we fetched the list from the URL provided by the FAQ: **[[http://upd.emule-security.org/server.met]]**.
FIXME: How to fetch from the URL or alternatively how to get the file and copy it into the MLDonkey home directory.
To view the servers listed by the emule-security.org site in an human-readable format, visit the URL **[[https://www.emule-security.org/serverlist/]]**; so you can view each IP address and port. You can manually add each server from the MLDonkey command line:
> n 45.82.80.155 5687
New server 45.82.80.155:5687
===== Initializing the Kademlia network =====
As explained by this [[https://www.emule-security.org/e107_plugins/faq/faq.php?0.cat.6.6|eMule FAQ]], a list of some other users already connected to the Kademlia network can be downloaded here: **[[http://upd.emule-security.org/nodes.dat]]**.
Copy the **nodes.dat** file into the MLDonkey home directory and execute the following MLDonkey command line:
> kad_load nodes.dat
285 overnet peers loaded
Then you can check if the connection succeeded:
> kad_stats
Kademlia is enabled
Kademlia Connectivity: NOT enough online peers ,there maybe a problem with incoming udp packets
It is possibile also to boot the Kademlia network with just one peer using the command:
> kad_boot
The Kademlia network **is not properly initialized** if you have zero peers:
> kad_boots
Boot peers: 0
===== The GeoIP database =====
===== Web References =====
* **[[https://www.emule-security.org/e107_plugins/faq/faq.php?0.cat.6.6|How to connect to Kademlia network?]]**
* **[[https://en.wikipedia.org/wiki/Kademlia|Kademlia (Wikipedia)]]**
* **[[https://medium.com/coinmonks/a-brief-overview-of-kademlia-and-its-use-in-various-decentralized-platforms-da08a7f72b8f|A Brief Overview of Kademlia]]**
* **[[https://mailfud.org/geoip-legacy/|Free updated GeoIP legacy databases]]**