Recently, I converted my desktop machine to a headless file server. I spent quite a bit of time choosing the perfect product for the job. I had a few choices:
- Windows XP – Unfortunately, I don’t have enough licenses and it’s not the ideal product for a file server anyway.
- Windows Home Server – Microsoft is kindly giving away 120-day evaluation copies of the Windows Home Server. I was ready to give it a go until I realised a couple of things. Firstly, the installation erases all existing programs and data on the hard drives. As the drives are already holding all my data, it’s a bit troublesome to have to back everything up to another media. The other point that put me off Windows Home Server was the fact that it is based on Windows Server 2003. When I ran the installation, it did not even have native support for my SATA controllers. I decided then that it was too much hassle.
- Amahi Linux Home Server – This open source project has received a lot of good reviews. Unfortunately, it requires a Fedora installation, which I can’t be bothered downloading. The Fedora ISO image includes a lot of packages, most of which I don’t use.
- Ubuntu Server – I like Ubuntu for its small base installation size. I also like the fact that it’s Linux based as this means less risk of infection for my precious files. Not to mention, it’s absolutely free.
So, the choice was made. It is going to run Ubuntu. After a bit of googling around, I discovered that there is not much difference between an Ubuntu server installation and an Ubuntu desktop installation. As I already have the Ubuntu desktop ISO image, I don’t feel like wasting bandwidth downloading another ISO image with an almost identical set of packages. Additionally, I think the server installation does not include an X server, which means no graphical user interface. I need a graphical user interface!
Armed with the Ubuntu desktop live cd, I deleted my Windows XP partition and whacked on Ubuntu. Everything installed nicely. However, the default install is not suitable for a headless file server. It is missing a few critical servers for headless operation.
Firstly, it needs an OpenSSH server for secure remote access. Fortunately, this is easily done:
sudo apt-get install openssh-server
Secondly, it needs a Samba service so that it can participate in Windows file sharing. This turned out to be more difficult than I first expected. The important thing is to get the Samba configuration file right. I’ll leave the details to another post but it’s fairly simple once you get the hang of it. The following instructions are incomplete and is meant only as a reference.
sudo apt-get install samba
# Shut down the Samba service
sudo /etc/init.d/samba stop
# Set a password for the Samba user
# Use the same username and password as your Ubuntu logon
sudo smbpasswd -a <username>
# Edit the Samba configuration file
cd /etc/samba
sudo mv smb.conf smb.conf.master
sudo testparm -s smb.conf.master > smb.conf
# Define the shares by editing smb.conf
# Start up the Samba service
sudo /etc/init.d/samba start
That should be enough for a basic headless file server operation. However, I also wanted a VNC server so that I can administer the machine remotely with the comfort of a graphical user interface. I cheated on this part. I enabled the remote desktop functionality in Ubuntu and set the machine to logon automatically on boot up. Then, I downloaded the free RealVNC viewer for Windows, which enables me to remote into my file server. It is not ideal security wise but it does the job.
In the process, I also came across GParted, a nifty utility for tweaking partitions:
sudo apt-get install gparted
For the final part, before you yank the keyboard and monitor, check the BIOS to make sure that it’s not set to halt on keyboard or VGA. This ensures that the machine can start up without a keyboard or monitor attached.