Part I: Building Preparing
My professional expertise is generally limited to all things Network, however I dabbled in other areas in school and continue to dabble in my free time at home. I have always taken an interest in different Operating Systems and how they compare to each other; so once I got over Darwin and its proprietary everything I feel in love with Linux: clean, fast, customizable and open source. I have always tried to challenge my Linux CLI skills but it’s only recently that I took the plunge into Linux Servers. Whether you’re building a server for fun, for simple file services or working up to building your own Onion site everyone has to start somewhere. Remember that companies like Apple, Amazon and even Google started with limited hardware in a garage.
Microsoft Server was one subject I focused on in school; however my career has little to nothing to do with MS Server. I have run a few MS Server 2008 VMs and even an old PC, but always found that my cheap hardware was too limited for Microsoft. Annoyingly, there are certain Server roles, which cannot be placed on the same server – this bad news if you’re looking to set up a cheap home server with some basic services on one box. A few months ago I tried to build another 2008 Server on an old PC and quickly got fed up. Looking around the Craigslist sites I found a few reasonably priced user PowerEdge (and similar server brands) in the $250-500 range, but at the time I really didn’t have the money to spend on a hobby machine. I decided to try something and found an AMD single core PC with 1 Gig of RAM and a 40 GB hard drive – this is my story of how I turned that old $10 beast and a $5 domain name into a functioning Linux server.
The first thing that I need to get out of the way is the GUI. I have since built another Linux server with absolutely no GUI, but when I started this budget endeavor I felt squeamish not having a GUI. As you can see, Ubuntu provides you with an easy-to-use menu even when installing no GUI (many server distros will not offer this).
This would end up being quite ironic since I set up most of my services through a putty SSH connection to the box. Since I was dealing with a low spec machine I reviewed my options and decided to go with Xubuntu. Why didn’t I go with Lubuntu? Well, I honestly find it quite ugly and I know that Xfce is solid so the decision was easy. Why Ubuntu in general? As many of you may know, Ubuntu is probably the best supported “user friendly” Linux around (and I like Debian). With these lightweight versions of Ubuntu you don’t have to deal with the new touch screen friendly UI and you get a straightforward desktop. I didn’t want to hit time consuming roadblocks just to get the installation complete, so I decided to pick a distro that I could stand up easily. installing Ubuntu Server is as easy as installing Ubuntu desktop, so if you’re just beginning it is a great choice
Ubuntu server installs now provide an option to install a LAMP server template (Linux Apache MySQL PHP), but since I was really looking for a lightweight HTTP FTP machine, I didn’t bother with this – I certainly won’t be using an large databases, but if this is what you’re looking for I would recommend installing the LAMP installation and save yourself some time. As mentioned, my first goal was to get HTTP and FTP installed and running. For HTTP you are going to want to install Apache2 and for FTP you can go with the simple vsftpd (unless you need something fancier). Remember that a server doesn’t have to be a Proliant, Power Edge or ESX host. A server can be any computer that hosts various services.
Although I decided to start with a nasty old single core PC with a GB RAM (and have proven it can work), you may want to look for something beefier. My build was to see how cheaply I could make a functional server, but I can guarantee that anything more than 5 users on it will bring it to its knees. My recommendation is to buy the best hardware that you can at the time. Going with a Linux OS will save you a nice bit of cash not having to purchase an operating system – so spend the extra on your hardware. If you anticipate needing lots of disk space and/running large complex databases in the background then buy accordingly. Once you stand the server up you will have to deal with another major requirement: domain name and DNS.
I want to be clear that I am not exploring the intricacies of Onion (TOR) domains at this point. First, I would be way too far out of my element and second you should understand how domains work on the clearnet before wading in to running a server on the Darknet. Let’s also assume that you have a basic command of Linux. This article will not explain the basics of Linux CLI, so please be comfortable with the Linux CLI if attempting to build a Linux server. Since my preferred .com domain was going to cost me $75 annually I thought to myself “why the hell do I need a .com?” With the recent release of many new domain extensions the choices have greatly increased and will have the potential to be endless. I ended up grabbing a .space and a .us for about $6 a piece at Namecheap.com. I parked one of them and started preparing to bring the other online. I would like to warn that certain long-established systems are not yet prepared to deal with the new extensions. For instance, ‘nslookup’ has no problem resolving a .cafe address, however ‘whois’ doesn’t understand it. I’m sure the issue goes beyond there, but for the most part you shouldn’t have much trouble hosting a server on the internet.
Unless you have the capital to dish out an additional $100-300 a month to your ISP you will be like the rest of us and will have a changing public IP. Luckily, there’s a well established way to deal with what is known as “Dynamic DNS”. To keep the internet’s various DNS records up-to-date with your changing IP address you will need to run an application somewhere on your network, which will report your public IP back to DynDNS, Namecheap (or whoever you choose for your services). Namecheap offers an application called “Dynamic DNS Client” which can be set up to poll at specific intervals. If you have an always-on Windows machine and wish to keep this off of your server then this is your answer:
I can say from experience that this client works VERY well and is quite simple to set up. It makes the most sense to have this type of application on your server, since your server will likely be up and online as much as possible. In this scenario you can easily install and configure a Linux service called ddclient. To determine if this service is installed, and what the status might be you can use the following command service ddclient status. If not installed, you can easily install and configure the application using apt-get install ddclient
You will be prompted to configure the client during installation via a menu-driven installer:
Once the installation is complete you will be presented with options that include start, stop, restart and force-reload:
If you prefer to configure the service using the configuration file, or just need to modify settings as time goes on you will find the configuration file at /etc/ddclient.conf and it should contain something similar to this:
The best way to confirm that this application is working is to release and renew your public IP and then look up the DNS entry for your domain using arin.net, whois, nslookup, etc. You should also be able to locate a log file (if enabled) in /var/log.
Now that you have a domain and an application to handle your IP changes, you can officially say that you are prepared to place a server on the internet. There will be an additional step involved before you can think about browsing to your server’s web pages or getting files with FTP: you will need to configure port-forwarding/NAT on your router. This can be very easy, very hard or not available at all depending on what you’re using as a router. We will tackle this first thing in Part II of “Build a Cheap Linux Server”. Feel free to figure it out on your own while you anxiously await the next installment