To get started with our home server we are going to install the operating system. There are many choices of Linux operating system to choose from, and we are going to go with one of the most popular and well supported distributions, Ubuntu. Ubuntu provide images for both desktop/laptops and servers, and release a new version every 6 months, each April and October. Most versions are supported for short terms, but every 2 years, they release an LTS (Long Term Support) version which they support with maintenance and security updates for 5 years. The most recent of these were released in April 2014 (14.04) and most recently April 2016 (16.04).
The most significant difference between the Server and Desktop versions, is that the server version doesn’t come with a GUI, that is you will be using the command line to interact with it. If this is a bit unsettling, you can install a desktop GUI and remote in to it, but the idea is that the memory and CPU cycles spent on displaying a graphical interface are wasted on a server, as there will not be a user logged and working on it most of the time.
When I was initially setting up my own server, Ubuntu 16.04 hadn’t been released yet, so I used version 14.04. This isn’t too much of a concern as I still have a few years of support before it goes End of Life. As Ubuntu 16.04 is now available though, it makes sense for us to use this in the server we will be setting up here.
Though our server is eventually going to be headless, i.e. no monitor, mouse or keyboard attached, you will need them to install the server initially. Once the base server is up and running, you are free to remove the monitor, mouse & keyboard and put the server away somewhere, into a press or in an attic, leaving just a power and network cable attached.
While it is highly recommended that two hard disks are used when installing the server, to reduce the risk of server loss if one disk fails, this is not always practical. I know in my own case, my server has only one disk at present, so I have to back it up regularly. If you are using an old laptop/desktop computer it may indeed only have space for one disk, and this is the scenario I am going to cover below. If you do have two similarly sized disks, I cover installing the OS in a RAID1 configuration here.
The first step is to set up an image of Ubuntu Server on a Live CD/USB. Go to the Ubuntu site and download a copy of 16.04, the latest LTS release. If you are using a CD, you will need to burn the image to disc. From Windows 7/10, right click on the .iso file and select Burn Disc Image. To make a Live USB, download a copy of either UNetBootin or PenDriveLinux’s excellent application. I have used both and they are very easy to use and do the job well. Once your CD/USB is ready, insert it into your computer and turn it on.
- Turn on your computer and boot from the USB/CD. This is typically done by pressing F2/F8/Esc while booting the computer, but the buttons you need to press to do this is different depending on the computer model you are using, so you will need to look into this in advance. The first prompt you will see is the Language prompt, allowing you to pick the language to proceed in
- On the next screen, select Install Ubuntu Server
- Next you are again asked to confirm the language to be used for the installation process
- Select your location
- You are then asked to select a keyboard layout. If you select No, it presents you with an option of keyboard types to choose from, based on your location, set earlier. If you select Yes, you will be asked to press a sequence of keys in order to determine the keyboard type you are using. In my case, I’m going to select No, and then choose Irish as my keyboard type
- The installer will then check your hardware get an IP address from your network via DHCP
- You are then asked to enter a hostname for this server
- Next you are asked to create a user. The name ‘admin’ is reserved on Ubuntu and cannot be used, so I am going to use something completely different, ‘jupiter’. Start by entering the full name of your user, and then the username you want to use on the server
- Then create a password for your user. As this user is an administrator on your server, it is important to make the password strong
- You are then asked if you want to encrypt your users’ home directories. Encryption is an important security feature for securing your data if your physical server ever gets stolen. I am not going to do it here for a few reasons: some whole disk encryption products require you to enter the password before you continue booting a machine. As this server is going to be packed away in a closet or the attic, this makes it impractical when booting/rebooting. Also if my server ever got corrupted, encryption would prevent me using another Linux Live CD to remove or work on files on my machine. Again, you must assess the security risk here. I don’t intend on storing state secrets here, so I feel I am OK without it this time
- In a single disk installation, unless you know exactly what partitions and sizes you want, you are safe to let the Ubuntu partitioner set up its own partitions on your disk. Simply select ‘Guided – use entire disk’, and two partitions will be created: a swap partition of roughly equal size to the amount of RAM installed, and a root (/) partition for the operating system. The Swap partition is for times when the server is busy using all available RAM, and so must save some work to the hard disk.
Installing the System
- Once your disk partitions are set up and formatted, the installer goes about installing the server and its packages to your system
- Next, the package manager gets configured. This is how the installation and management of software on your server is handled. The package manager used by Ubuntu is called apt. It needs to know is there is a proxy on your network, which it must go through in order to access the internet. On a home network this is not likely, so just select Continue. It will then proceed to install all necessary software.
- The next prompt asks if you want security updates to be installed automatically or manually. It is best to allow these to run automatically
- On the Software Selection page, you are given a number of packages which can be installed on your server at this point. We are going to install some of these later on, so for now leave most of them blank. The most important one to install at this point is OpenSSH Server, so we can login remotely to our server after installation
- The GRUB boot loader is what loads and runs the Ubuntu system when you power it on. Select Yes to install it
- The system installation is now complete! Remove the USB/CD and reboot the server. You should be presented with a command line prompt, which you can sign into with your new username and password. Your server is now up and running.