Thursday, January 19, 2012

Installing mldonkey on FreeNAS 8.0 embedded

I have recently been able to successfully install mldonkey on my fresh amd64 FreeNAS 8.0.3 embedded (HP Proliant Microserver) setup. I think mldonkey is a piece of software that cannot be renounced, so I'm leaving here a tutorial showing the steps I followed through to have a correct working install.

Caveat: FreeNAS USB installs give really few space available on the / partition. Consider that installing software in it can fill up all the available space, possibly resulting in system crashes. Before following this tutorial, please take into account the real amount of free space available on your / partition, considering that ~10 MB of space will be used by mldonkey software (at the time this tutorial was written!)

  1. Log as root into the NAS, either through ssh or through the console. If you log in as a regular user, type su and enter root password.
  2. We have to install software into the / tree, so we have to make it first of all writeable:

    # mount -uw /
  3. FreeNAS is pointing by default to a repository which mldonkey is not available to download from. Luckily enough, we can find a working binary in an upper level of the repository tree. So, install it this way:

    # pkg_add -r ../net-p2p/mldonkey-core-3.0.6

    Please notice that you have to put the current available version in order to correctly downlaod it. If errors about not finding the package are shown, point your browser to the net-p2p folder in the repository and check which package is available.

    The download/install procedure will actually take a while, as installing on the USB stick is a slow process.
  4. Now log into the web interface and create a new user under Account > Users > Add User

    Username: mlnet
    Password: *****
    Home Directory: /mnt/SHARED-DISK/mlnet/

    Where SHARED-DISK is your storage mount point.
  5. I use my station as a server, so there are multiple users in it. To let all of them get access to the downloaded files, change permissions from a ssh/console shell accordingly:

    # chmod 760 /mnt/SHARED-DISK/mlnet/
  6. Now we have to configure the downloads.ini file. First of all, we have to let mldonkey create its configuration files. Log in (from either ssh or console) as mlnet, using the credentials created at step 4.
    Launch mldoney:

    # mlnet

    The program will setup and then hung, waiting for connections. Kill it with CTRL + C.

    Now cd into /mnt/SHARED-DISK/.mldonkey and edit the downloads.ini using vi, ee, or your favorite shell editor.

    Find the line:

    allowed_ips = ["127.0.0.1";]

    After the semicolon, add "your ip". Note that you can, for example, allow connections from a subnet in your LAN, specifying the correct subnet mask like "192.168.1.0/24"
  7. Now we want to tell FreeNAS to automatically launch mldonkey at startup. We will be using rc.local to this end:

    cd /conf/base/etc/
    vi rc.local (this will create the file if not already existing)

    At the end of the file (or at a suitable place according to your configuration) enter the line:

    su mlnet -c mlnet &

    This will launch mldonkey as mlnet user and continue the startup of the machine.
  8. When the machine is fully booted, access mldonkey url:

    http://YOUR-NAS-IP:4080

    Now, you can start using and configuring mldonkey according to your needs!

7 comments:

  1. hi!
    Sorry for my stupid question, but.. How do you install mldonkey into the / tree if the platform is an embedded version??

    In the Freenas official forum, I read that it has to download and unpackage the mldonkey-core into a "data" hard disk, in this way:

    # setenv PKG_TMPDIR /mnt/hd/mldonkey
    # pkg_add -r mldonkey-core -P /mnt/hd/mldonkey

    Can you guide me step by step in the procedure that you have followed?
    Thank you so much!

    Gabriele

    ReplyDelete
  2. Hi, thanks for your comment!

    Well, the steps are in the post! :)

    Basically, to install it *natively* on your embedded system you have to remount your / partition in write mode:
    # mount -uw /

    Then, you can directly install it through pkg_add, from FreeBSD repository:
    # pkg_add -r ../net-p2p/mldonkey-core-3.0.6

    although the relative path can change due to new versions being available. Therefore you should check on the link provided in the link in the post.

    I think what you are talking about refers to installing mldonkey into a jail, not natively, which is a completely different procedure...

    Let me know if this was helpful in any way to you! :)

    ReplyDelete
  3. GREAT!!!
    I've done it!
    Sorry for my previous question, I confused this Freenas version with the other version (Freenas .75 - NAS4Free) :P
    This procedure is completely different and very easy. I like Freenas 8 so much!!

    I have another question... Do you know how to install a printer server in Freenas 8?
    I really need it
    Thanks a lot

    ciao

    Gabriele

    ReplyDelete
  4. hi! I've another little question about mldonkey.

    A regular basis the sistem's console print the message: "Apr 8 14:22:00 freenas su: BAD SU operator to mlnet on tty
    Apr 8 14:25:03 freenas freenas[3114]: Popen()ing: mount|grep "/dev/ufs/HD320"
    Apr 8 14:30:02 freenas freenas[3136]: Popen()ing: mount|grep "/dev/ufs/HD320"
    Apr 8 14:33:01 freenas su: in prompt_echo_off(): tcgetattr(): Inappropriate ioctl for device
    "

    HD320 is my hard drive name.

    Do you know what it minds?
    thanks

    Gabriele

    p.s. Good easter!

    ReplyDelete
  5. Ciao Alessandro,

    Great post, thanks a lot

    for step 7, the exact path to rc.local is
    /conf/base/etc

    its works really well.

    regards,
    Olivier

    ReplyDelete
    Replies
    1. Hi,
      thanks for your contribution!

      I have updated my typo!

      Alessandro

      Delete
  6. Un grand merci pour ce tuto ,
    cela fonctionne a merveille!!
    thanx for the tutorial
    works great for me!!

    ReplyDelete