I've several computers at home, a non-ethernet printer, a router, some spare hard disks, I think it is a pretty common situation nowdays, but I didn't have a NAS, a print server or a Media Center HTPC. So this is an overview about what can do and how to configure a low-power Linux Server available 24h/24h.
Your home server could be an unused notebook or desktop, but I chose to buy a new fanless 10 Watt mini-itx system. Others important features are sata/esata support (or another high speed connection USB 3.0 or Thunderbolt) in the mainboard and Hard Disks and Wake-on-LAN support in the ethernet card to wake up the server on demand (It's pretty common nowdays).
I choose Ubuntu 12.04 alpha 2, because it has LTS (Long Time Support) and because I needed the recent netatalk 2.2 to backup a Macbook Air with Mac OS X 10.7 Lion.
If your computer has less than 2gb RAM or an old CPU I suggest the Lubuntu variant, It support the same softwares of Ubuntu but the plain desktop (lxde) is much more essential and responsive.
The OS can be ext4 or btrfs if you like the experiments, but for the data like photo, movies, music, I suggest NTFS. Sadly the Linux filesystems are boycotted by modern TVs and other embedded gadgets which only support FAT32 and NTFS (even if mostly of them are Linux based).
If don't care or you can't plug your data directly to a different USB port, forget it, and choose a Linux filesystem also the data. Another tecnique is streaming the data via protocols like DLNA/uPnP and xbmc.
Now let's analyze some cool server tasks you can do with a computer like that.
After the first setup probably this PC will never see a physical keyboard an monitor again, because the main aim is to control it remotely from other computers. So let's install SSH which is the most used way to control a server.
sudo apt-get install openssh-server
For the other pc you trust, you can also access to the Home Server without a password but only with an ssh key. Ubuntu enable by default also Avahi (Bonjour on osx), which simplify the discovery of the other hosts inside the LAN. So if you don't want to type the ip address and set it fixed in a DHCP server you can alwais type:
An alternative to the classic ssh which requires a public open port, is ajaxterm which is a terminal console over web HTTP.
Ubuntu by default provides a VNC server for a graphical access (vino-server). X isn't very needed for a classic server because you can also use Web GUIs for specific tasks, but if your server is quite powerful I recommend it.
Keep in mind it need an autologin user to be enabled after a system restart and by default it isn't a secure encrypted connection. To secure VNC over a ssh tunnel you can set to run vino-server only via a local port and forward the traffic to a public and secure port.
To lock the X session after the autologin you can run the command below after logging in.
You know, the apps sometime crash. In a desktop environment you see it and rerun the app, but in server?
A very simple way to ensure that an application will keep running is to wrap it an infinite loop
while true; do amule; done
Where "amule" is an app you want to keep alive.
If nobody is using the server it doesn't have to be active. Energy saving is an important topic because you can switch on the server remotely only when you need it.
To enable WoL on your ethernet card you have to type a couple of commands (Persistent way).
sudo apt-get install ethtool
sudo ethtool -s eth0 wol g
sudo ethtool eth0|grep Wake-on:
Last command should output "g" if Wake on LAN is enabled, then you need a software live gWakeOnLan or WakeOnlan (mac) to send the magic wake up packet.
Via the power managment GUI is possible to set the inactivity time before the system standby or you can force the status with:
This is a very risky setting because the suggestion is to stop the hd from spinning only for long time of inactivity. You can test the many hdparm options after reading "man hdparm" or some real world examples and then tune the config file.
spindown_time = 50
The current drive status is availaible via
sudo hdparm -C /dev/sda
It is the most common way to share files in LAN over Linux, Mac or Windows PCs. You can edit the configuration file manually to share the folders in a persistent way (VNC/X indipendent) or You can set up the folders via the active VNC user.
The default user management tool doesn't allow advanced user configuration, so to run "sudo users-admin" another package is required
sudo apt-get install gnome-system-tools
Unison is a smarter Rsync (see the comparison) because it recornize the files moved and it is available on Linux, Mac and Windows without much effort. If you like a more dropbox approch you can host a copy of Sparkleshare.
If you want to do a full backup of a Mac OS X system, you can easly set up the server to behave like a Time Capsule
sudo apt-get install netatalk
It's the network protocol used by Apple (I suggest netatalk >= 2.2.1 for compatibility with osx Lion 10.7), then you define the folder used as Time Machine disk.
/my-backup-dir/of-timemachine/ "Time Machine on Server" cnidscheme:dbd options:tm
sudo service netatalk restart
A Time Machine drive should be visible in the Time Machine settings
These are just a few ideas how an home server could be useful in your LAN. There are also a lot of Web GUIs that I didn't covered or Dynamic DNS (like no-ip, dyndns). Emule/Amule, uTorrent, Transmission, Ajaxplorer (a web File Manager) are all interesting services which could be available in your Home Server and over the web.
Happy Freedom box!