Home Audience Admin Building a Server from Scratch

Building a Server from Scratch


When enterprises want servers, they buy them. But when hobbyists or small businesses like travel agencies and franchises want servers, they can’t. All the servers available commercially are blades, razors, racks, cupboards, etc. The fact is: servers don’t have to be in huge air-conditioned rooms. They can run on commodity hardware also. We are going to prove that building a commodity server from scratch (you can make and sell these, if you like) using off-the shelf hardware can be done for less than Rs 45,000.

As Barack Obama famously said: “Yes, We Can!”

Yes, We Can! With 45 grand, we are going to build a server that supports Web, e-mail, virtualisation, media streaming, DNS, PXE, fax, a file server and VNC server roles.

Because of the budget we have, we are going to assemble our own machine (or at least buy the parts ourselves, and get it put together by the local techie). I will recommend specific hardware, including their model numbers.
So let’s start buying:

  • Processor: Intel Core2 Quad Q6600 2.4GHz @ Rs 9000
  • Motherboard: Gigabyte EG45M-DS2H @ Rs 8000
  • RAM: Transcend JetRam DDR2-800 800MHz—2x 2GB modules @ Rs 5500 (Rs 2,750 each)
  • Hard Disk: 4x Seagate Barracuda 7200RPM 500GB @ Rs 14,000 (Rs 3,500 each)
  • Cabinet: iBall i701 Server Cabinet @ Rs 4,000 (Pricey!)
  • Keyboard and mouse: Microsoft wireless desktop combo 1000 @ Rs 1,850
  • Monitor: You can get a 17-inch CRT from Samsung at Rs 3,500
  • Optical: LG GH22NP20 DVD-RAM Drive @ Rs 1,250

Total cost: Rs 43,600 (tentatively). Prices vary, but there are chances you can get a better deal from the vendors in your city if you have time to find out the prices yourself after visiting a few shops.

But let me tell you, you are not bound to this configuration. At a bare minimum, a 500MHz PIII with 256 MB RAM and 80 GB of hard drive space will do, but you will not be able to run many applications. And if you are a hobbyist, you can get away with VMWare server (not VirtualBox or QEMU because of the performance-hit involved).

So what do we have? 2 TB of HDD space, 4 GB RAM, a gaming motherboard (I chose that one because it can be overclocked if need be), a 2.4 GHz QC processor that processes four threads per clock cycle, and a cabinet with a very robust SMPS and plenty of drive bays.
You have a very sleek wireless mouse and keyboard combo, but that’s something you can cut down on. Because, at the end of the day, the server will have no monitor and input devices — everything will be managed via remote X.
Oh, and of course, the UPS system is extra!

The ribcage

To build the basic backbone, or by our analogy, the ribcage of the server, we are going to use (you guessed it!) GNU/Linux. For our distro of choice, we are using a desktop distribution, Kubuntu. You can use Xubuntu or plain and simple Ubuntu as well.

Because this is a very complex procedure, we are going to do this in stages.

Stage 1: Installing the OS

First, get the latest CD of the distro you are going to use. Head to ubuntu.com and get a CD. Get the desktop edition, not the server edition.

Now switch on your PC for the first time, and set the date and time on your BIOS. Search for something like “Boot device priority”, and set your PC to try booting from the CD first, and then the hard drive. Save your settings, and exit.

When you reboot, your PC will get stuck and complain about the absence of an operating system. So, insert the Kubuntu CD and hit the reset button on the cabinet.

Directly go to Install Kubuntu and start the installation.

The installation process of Kubuntu is just seven screenfulls long. The process is very simple. The only place where you need help is for partitioning.

Create a new MBR on /dev/sda, and create a 100 MB ext2 (not 3) for /boot, a 40 GB XFS for / (root) and a 6 GB swap space. After that, devote the rest of /dev/sda to a partition mounting under /tmp/ServerTemp. Use XFS here and then the manual partitioning option.

Complete the installation as usual and reboot into KDE4.

At this point, your server should not be connected or configured for any sort of networking at all.

You will be working as the root user throughout. This is a big security issue, I know, but this is the only hassle-free way of getting everything done perfectly.

Oh, and make a note of disabling all power saving schemes and screensavers. Since this is a server, it may need to stay up for years at a stretch, often without months of desktop activity.

Stage 2: Enable root

Enabling the root isn’t a big issue. Open Konsole and type in sudo passwd root. Enter a root password twice. Bingo! The root is enabled now.

Stage 3: Internet connectivity

The time has come to connect our server to the Internet. I assume that you are using an ‘unlimited’ usage broadband connection that has a static IP address. If you don’t have a static IP address, ask your ISP for one and write it down somewhere. Having a static IP address is very important.

Now ask your ISP service person to configure your modem to be always-on, i.e., you don’t need to enter a password to access the Internet. This constitutes entering the user name and password into the modem itself so that it authenticates every time it switches on.

Run a length of RJ-45 wire from the port on your modem to the network card socket on your motherboard.

Your NIC will have a device node eth0. Add the following two lines to the /etc/resolv.conf file:


Execute the following command:

ifconfig eth0
route add default gw ## assuming this is your gateway address—the IP address of your router
ifconfig eth0 up

Now reboot the system and try to browse the Internet. Everything should work.

At this stage, run an apt-get update and apt-get dist-upgrade to upgrade all installed packages to their latest versions.

Stage 4: Let the world welcome you

Yeah, you got it—DNS.

You can have your own DNS if you want, and I’ll cover that in the last part of the series. But right now, we will not have our own DNS server. What we are going to do is sign up for a DNS service provider.

First, register a domain. You can get one for free at www.co.cc. Sign up for a free account. You can have up to two domains per account. They are in the form www.yourdomain.co.cc. Mine is www.theossfreak.co.cc, but don’t freak out here. Not all domains are free, some require up to $900 per year. The trick is to make a simple spelling mistake. MangoesAreSticky comes for $7 a year, but take the e out of Mangoes and the domain is free for life.

When you set up your domain, use the first of three configuration options. Set up the nameservers as ns1.everydns.com through ns4.everydns.com (4 in all, you need to add 2).

Now go to www.everydns.com. Sign up for another free account. You will be signed in immediately. Add your domain as a basic domain (on the left). Give the full name without the www, like yourdomain.co.cc. The right pane will now show a table with a single ‘A’ (the IP address) and a ‘CNAME’ record. You need to add one more first and then remove the other two.

Remember the static IP address that your ISP gave you when you asked for it? Just below the table is the form for adding a record. Give the domain name without the www in the first field. Now let the record type be A. In the value field, give your static IP address. If it’s BSNL, then it most probably starts with 59. Then commit the changes. Your existing A record will change to reflect the new settings with a TTL or Time To Live of 3600 seconds, or 60 minutes. We are done.

What now?

Because server connectivity is brilliantly tough, you are bound to hit problems. You can try out Internet forums, try your own luck, or you can e-mail me. The problems vary greatly and are dependent on many things, such as the USB drive not being found, or you not being able to connect to the Internet. Take these problems head-on and overcome them. Remember that this server has no enterprise support.

We are not building this server as an expensive Internet browsing machine. We will eventually set up the server role-by-role. I did want to set up every piece of software from the sources, but ran out of patience. Hundreds of dependencies, and equally high compile times, made it an exhausting task. Thus the controversial choice of the OS. (Who’d use a desktop OS as a server?)

There are advantages to using Ubuntu. It’s a very simple to use Debian-based distribution. We can tweak it exactly to our needs. Even now if you think KDE4 is too heavy for a server, issue apt-get install xubuntu-desktop to go with XFCE 4.4.2. Brilliant!

Next month, we will start setting up our server. We will first set up the DHCP services. Then comes the setting up of a TFTP server as the first real server role. (TFTP is kind of useless, but it is used to remote-boot PCs over the network using PXE.) We will also set up a firewall, following which we will set up a basic LLMPPP (Linux-LightTPD-MySQL-PHP-Python3-Perl) stack for our Web apps. (If you doubt LightTPD’s power, it is used by both Wikipedia and YouTube, and they’re seldom, if ever, down!)

In the subsequent months, we will start by setting up a complete Web and database server, an e-mail server, fax, IRC and Jabber (for chat), virtualisation, file storage (FTP), print and media streaming, in that order. You can skip any function you like, and you can ask me to add roles that you may want. I’m open to suggestions and contributions, in the true spirit of FOSS.

For now, go and purchase another network card, and a network hub. Configure the new NIC as eth1 with an IP address of 192.168.1/24. This will be the IP address that all the PCs in your network will know as the server. Connect eth1 to the hub. All the PCs in your network will connect to the hub in a Star-Bus Topology.

The Star Bus Topology
A topology is the arrangement in which computers on a LAN are physically connected together. There are many such topologies, such as Ring, Star, Bus, Mesh, etc. Since the Ethernet is not connection-centric, any sort of arrangement works, but these topologies have a wide use, as they are the only way to keep the physical connections organised.

The Star-Bus topology is a hybrid topology, using the best of both the Star and Bus worlds. In this arrangement, a single high-capacity line, called the Bus, runs from the server to a hub. From the hub, many more lines run to one client each, or to other hubs. In the latter case, the hub-to-hub line becomes another bus. In a schematic diagram, each of these clients on a hub is represented by spokes running from the hub to the client; thus the Star.

In a Star-Bus topology, you have flexibility as well, because you can have different servers at different levels, each tending to the levels below it.

I also suggest that you do some research on basic networking, the Ring and Star topologies, and CSA (Client Server Architecture). This will help, as you will know what you are doing.

See you next month!


  1. hmmm… this is probably a PC connected to internet.. nothing specific to servers…probably you should have shown how to do some raid config using sata hdds..

    also.. ifconfig command does not save anything.. once you reboot, ip configuration will be lost…

  2. Hi,

    We publish all comments that we receive. Unfortunately, we shifted to DisQus commenting 2 days back and the import process of previous wordpress comments into DisQus is still in process. We are hoping to achieve that soon.

    So, even if we ever fail to follow the open source principle, open (or free) speech will always prevail.

    P.S. – I noticed your previous comment is back on this post. Unfortunately, a few of them are still getting processed. :-(

  3. Hi guys! I am trying to build a home server using my old HP D530S. I installed Ubuntu Server 12 successfully. However, everytime I try to log in, my keyboard input are not read by the password line. How do I go about solving this?


Please enter your comment!
Please enter your name here