NSLU2-Linux
view · edit · print · history

This quick howto assumes you have Debian installed on your NSLU2 and no webserver installed (or lighttpd installed)

I followed a number of none specific howto's and I have collected the info here together with instructions specific to the NSLU2

This will work with apache or any other webdav capable server but lighttpd is the lightest simplest server I could find that preformed well with my setup.

Most of the command following need root access either use sudo su or prefix each command with sudo or login as root...

First we need to install lighttpd and some utils

apt-get install lighttpd lighttpd-mod-webdav apache2-utils

you'll need to enable mod auth

lighty-enable-mod auth

We also want to password protect our webdav folder

mkdir /var/www/webdav  
chown www-data:www-data /var/www/webdav
htpasswd -c /var/www/webdav/passwd.dav chris
chown root:www-data /var/www/webdav/passwd.dav
chmod 640 /var/www/webdav/passwd.dav

The next task is to edit the lighttpd config near the top ensure mod_alias and mod_webdav are both uncommented

Then at the bottom of the config add this
NB both my client and server have the address of the alias "store" specified in their hosts file you can use a static ip address here...

$HTTP["host"] == "store" {
  server.document-root = "/var/www/"
  alias.url= ("/webdav" => "/var/www/webdav")
  $HTTP["url"] =~ "^/webdav($|/)" {
    webdav.activate = "enable"
    webdav.is-readonly = "disable"
    webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"
    auth.backend = "htpasswd"
    auth.backend.htpasswd.userfile = "/var/www/webdav/passwd.dav"
    auth.require = ( "" => ( "method" => "basic",
                             "realm" => "webdav",
                             "require" => "valid-user" ) )
  }
}

at this point you can now restart the web server

/etc/init.d/lighttpd restart

make sure that you can access the default index page with a browser and also that the webdav url is password protected and entering user name and password allows you to browse the directory
Assuming the web server is up and working as expected we can move on to check that webdav is working correctly
In the webdav folder create a test file and add some simple content on your client machine install cadaver a (simple webdav client)

sudo apt-get install cadaver

Then test the webdav server

cadaver http://store/webdav

after logging in you should be able to use commands very similar to a shell to copy the test file

cp testfile.txt testfile2.txt
cat testfile2.txt
rm testfile*

Make sure everything is working faultlessly here before continuing


now we have webdav sorted its easy to get a calendar application client working. Here I'm using the lightning add on for thunderbird.
First we'll make an empty calendar file (cal.ics) with this content

BEGIN:VCALENDAR
VERSION
 :2.0
PRODID
 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
END:VCALENDAR

file ownership needs changing

chown www-data:www-data /var/www/webdav/cal.ics

Now fire up thunderbird (or whatever calendar app you're using)
create a new calendar and select "on network" when it asks if it should be a local or network calendar
the next dialog will ask you what type - select icalendar (ICS)
and enter a url something like this...

http://chris:xxxxxxxx@store/webdav/cal.ics

where xxxx is the password and store is your NSLU2's web address

You should now be able to add new events to your calendar (and also delete them!)

There's a bunch of other stuff that's probably a good idea to implement like SSL etc but this breaks the back of the job and gets things working

view · edit · print · history · Last edited by Chris_C.
Originally by Chris_C.
Page last modified on May 06, 2009, at 02:45 AM