Took an old computer this weekend and wanted to learn how to setup a file server. This is an easy way to take an old computer, stack in a bunch of hard drives, and turn it into a file share for music or file storage. Also handy for backing up entire hard drives on the systems you use everyday.
Initially, this took many hours and lots of googling for answers. I’ve decided to list the steps below. On the second pc, the entire process only took 45 minutes to setup.
I used a linux distro called CRUNCHBANG (#!) and I chose the lite version – it’s lean and mean linux goodness.
Download the .iso file and burn it to a CD. I use k3b to burn cd’s on my Ubuntu system. It is important to burn the .iso file as “bootable”.
Set you old pc to boot from the CD rom (go into the BIOS and make sure it’s set to boot CD first). Now, boot the system with the CRUNCHBANG CD in the pc. CRUNCHBANG will now be running from the CD. This is a bit confusing as it looks like it’s installed to the hard drive…but it’s not. Yet.
Right-click on the Desktop and choose “Install” and then “Install CRUNCHBANG”.
Follow the on screen prompts to install. For more detailed instructions on the installation, refer to the CRUNCHBANG Installation Guide.
Be sure to use the same workgroup name as the other pc’s on your network and write down what you called this pc. You will need this later to connect to it.
Next, we’ll need to install Samba (for file sharing) so that any Windows computers on our network can see the share as well.
Open Terminator (terminal) either by right-clicking the desktop and using the menu or pressing the “Windows” key and the “T” key. CRUNCHBANG has these “SUPER” key shortcuts that you will soon find very addictive.
Let’s make sure our repositories and such have the latest updates, so type or copy/paste this line:
sudo apt-get update
Now, let’s install Samba. In the Terminator window, type or copy/paste this line at the flashing prompt:
sudo apt-get install samba
Next let’s install Samba configuration editor. Enter or copy/paste this into Terminator:
sudo apt-get install system-config-samba
Use the text editor to edit this file. Be sure to enter the exact workgroup name of your network. Otherwise the other computers on the network won’t “see” this share.
From Terminator enter:
sudo nano /etc/samba/smb.conf
Optional – edit the host name in /etc/hostname
Be aware that when you make changes to smb.conf you then need to restart Samba for the change to take effect. From Terminator, enter:
sudo /etc/init.d/samba restart
In the file manager, create the folder to share and give it RW permissions as Root. If during the course of this tutorial, you can’t read or write to the share, that is most likely due to permissions. I had to open my permissions to “see” the share, and then narrow them down until I got it just right.
I found using the default file manager difficult to “see” the shares, so I installed Nautilus. At terminator type or copy/paste:
sudo apt-get install nautilus
And since Nautilus likes to mess with the desktop, I disabled a few things. Remove all the interference of Nautilus desktop by running these from terminal. Use copy/paste into Terminator to make sure you enter it correctly:
This will disable Nautilus desktop:
gconftool-2 -s -t bool /apps/nautilus/preferences/show_desktop false &
Do not let Nautilus set the background image:
gconftool-2 -s -t bool /desktop/gnome/background/draw_background false &
Make Nautilus use spatial mode, should start-up quicker:
gconftool-2 -s -t bool /apps/nautilus/preferences/always_use_browser false &
Make Nautilus show the advanced permissions dialog:
gconftool-2 -s -t bool /apps/nautilus/preferences/show_advanced_permissions true &
Next let’s attach that physical folder to Samba, so the rest of the network can see it and read/write to it. At Terminator, enter:
If you want to set this computer up as a “headless” server (one with no monitor, keyboard, mouse, etc), you can install Vino to be able to remotely connect to it for administration and such. Pretty handy stuff!
To install Vino (for remote connections) on the file sharing computer, in Terminator type or copy/paste:
sudo apt-get install vino
If the computer that will be connecting to it is Linux, run this command at the teminal prompt on that pc:
sudo apt-get install xtightvncviewer
If you will be connecting to it thru Windows, just use “Remote Desktop”.
Ok, let’s configure the server , in a terminal type :
Set it how you want it and save/close.
Let’s make sure vino starts automatically upon reboot, so back in terminal type or copy/paste:
Done! Let’s check our work by going to another computer on the network. If it’s a Linux pc use Nautilus (the default file browser) to browse the network to the share or click File -> Connect to Server and enter the name of your computer and the share manually.