Installation on NAS and embedded

From MLDonkey
Jump to: navigation, search

Contents

Installation

This guide has been copied from buffalo Nas Central Forum, it is intended for linkstation's boxes but these tips are mainly related to the installed OS: Openlink, Debian, Gentoo or derived. A bunch of suggestions are a bit outdated.Lots of this suggestions could be applied to other type of NASes.

Few NAS distributions have added automated package management similar to Debian's apt-get, they are named IPKG, or QPKG. It is a good idea to search into hardware's specific forums in order to verify this chance.


Using pre-compiled binaries (release tarball)

ARM9

MLdonkey is reported to run well and stable on ARM9 boxes. Only emule sui feature has to be disabled cause mldonkey's implementation needs a real FPU which is not present in SoftARM Linkstations.

Pre-compiled mldonkey cores for ARM architectures are avaiable for download:

http://mldonkey.sourceforge.net/forums/viewtopic.php?t=4825 Cores are compiled on Debian Linux, unpack and use the core.. it has been reported to work well out-of-the-box on most NAS boxes.. Sometimes problem arises.

There are possible issues about DNS resolutions or library version problems (Linkstations have modified version of libc which could cause incompatibility). In order to solve these issues the cores are bundled with the exact shared libraries (zipped in archive) and libc version used to compile the cores. There are upcoming ARM's EABI cores which should solve these issues, so let's be updated and look at Alternative Hardware's forums for news. There are yet dirty solutions...

FIRST SOLUTION(easy)

The Library problem (if arises) has an easy solution, let's put the bundled libraries in a proper directory ("/new_libs_path" in this example) and call mlnet thru next script. For example Georg wrote following three liner scripts:


LD_LIBRARY_PATH=/new_libs_path:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
/path_to_mldonkey/mlnet.static


This starts the static linked mlnet after setting the LD_LIBRARY_PATH environment variable as needed. And the variable is only set for the call of mlnet (the new added libraries are picked first to look for standard ones), thus the remainer of the installation is not affected.It is higly suggested to use a user to only run mldonkey. DNS issue seems to be solved and mldonkey works as it should. You can also try running mlnet by commandline:


$ LD_LIBRARY_PATH=/new_libs_path:$LD_LIBRARY_PATH ./mldonkey_path/mlnet (arguments?)


SECOND SOLUTION (CHROOT MLNET)

A more complex solution is to "chroot" mldonkey.This is also a feature suggested to raise system security but this is quite difficult to set. Togeis has wrote a splendid walkthru:

This is a little howto running mldonkey on a opend Stock firmware. I am using 1.11-1.a. All steps are done as root user.

1) Make a new mldonkey User: If /mnt/disk1/home doesn't exist, make it:

mkdir /mnt/disk1/home

Adding user:

useradd -d /mnt/disk1/home/mldonkey -m mldonkey

I used a homedir an disk1 to prevent filling up /

2) Getting UID of created user:

grep mldonkey /etc/passwd|cut -d ":" -f3 1000

Now you have the UID you can use for starting mldonkey

3) Setting up chroot: - Make /dev/null and /dev/random

mkdir /mnt/disk1/home/mldonkey/dev
mknod /mnt/disk1/home/mldonkey/dev/null c 1 3
mknod /mnt/disk1/home/mldonkey/dev/urandom c 1 9

- Copy Libs: Use the libraries tarfile from fabtar

cp libraries.tar.bz2 /mnt/disk1/home/mldonkey
cd /mnt/disk1/home/mldonkey
tar -jxvf libraries.tar.bz2

- Make ./etc

mkdir /mnt/disk1/home/mldonkey/etc
cp /etc/group /etc/hosts/ /etc/nsswitch.conf /etc/passwd /etc/resolv.conf /mnt/disk1/home/mldonkey/etc


4) Copy MLDonkey: Started mldonkey before: - You have to copy the existing directory form the old mldonkey directory to the new home directory /mnt/disk1/home/mldonkey - Edit your downloads.ini for the new root:

incoming_directory = incoming
temp_directory = temp
shared_directories = [
shared1;   
shared2;
shared3]
run_as_user = ""

Starting with a fresh install: I use the static build with gd support from fabtars tarfile.

cp mldonkey-2.9.0.CVS.static.arm-Linux_glibc-2.3.6.tar.bz2 /mnt/disk1/home/mldonkey
cd /mnt/disk1/home/mldonkey; tar -xjvf mldonkey-2.9.0.CVS.static.arm-Linux_glibc-2.3.6.tar.bz2
mv ./mldonkey-distrib-2.9.0.CVS/* .
rm ./mldonkey-distrib-2.9.0.CVS


5) Setting up ownership

chown -R mldonkey:mldonkey /mnt/disk1/home/mldonkey
chown -R root:root /mnt/disk1/home/mldonkey/lib /mnt/disk1/home/mldonkey/etc /mnt/disk1/home/mldonkey/dev

mldonkey is the user created at step 1. The user has its own group named the same.

6) Staring mldonkey with chroot Be sure you are root:

id
getting --> uid=0(root) gid=0(root)

Setting enviroment:

export MLDONKEY_CHROOT=/home/mldonkey

Starting mldonkey:

cd /mnt/disk1/home/mldonkey
./mlnet -run_as_useruid 1000


1000 is the UID of the user mldonkey you get it in step 2

7) Starting mldonkey with nohup (detach mldonkey from the console)

- Install nohup if it doesn't exist: When you use a opend Stock firmware with wget installed, you don't have nohup, but you can install it by yourself. Get the file coreutils-6.7-r1.tbz2

cd /tmp
wget http://downloads.nas-central.org/LSPro_ARM9/Distributions/Genlink/Binaries/armv5tejl-softfloat-linux-gnueabi/coreutils-6.7-r1.tbz2
tar -C / -xjvf coreutils-6.7-r1.tbz2 ./usr/bin/nohup

- Starting mldonkey as root

cd ~mldonkdey
nohup ./mlnet -run_as_useruid 1000 &

Now you are able to close the terminal and mldonkey keeps on running. Output created by mldonkey is written to ./nohup

NOTES: Mindbender has pointed that overmentioned solutions are inelegant. You may consider to merge the tricks with a smarter way to launch mlnet, a more elegant way is for example this startup script: http://www.unet.univie.ac.at/~a0025690/scripts/mldonkey

Someone told me that they had problems because su was missing. in case that is true for the arm9-boxes as well then we can just remove that command and just use the built in mldonkey thing you used. if su is missing replace this line

su - $USER -c"/usr/local/bin/mlnet&"

with either

/usr/local/bin/mlnet -run_as_useruid 1000 &

if you start it automatically at bootup from /etc/init.d/rcS by adding

echo "exec_sh mldonkey" >> /etc/init.d/rcS

then you do not need to install nohup btw. In case you are a script-guru, I suggest to mix the mindbender script/suggestions with the tricks about Library problems.

PowerPC(PPC) and MIPSEL

Over mentioned methods could be also applied on these archiectures please test and report about on software forums.

PowerPC and MIPSEL Precompiled cores are aviable:

PPC: http://mldonkey.sourceforge.net/forums/viewtopic.php?t=4834 Mipsel: http://mldonkey.sourceforge.net/forums/viewtopic.php?t=4890

PPC cores are reported to work well on PPC based NAS ( Synology DS207, tested by ZeusII ), no positive feedback about Linkstation PPC users at the moment.

QNAP System - QPKG

QNAP Systems has added an integrated package management system into their NAS boxes. This is quite a simple way to add emule/edonkey p2p support to their products.

"Happy" QNAP users should first try to install the official mldonkey bounded into their package repository, it is very easy and works straightforward. Only power users - expert modder - linux experts who are looking for particular features should need to try binaries bundled in tarballs.

more details:

QNAP's site about Mldonkey

QNAP's site about QPKG

FreeLink

You may need to use the Unstable (Debian) branch:

  1. Get access to packages from the Debian unstable branch
  2. Then install mldonkey by
apt-get install mldonkey-server

PPC and MIPSel

apt-get

apt-get update                   # update APT-Repository
apt-get install mldonkey-server  # install MLDonkey

compile latest SVN

If you would like to have the latest SVN-Version (better speed etc.) then you should do the following steps. But be careful: Currently the latest SVN-Version is very unstable on the ARM-System. It'll freeze after a few minutes. There's a patch (svn.debian.org [1]) which should fix the problem but i didn't have success, it's still unstable.

cd /mnt/disk1/share/source/
apt-get install ssh cvs patch autoconf gcc g++ libc-dev make zlib1g-dev libbz2-dev libgd2-noxpm-dev
cvs -d:pserver:anonymous@cvs.sv.gnu.org:/sources/mldonkey co -P mldonkey
cd mldonkey
./configure
make 
cp ./mlnet /root/.mldonkey/


OpenLink

PowerPC

(outdated?) This project aims to offer the latest MLDonkey P2P client and additional utilities precompiled and packaged for the PPC LinkStation. This release is compiled without GUI support. See http://www.nongnu.org/mldonkey/ for more information. You may download the latest version from the downloads area.

ppc-mldonkey-2.5.30.16–1

  • mldonkey-2.5.30.16
  • ed2k_hash
  • make_torrent

A newer version of mldonkey, MLNet 2.8.1, compiled for a KuroBox Pro (PPC) is available at: http://cisler.net/kuro/mlnet/mlnet-2.8.1.tar.gz


MIPSel

(outdated?) Older binaries + packages are available here. But there was feedback that they did no work properly because of the missing libmagic. So you would have to install the development tools which should fix this dependancy.

  1. Precompiled C development environment, running on the LS
  2. Then
mkdir /mnt/hda/temp 
cd /mnt/hda/temp 
wget http://www.unet.univie.ac.at/~a0025690/mips-binaries/mldonkey_mips-2.7.6.tar.gz 
tar -xzvf mldonkey_mips-2.7.6.tar.gz 
./install.sh

Compile from Source

You can find the latest sources of mldonkey at the mldonkey project at sourceforge. First install the development tools.

  1. Precompiled C development environment, running on the LS
  2. Then mldonkey can be compiled by:
wget http://easynews.dl.sourceforge.net/sourceforge/mldonkey/mldonkey-2.8.4.tar.bz2
tar -xjf mldonkey-*.tar.bz2
cd mldonkey-* 
./configure --enable-batch --disable-gui
make
make install

mldonkey version 2.8.4 compiled onto the following way (By HomeBunny - April 2007):

cd /mnt/misc
wget http://dfn.dl.sourceforge.net/sourceforge/mldonkey/mldonkey-2.8.4.tar.bz2
bunzip2 mldonkey-2.8.4.tar.bz2
tar xvf mldonkey-2.8.4.tar
cd mldonkey-2.8.4
./configure --enable-batch --disable-guia
make
make install

WHEN YOU HAVE THIS PROBLEM: [[NOT ENOUGH FREE SPACE]] ONTO \root\.mldonkey
SOLUTION : Move your installation to \mnt\share

mkdir   /mnt/share/.mldonkey
cp -Rdp /root/.mldonkey /mnt/share/.mldonkey
rm -R   /root/.mldonkey
ln - s  /mnt/share/.mldonkey /root/.mldonkey

DON'T FORGET TO CHANGE THE Startscript:
INSTALLEDPATH=/mnt/share/.mldonkey

you will need a startscript (/etc/init.d/mldonkey) for mldonkey.

#! /bin/sh
export USER="root"
NAME=mldonkey
INSTALLEDPATH=/$USER/.mldonkey
start()
{
su - $USER -c"/usr/local/bin/mlnet&" 
}
stop()
{
su - $USER -c"kill -15 `cat $INSTALLEDPATH/mlnet.pid`"
su - $USER -c"sleep 5"
}
case "$1" in
    start)
        echo -n "Starting mldonkey: "
        start
        ;;
    stop)
        echo -n "Stopping mldonkey "
        stop
        ;;
    restart)
        echo -n "Restarting mldonkey "
        stop
        start
        ;;
    force)
   	 echo -n "Forcing start of mldonkey "   
    	 rm $INSTALLEDPATH/config_files_space.tmp
    	 rm $INSTALLEDPATH/mlnet.pid
   	 start
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {start|stop|restart|force}"
        exit 1
        ;;
esac
exit 0

you can download it directly from here here.

cd /etc/init.d
wget http://www.unet.univie.ac.at/~a0025690/scripts/mldonkey
chmod 755 mldonkey

Additional Info

mldonkey should be runnable now by executing

/etc/init.d/mldonkey start

I had to add .sh That is what I use:

/etc/init.d/mldonkey.sh start

if you want mldonkey to be started automatically at startup:

FreeLink

ln -s /etc/init.d/mldonkey /etc/rc2.d/S99mldonkey

OpenLink

ln -s /etc/init.d/mldonkey /etc/rc.d/rc2.d/S99mldonkey
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox