lørdag den 15. november 2008

Debian on NSLU2 - part 3

Hey and welcome back to another little slug post:) We will look on the following topics:
  • Easy file "surfing" in terminal mode + startup control
  • Webserver with php 5
  • Samba server with user and password login.
I also encourage everybody to install debian on a USB-stick and then have a secondary harddisk in port 2 as a storage drive. That way your harddisk doesn't spinup occasionally.

Debian release
First there is a new Debian release called Lenny. Download it from here.
(Debian-installer rc1)

Its really simple to install! You just proceed like you normally would do(see part 1)-It does
takes 4 hours though.. so watch some Kongfu Panda while waiting! ;)

Note that the needed modules have been picked for you, so don't worry about that, also when it ask if you want it to install a webserver, fileserver etc. dont pick any of them! We will do that manually later.

After you've completed your installation, its time to to play:

First app
I strongly recommend installing Midnight Commander (mc). Its like using the old NC commander in MS DOS! :) (see screenshot)

#apt-get update
#apt-get install mc

"Midnight Commander (MC) is a GNU "Swiss army knife" for the Linux console and other terminal environments. This gives newbie a menu driven console experience which is much easier to learn than standard Unix commands. " Source.

It just make it easier to surf through your files and keeping your overview intact!

Second app
Though its not as important as mc, its still very handy! The app is called rcconf and let you configure the app startup list. Very nice considering the limited resources on our little friend.

#apt-get install rcconf

To launch:

Getting a quick Webserver with php5 up and running is quite simple. Unfortunatly I couldn't fine any information on using my favorite webserver, Cherokee with php5 on debian :( .. but its prolly not that hard... maybe one of the devs, could post a little comment on how to do guide described below.. ? :) Anyways.. I went on using lighthttp:

Do the following:
#apt-get install lighttpd
#apt-get install php5
#apt-get install php5-cgi

After the install, you go to


"mod_fastcgi", just under server.modules, like this:

server.modules = (

Before closing, add this to the end of the file:

fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php5-cgi",
"socket" => "/tmp/php.socket",

Almost done mate!

type: touch /var/www/info.php
type: nano /var/www/info.php
and enter this:

Save it and restart:
/etc/init.d/lighttpd restart

Now try to type in you slugs IP: http://slugip.com/info.php

Congratz! ;)
(Check out Part 4 if you want a MySQL server with PHP5 and phpmyadmin aswell.... oh yeah.. I bet you would ;)

Samba server
Now this is perhaps the most important section of this post! Because the reason why we bought the NSLU2 in the first place, was of course to easily share any files to the LAN, even though there was only one computer active.

After a fresh Debian install, its not quite ready to transfer files with windows.. thats why we need to play a little bit more:

#apt-get install samba
#apt-get install smbclient

For this example, our goal is to have a Secure Read-Write File Server with 3 user acounts.
This is how your smb.conf file needs too look like:

workgroup = typeinaworkgrouphere
netbios name = Typeinyourserversname
security = user

Comment = Home Directories
Valid users = %S
Read only = No
Browseable = No

comment = Data
path = /export
Force user = maryo
force group = users
read only = No
Now its time to add the users. Remember that Mary will be the owner off all the files in the public directory:

useradd -c "Jack Baumbach" -m -g users -p m0r3pa1n jackb
useradd -c "Mary Orville" -m -g users -p secret maryo
useradd -c "Amed Sehkah" -m -g users -p secret ameds

Then we just need to initialize the Microsoft Windows password database with the new

# smbpasswd -a jackb
New SMB password: m0r3pa1n
Retype new SMB password: m0r3pa1n
Added user jackb.

# smbpasswd -a maryo
New SMB password: secret
Reenter smb password: secret
Added user maryo.

# smbpasswd -a ameds
New SMB password: mysecret
Reenter smb password: mysecret
Added user ameds.

When you have done that, you need to add the export folder and give it the correct properties(doooh=)

#mkdir /export
#chown maryo.users /export
#chmod u=rwx,g=rwx,o-rwx /export

Now I think its time for a little restart:
#/etc/init.d/samba restart

Check if samba runs properly:
#smbclient -L localhost -U%
Domain=[PRIVATE] OS=[Unix] Server=[Samba 3.2.4]

Sharename Type Comment
--------- ---- -------
public Disk Data
IPC$ IPC IPC Service (Samba 3.2.4)

Domain=[PRIVATE] OS=[Unix] Server=[Samba 3.2.4]

Server Comment
--------- -------

Workgroup Master
--------- -------
Great, try to login:
#smbclient //mastersluggy/maryo -Umaryo%secret
Congratz! you now have a fully functional Samba Server. SOURCE.

You can also login from windows :) Against any odds, you have probs!;) go check this guide out.

Just the last little notes:
Here are some very useful links you should read:
Next time we will be looking on a MySQL server install and a little rTorrent app (or torrentflux perhaps.. :)

Thanks for reading and have fun with your powerful little toy ;)

7 kommentarer:

Viktor K. sagde ...

I think I posted this one a little to fast..

but I've just added a samba configuration and some typpos ;)

pilotgt sagde ...

where can I get a MC binary for the NSLU2?

Viktor K sagde ...

Hey pilotgt,
Thanks for your comment,

im not quite sure what you need the binaries for... uhm..

but have you tried google? :)


Anonym sagde ...

How to make sure with samba that files (for sharing) are stored only at the hard drive and not at the usb stick?

Viktor K. sagde ...

uhm.. have u installed the debian on ur stick or harddisk ?

Anonym sagde ...

I have installed debian on usb stick and then added a hard drive but I am not sure when I copy files that they are actually on the hard drive instead of the usb stick.

Probably I should move /home to the hard drive for this?

Johan sagde ...

A big help, config for lighthttp is much easier to handle than apache, especially for the slug. Worked right out of the box. Thank you so much for this walkthrough, great work.