Building a Home File Server

Setting up a file server doesn't need to be complicated.

With three desktop machines (Kubuntu, Win XP and a testbed, which is currently running ReactOS) and a laptop (Xubuntu) in use at home, our IT is reaching small office proportions, and like many small offices, we run into file sharing problems. Peer-to-peer networking is fine when all the machines are on, but inevitably it happens that the file I want is on a PC that isn't running. Even worse, it be on my testbed machine that is currently in pieces or undergoing yet another upgrade. So, we need an always-on server that any of us can access any time, but if it is always on, it needs to be quiet, reliable and cheap to run.

These requirements rule out Pentium 4 (too hot and power-hungry) and Windows (needs rebooting too often). Fortunately, I just happen to have a Pentium III of no great distinction that sports a massive passive cooler, and I'm a bit of a Linux enthusiast. Apart from stability, Linux has several other advantages. It's free. It is almost totally virus-resistant, and it comes with excellent fire-walling and security features. And, it is easy to administer remotely, so once it's set up, the server doesn't need its own keyboard, mouse or screen, which saves expense, space, power and heat.

The Case

I'm planning on hiding this server in the loft, so frankly, what it looks like isn't an issue, the prime requirement of the case is that it is big and airy, allowing good air flow with nothing more than natural convection. Apart from choosing a big one, there are couple of things you can do to improve air flow. Remove any case fans if you're not actually using them, as they impede the flow through the vents. Remove unnecessary drives; they waste space and their cables impede air flow. All you need is a hard disk for your OS and files and a basic CD-ROM drive to load the OS. Remove unnecessary cables too, and tie up those you cannot do without to keep them out of the way. Remove surplus cards, as your file server will not need sound, 3-D graphics, USB, FireWire, SCSI or MIDI. On-board graphics or a small basic graphics card is all you need. Remember, warm air is less dense than cold and tends to rise, so make sure there is an inlet at the bottom and an exit near the top. And, if you do hide your server away somewhere, don't bury it in junk or put it in a confined space; let the air get to it.

Figure 1. The Case

There are acoustic damping kits available for PC cases that can kill a lot of noise from fans and disks, but as this server will run fanless, it's not necessary and can diminish the transfer of heat through the case. If the case is already padded with the stuff, remove it.

Figure 2. Strip out everything you don't need.

The PSU

The majority of PC power supplies have a fan that blows warm air out the back of the case, but there are fanless designs available and also some semi-fanless designs that run quiet most of the time but have a fan that kicks in when a heavy load on the PSU causes things to get warm. I'm using a 300W fanless FSP Zen model bought second-hand, but many similar models exist. By modern standards, 300W isn't much, but it's plenty for a Pentium III with basic graphics. Depending on your foraging and bargaining skills, the PSU may well cost more that the rest of the project put together, but it's worth it for silent running.

The CPU

My Slot 1 Pentium III originally was used in a slimline IBM desktop machine. (Remember the type you put under the monitor not under the desk?) It was fitted with a huge heatsink and had a plastic duct from there to the PSU air intake so that the PSU's fan sucked air over the CPU. Some years ago I re-housed it in a standard ATX mini-tower, but of course, the duct was completely the wrong shape, so I left it off and found the chip ran perfectly well without it. It's not good practice for a chip that's working hard, but in this server, it's going to be idle most of the time. It will just keep the OS and networking software ticking, and from time to time will pass an instruction to a hard disk -- not exactly stressful.

Pentium III base units are available from various on-line suppliers and local computer shops. If you buy one with a conventional small heatsink and fan, then around $10 US on eBay will get you a replacement Slot 1 processor with a large heatsink attached. You might even be able to sell the other one or keep it as a spare.

The Motherboard

If you go the economy route, buying an old base unit, the board that is fitted will be fine. If you buy one separately, don't get hung up on specs; performance is not really an issue. Having onboard graphics is useful. Fancy 3-D cards use more power and create more heat, but a basic old AGP card will do too. A modern Linux desktop distro needs about 512MB of RAM to run a GUI and graphics applications happily, but in this situation, it will manage with much less, the only irritant being that the actual installation process might be slow.

The Hard Disks

It's unlikely that a Pentium III motherboard will support SATA, but even an IDE drive will handle data faster than your home network, so that's not really a problem. I opted for a single 80GB drive from good-old eBay. When it starts to fill up, I'll add another. If you can afford it, buy more or a larger one. If you are really serious about keeping the server quiet, you could invest in flexible drive mounts that isolate the drives from the case.

The Operating System

Linux, obviously. The version of Linux isn't really an issue; almost any would do. I used Kubuntu. I chose it because KDE has built-in K Desktop sharing based on VNC for remote administration. It is a single CD download that's easy to install. Download the .iso file from Kubuntu's Web site (http://www.kubuntu.org), and burn it to CD-R or -RW. Whichever CD burner software you use, make sure you chose the option to burn an ISO image file rather than the regular Data CD option. If you don't, you'll have a very useful backup, but it won't boot!

Installing Kubuntu should be just a matter of inserting the CD, rebooting and following the on-screen instructions. However, older PCs such as the IBM used here, will not boot from CD. To get around this you need Smart Boot Manager -- a very small file that boots from a floppy and then lets you choose which disk to run from. Choose CD-ROM, and you're all set. Smart Boot Manager has to be written as an image file, and rather like making a bootable CD, simply copying the file to a floppy doesn't work. There are full instructions for both Linux and Windows users on http://linux.simple.be/tools/sbm, and a disk writing utility for Windows that is very easy to use. Incidentally, this is a useful disk to have for any OS that refuses to boot. The only downside to this is you need a floppy drive, so I put it back in and then removed it once the OS was installed.

Connect your server to your network and Internet router before you start. During installation, it will detect the connection and set it up automatically. It will ask a few basic questions about your location, language and time zone, but nothing taxing. Hostname can be anything, but I use Server. The basic distro includes some desktop software you won't really need, but just go along with the default selection for now. Kubuntu will ask you to set up a user during the installation. Something like System Manager or Administrator is sensible; save your real name for when you set up a normal user account later.

Once installation is complete, it is time to fire up Adept. Debian-based distros use the Apt package management system, and Adept is the KDE GUI that makes it easy to use even if you have an aversion to command-line work and text editing. Go to Start Menu -> System -> Adept. Browse the list of installed apps, and mark things like media players and graphics software for removal. If there is anything you are not sure about, leave it. Click Apply Changes to remove the selected apps. Now you can click the Full Upgrade button to update whatever is left. Finally, you need to install some networking applications. Find the following in Adept: samba and samba-common. Mark them for installation and commit changes.

Configuration

All configuration paths start at the KDE Control Center.

Unless you have a very unusual network card, Kubuntu will detect it and set it up using DHCP. This will work, but it makes remote administration tricky, as you have no way of knowing the server's IP address. Go to Network Settings, click Administrator Mode, and enter your password. Select the interface, and click Configure. Assuming your router is set up using 192.168.1.1, make the server 192.168.1.2. You can continue to rely on DHCP for your other PCs.

Figure 3. Change from DHCP to Fixed IP

Samba uses the Microsoft SMB protocol to interact with Windows shares. It talks to Samba on other Linux boxes too, making it the perfect way to set up a mixed network. There was a time when configuring Samba made strong sysadmins weep. These days, for home networking at least, it is very easy. Different configurations suit different circumstances, but for starters go to System Administration -> Users & Groups, and create a user for each person likely to want to put work on the server.

Now, go to Internet & Network -> Samba. In the Base Settings dialog, set a workgroup name (your hostname will be there already). Click the Shares tab, check that homes is already set (add if necessary), then select it and click Edit. Check Share all home directories (or don't, and add each one you do want to share manually). The remaining tabs in this dialog can be used to increase security, either for business use or perhaps to keep kids out of your files.

Figure 4. Setting Up Samba via the KDE Control Center

Click OK on the Shares page to return to the main Samba dialog, and click the Users tab. Select your Samba users from the list, and click Add. Set a password for each (and make sure you record them somewhere and give them to the relevant users) or don't -- it depends what you have on your PC and who is able to access it. Click OK to save your changes, and exit.

So far you have only "enabled" sharing. Now, to set up shares, you need either to log in as each user or better still run Konqueror as root. Press Alt-F2 to bring up the Run dialog. Enter , and click Options -> Run as different user. Choose root, and enter your password. In Konqueror, browse to /home and right-click on a folder. Go to Properties -> Share -> Configure File Sharing -> OK. Check Simple Sharing, and click Add. Browse to find the folder in question and click OK. Select Share with Samba. Under Samba Options, make the folder Writeable, and under More Samba Options, set Public, Browsable and Available. Return to /home, and click the Reload button. The folder should now have a hand symbol indicating that it is shared. Repeat this with other folders.

As a final tweak on the folders, again running Konqueror as root, go to a folder's Properties -> Permissions menu, and change them to Group and Others can Read and Write. Depending on who has access to your network, you might want to rethink these.

There is no reason why folders have to have people's names. You could just as easily set up and share Photos, Office or MP3.

Accessing the shared folders from a Windows PC is indistinguishable from accessing a normal Windows share. From another Kubuntu box, go to System Menu -> Remote Places -> Samba Shares. From any Linux box, run your file manager and enter the address of the server in the form

smb://your.workgroup
. To make life even easier, right-click on the KDE desktop, select Create New -> Link to Location, and enter the URL there, giving you an instant Network Neighborhood experience.

Remote Desktop Sharing (RDC)

If the server is to run without a keyboard and screen, and especially if it is to be hidden away somewhere, remote administration is very useful. And it's not the least bit difficult to set up. KDE has simple GUI tools for VNC. On the server, go to Network & Internet -> Desktop Sharing. Check Allow uninvited connections, Announce service on network and Allow uninvited connections to control desktop. But don't check Confirm Uninvited connections before connecting. It is good practice to set a password at this point.

Figure 5. Making a Connection

On the PC you want to use to access the server, run

krdc
(K Remote Desktop Connection), and enter the IP address of the server followed by :0 (zero, not O). Click Connect, and the remote desktop appears, giving you complete control of the server.

Figure 6. Choose the Connection Speed

To control the server from a Windows PC, download and install TightVNC (it's free from SourceForge). Run TightVNC Viewer, and enter the IP address of the server followed by :0.

Figure 7. KDE Control Center via VNC on Windows XP

Checking the Server

Run the server in an accessible location for as long as you can before you hide it away, and check that it can run without a keyboard and mouse. You may need to make changes in the BIOS to enable this. Make sure you can reboot it by remote control. It helps if you set an automatic login via System Administration -> Users & Groups -> Convenience.

Figure 8. Shutting Down the Server by Remote Control

About the Author

Phil Thane lives in Wales (UK), has been a teacher and worked for eight years on tech-support (Windows-based CAD/CAM systems for educational use). Phil started freelance writing 15 years ago and began using Linux about three years ago as a hobby. He is now a freelance writer/teacher/trainer.

Load Disqus comments
UserLand

 

Corporate Patron

Linode Logo

 

Pulseway Logo

Limited Time Offer

September Cover

 

Take Linux Journal for a test drive. Download our September issue for FREE.