NSLU2

tech
top
Index
1 Introduction
2 Installation
3 DNS/DHCP server
4 Installation of Apache
5 An NFS server
6 Installing a mailserver
7 Alternatives
8 Sane remote scanner
9 problems
\"cover\"

Previous: 1. Introduction Index Next: 3. DNS/DHCP server

2. Installation

2.1. Installation of Debian

Installation should be relatively easy using http://www.nslu2-linux.org/wiki/Debian/HomePage. However, I found that the installation process is almost always broken. I have never succeeded installing an NSLU2 using that process. Maybe it's me, but the first time, the installer was broken, the second NSLU2 the installer ran out of memmory, and the third it did not recognise the disks.

What does work is http://www.cyrius.com/debian/nslu2/unpack the manual way of doing it. It has the advantage of being faster as well, although you need another Linux system with a webservers and a DHCP server. In my DHCP-server, I have the folowing lines:
option domain-name "home";
option domain-name-servers 192.168.1.101;
option routers 192.168.1.3;
option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.160 192.168.1.170;
  option domain-name-servers 192.168.1.101;
  default-lease-time 600;
  max-lease-time 7200;
}

The steps I did are below. Note that, in stead of sda, you might get a different driveletter, and instead of /mnt, you might want to mount somewhere else. Change accordingly if you want to reproduce.

First get the required images:

Prepare the USB-stick. First partition the stick:
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         120      963868+  83  Linux
/dev/sda2             121         311     1534207+   5  Extended
/dev/sda5             121         132       96358+  82  Linux swap
/dev/sda6             133         311     1437786   83  Linux

Sizes may vary; I found that 2GB for sda1 is the minimum and 1GB for the swap is quite sufficient. Make the filesystems and swapspace:
mkfs.ext3 /dev/sda1
mkfs.ext3 /dev/sda6
mkswap /dev/sda5

Mount sda1:
mount /dev/sda1 /mnt

and untar the base image you got from http://people.debian.org/~tbm/nslu2/etch/base.tar.bz2:
cd /mnt
tar -xjvf /your/path/base.tar.bz2

That takes a while, so this is time for coffee.

To make things easier afterward, I put my ssh-key public key in /root/.ssh/authorized_keys and gave it a fixed IP-address. See furtheron how to do that.

Put the ETCH-image in the root-html of your webserver and reflash the NSLU2. Some people like to use specific software or the web-interface. I'm more a commandline lover, so I use redboot. A word of warning: with redboot you are on the bare metal. No safegards. If you mess-up, you can throw away your slug.

When the slug boots it will briefly allow you to telnet into 192.168.0.1 (netmask 255.255.255.0) and interact with the monitor. This monitor is called Redboot. It also means that you must be able to communicate with 192.168.0.1. I had to set an ifconfig alias:
ifconfig eth0:0 192.168.0.55

To telnet into Redboot, execute:
while ! ping -W 1 -c 1 192.168.0.1 2>&1 >/dev/null; do true; done && telnet 192.168.0.1 9000

and start the slug. As soon as Redboot answers, hit control-C. Sometimes, you have less than a second to do it, so be ready. At the prompt, first verify that you can indeed see your webserver, load the image and flash it:
ping -n 1 -h 192.168.0.55
load -r -b 0x01000000 -h 192.168.0.55 -m http /sda1-2.6.18.dfsg.1-23
fis write -f 0x50060000 -b 0x01060000 -l 0x7a0000

Connect the USB-stick and type reset into redboot.

2.2. Initial configuration

After a while, the log of your DHCP-server will give you the IP-address of your slug. Ssh into it; user root, password root and immediately change the password. Even if you are just at home. Even if no-one can get to your network.

Regenerate the ssh-keys:
rm /etc/ssh/ssh_host*
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""

Add your users (using adduser), and add the appropriate lines in /etc/sudoers using visudo. Set the hostname in /etc/hostname and edit /etc/network/interfaces. Mine contains:
iface eth0 inet static
        address 192.168.1.102
        netmask 255.255.255.0
        gateway 192.168.1.3
        dns-search home
        dns-nameservers  192.168.1.101

I also changed mu hostname by vi-ing /etc/hostname. Make sure you can access the Internet from your slug (ping something). If name resolution isn't working: edit /etc/resolv.conf.

Install sudo
apt-get install sudo

Update your slug:
apt-get update
apt-get dist-upgrade

That also takes a while. If you had enough coffee, try some tea instead. Midway, you need to promise that you will reboot. So at the end, you reboot. Voila, your slug is ready.

Previous: 1. Introduction Index Next: 3. DNS/DHCP server