NAS Server (FTP, NFS, Samba, SSHFS), Media Stream Server, Print Server, Wake On LAN
IntroductionThis example shows how to setup a NAS Server (Network Attached Storage Server) and a few other Servers with the Plop Linux Live version. You can run it from CD/USB or from the Network. For a NAS Server is the Plop Linux Desktop better than the Live Version, but this example should show you that everything is possible with the Live Version. Add the NAS userRun "adduser nas". Mount the hard disk and test FTP accessExample: mounting a FAT partition with nas user rw access.
mount /dev/sda1 /home/nas -o uid=$(id -u nas) Example: mounting an Ext2/3/4 partition.
mount /dev/sda2 /home/nas You can test the write access when you run
ftp localhost Login as user nas. Create a directory with "mkdir nastest". Do a "ls" to list the files. To modify the FTP Server settings, edit the file /etc/proftpd.conf NFSEdit the file /etc/exports. Change /mnt to /home/nas. You can also set the some security here. For quick localhost test allow access from 127.0.0.1: /home/nas 192.168.0.* 10.0.0.* 127.0.0.1(rw) Reload the changes with exportfs -ra. You will see some info's. Stop NFS: killall -9 nfsd rpc.statd rpc.mountd portmap Restart NFS: startnfs Test mount (example your server has the IP 10.0.0.200): mount 10.0.0.200:/home/nas /mnt Do a "ls /mnt" to see the files. Do a "umount /mnt" to unmount. For NFS details see the NFS homepage. SambaAdd the Samba user with "smbpassword -a nas" Test mount: mount //localhost/nas /mnt -o username=nas Do a "ls /mnt" to see the files. Do a "umount /mnt" to unmount. Samba config file: /etc/samba/smb.conf SSHFSI suggest that you generate your own keys with "sshkeygen.sh". You have to do that only once. The keys will be restored (with "Restore all settings at bootup"). To enable the connection as root set a password with "passwd" Test mount: sshfs localhost:/ /mnt Do a "ls /mnt" to see the files. Do a "umount /mnt" to unmount. Allow other users to connect with SSH/SSHFS and other options see config file: /etc/ssh/sshd_config Media Stream Server - ushareTo use ushare you need the opt.sqfs. Start ushare (-x for Xbox support, -D for background start): ushare -x -c /home/nas -D Printer Server - cupsdTo use cupsd you need the opt.sqfs. To configure CUPS from the text mode use "lynx localhost:631". When you start Xfce or Fluxbox, then you can configure CUPS with a graphical browser. When you configured CUPS to allow access from your LAN, then you can login from the LAN with any browser and the URL http://SERVERIP:631 CUPS config files: /etc/opt/cups Wake on LANTo enable WOL (Wake on LAN) for eth0 run setwol. The script is: /media/ploplinux/bin/setwol To wake up the computer you need the MAC address. You get it with "ifconfig eth0". Its the HWaddr (ex. 00:2a:c9:d8:a3:a1). Wake up form another PC (I suggest to write that in a file to execute it easily): wol 00:2a:c9:d8:a3:a1 Restore all settings at bootupThis is not the smartest, but fastest way to store and restore the settings. When you want a cleaner solution then store only the related files. Stop NFS: killall -9 nfsd rpc.statd rpc.mountd portmap Unmount the hard disk: umount /home/nas Store the settings: tar cfz /nas.tar.gz /etc /home/nas Copy nas.tar.gz to the ploplinux/opt directory. Create the script ploplinux/bin/startnas #!/bin/sh echo Setup NAS Server tar xfz $PLOPLINUX_DIR/opt/nas.tar.gz -C / # mount the hard disk like described above mount /dev/sda1 /home/nas # restart nfs killall -9 nfsd rpc.statd rpc.mountd portmap exportfs -ra >& /dev/null startnfs # reload other daemon configs killall -HUP sshd killall -HUP proftpd killall -HUP smbd killall -HUP cupsd # start ushare ushare -x -c /home/nas -D # activate wol setwol Add at the end of ploplinux/bin/rc.local before "exit 0" the line "sh startnas". When you boot the Live Plop Linux, then your NAS Server is ready. Final wordsYou see, it's easy to setup a NAS Server with the Live version of Plop Linux. You can also add iptables rules to use it as router and firewall. Plop Linux is very powerful and you can do anything you want. When you want to remove the USB drive or CD, then use the copy2ram option as kernel parameter (the line with "append") in the syslinux/syslinux.cfg file. You should also read Plop Linux Desktop.
© 2024 by
Elmar Hanlhofer |