How to setup NFS-Kernel-Server on SlugOS/LE (former DebianSlug)
You'll need a working install of SlugOS/LE! This means you can ssh into your box, su to root and install packages via apt-get.
If you built your own SlugOS/LE image using the MasterMakefile, you'll end up with a lot of kernel-module-*.ipk files in ~/slug/debianslug/tmp/deploy/ipk/
(if you run slugoOS debianslug, just wget the from http://ipkg.nslu2-linux.org/feeds/debianslug/ )
Put the ipk-files on the Slug (sftp/samba/ftp). I assume you put them in /home/slug/modules. Be root:
cd /home/slug/modules dpkg --force-architecture -i kernel-module-nfsd* kernel-module-sunrpc* kernel-module-lockd* kernel-module-exportfs* depmod -a
This will install the required modules into /lib/modules/`uname -r` and rebuild the module dependencies:
Still beeing root:
apt-get update apt-get upgrade apt-get install nfs-kernel-server
Edit /etc/exports with your favourite text editor (vi/joe/whatever)
#/etc/exports # IMPORTANT: Make sure there's no blank between the network/host address and the "(" # # Example 1: Exporting /home/dbox/pictures to the entire local # network 192.168.1.0 / 255.255.255.0 for reading and writing /home/dbox/pictures 192.168.1.0/24(rw,no_root_squash,async) # Example 2: Exporting /home/dbox/record to host 192.168.1.3 for reading and writing /home/dbox/record 192.168.1.3(rw,no_root_squash,async) # Example 3: Exporting /home/dbox/mp3 to the entire internet read only # Don't worry! As long as you didn't set up port forwarding on your router from your # public (internet) ip to the slug , or the slug is set up to have a public ip or # it's on the DMZ, only the clients on the local network can access the slug # to be on the safe side, check if you can access ports 111 and 2049 on the slug from the internet # If you cannot, you're safe! /home/dbox/mp3 *(ro)
Start the nfs-server!
If you're running into problems, this might be handy:
lsmod Module Size Used by nfsd 186128 13 exportfs 2752 1 nfsd lockd 45812 2 nfsd sunrpc 104576 9 nfsd,lockd
and on the client
lsmod Module Size Used by nfs 219720 1 lockd 62216 1 nfs sunrpc 150332 3 nfs,lockd
My own installation was based on an older version of the DebianSlug instructions, and failed to install the module exportfs.ko. My solution was to bash my head against the internet, and with the help of some smart'uns, I found this to work.
My system reports the following from uname:
slug:/etc# uname -a Linux slug 2.6.16 #1 PREEMPT Thu Jun 8 23:38:13 PDT 2006 armv5tel GNU/Linux
And since I seemed to be lacking any exportfs-specific hooks for nfsd to latch to, I had to find a kernel-specific version of exportfs that matched. A bit of searching returned this link.
Too bad it's in .ipk format, and not a .deb that I could "apt-get". BUT I recalled seeing something about loading kernel modules manually, so I followed the directions (from the old, obsolete page I used to load up my NSLU2 with Linux) here, under "Manual Install".
Here's what I did:
1) Get the kernel module suitable for your kernel (as located mentioned in the previous message, being here
slug:~# wget http://ipkg.nslu2-linux.org/feeds/slugos-lag/cross/stable/kernel-module-exportfs_2.6.16-r6.6_ixp4xxle.ipk Connecting to ipkg-us-dyoung.nslu2-linux.org|184.108.40.206|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 4,510 (4.4K) [text/plain] 100%[====================================>] 4,510 --.--K/s
2) Unpack it into the kernel directories
slug:~# ar -x kernel-module-exportfs_2.6.16-r6.6_ixp4xxle.ipk slug:~# tar xvfz data.tar.gz -C / ./ ./lib/ ./lib/modules/ ./lib/modules/2.6.16/ ./lib/modules/2.6.16/kernel/ ./lib/modules/2.6.16/kernel/fs/ ./lib/modules/2.6.16/kernel/fs/exportfs/ ./lib/modules/2.6.16/kernel/fs/exportfs/exportfs.ko
3) Kick it in the butt to get it loaded
slug:~# depmod -a
4) Load up the nfs server
slug:~# /etc/init.d/nfs-kernel-server start Starting NFS kernel daemon: nfsd mountd.
5) Confirm it's running correctly
slug:~# cat /var/log/messages . . Dec 13 22:11:39 slug kernel: Installing knfsd (copyright (C) 1996 email@example.com). Dec 13 22:11:40 slug kernel: NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory Dec 13 22:11:40 slug kernel: NFSD: starting 90-second grace period
6) Make sure you have a share config'd in the /etc/exports file, and get to work!