Install the Server with RAID

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.

This process is also going to install Ubuntu onto two similarly sized hard drives, in a RAID1 configuration. This allows the data on one disk to be mirrored onto the other, giving us redundancy in case of a hard disk failure.

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.

 

  1. 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

  2. On the next screen, select Install Ubuntu Server

  3. Next you are again asked to confirm the language to be used for the installation process

  4. Select your location

  5. 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

  6. The installer will then check your hardware get an IP address from your network via DHCP

  7. You are then asked to enter a hostname for this server

  8. 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

  9. Then create a password for your user. As this user is an administrator on your server, it is important to make the password strong

  10. 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

    Partitioning

    The next step in the installation process is to decide how you are to partition the hard drive on your server. As discussed in the hardware page, for a server, you should strongly consider having two hard drives in a RAID1 array. If this server is going to hold any important data for you, be it movies, photos, backups of files from your other laptops/desktops, etc., you want to insure against the risk of hard drive failure. In a RAID1 array, you have two drives, of similar size, each mirroring the contents of each other. That way, if (when!) one drive fails, you do not lose your data. It is important to note though, that until you replace the failed drive, you are working off of only one drive, so you will need to replace it quickly and rebuild the array.

    The thing to note with a RAID1 mirrored array though, is that in having the drives mirror each other, you lose the storage benefit of having two drives. For example, if you were using 2 x 1Tb drives, they are copying the content on each other. So rather than you having 2Tb at your disposal, you only have 1Tb. What you lose in storage capacity though, you gain in resilience and reduced risk of data loss.

    Note, in the VM I used for this demo, I set up a RAID array on two 10Gb disks. On a real server you will obviously want much larger drives, but it is important to ensure they are both of the same size, i.e. 1Tb each

  11. If you want to partition your disks a specific way, or want to set up a mirrored disk RAID array, select ‘Manual’

  12. On the next screen you see the two disks installed on your system. Lets start partitioning them. Select ‘Guided partitioning’

  13. Select the first of your two disks

    The Ubuntu partitioner will create two partitions, a root partition for your OS, and a smaller swap partition. The swap partition is used if your server is doing memory hungry tasks and needs to ‘borrow’ some hard disk space to add to its RAM capacity. This will be roughly equal to the size of memory installed (I gave this VM 768Mb RAM)

  14. Lets partition the second disk. Select ‘Guided partitioning’

  15. The first option is to resize the partitions on our first disk. I’m going to leave the first disk alone. Select ‘Guided – use entire disk’

  16. Choose the second disk in your machine

    The installer will create a similar partition table on this second disk

    Configure RAID

  17. Ubuntu will configure the partitions and bring you back to this screen, showing you the suggested partitions for each drive. Next select ‘Configure software RAID’

  18. The suggested partitions need to be written to the disk first, so go ahead and select Yes

  19. Lets begin by creating a multiple device configuration

  20. Select the RAID level you want. RAID0 writes data to both disks, and is good for speed, but does not protect you from disk failure. RAID1 mirrors the data on one disk onto the other, thus providing redundancy in case of disk failure. RAID5, 6 & 10 are other forms of redundancy, but require more than two disks.

    For a two drive setup, select RAID1

  21. Both drives will be active in our system, so set the number of active devices in the RAID array to 2

  22. We have no spare devices in this array, so enter ‘0’

  23. Here we configure which partitions on the drives to mirror. Lets setup the OS partitions first. Select the two large partitions

  24. Select ‘Yes’ to write your partitions to the disk

  25. The partitioner brings us back to the Multiple Device menu again. We need to create another MD device for the swap partitions. Once again, select ‘Create MD Device’

  26. Select RAID1 again

  27. Enter ‘2’ as both drives will be active in the array

  28. We have no spare devices

  29. Select the two swap partitions

  30. Write the partition changes to the disk

  31. Now that we have configured both partitions (OS & swap) on our two disks as RAID1, select ‘Finish’

  32. The partitioner brings us back to this screen again, and now there are two RAID devices showing. Select the larger RAID device, which will be for our operating system, and press Enter

  33. Select ‘Use as:’

  34. Select the EXT4 journaling file system. This is how the partition is going to be formatted

  35. Select the Mount Point

  36. Select / for the root file system

  37. We are finished with this partition, so select ‘Done setting up this partition’

  38. You are brought back to this overview screen. Select the second of your RAID devices and press Enter

  39. Select ‘Use as:’

  40. Select ‘swap area’

  41. There is no mount point to be set up on a swap area, so simply confirm that you are done setting up this partition

  42. Back at the overview screen, have one last review of your partitioning scheme, and then select ‘Finish partitioning and write changes to disk’

  43. The partitioner asks for confirmation of the changes you are about to make, so select ‘Yes’

    Installing the System

  44. Once your disk partitions are set up and formatted, the installer goes about installing the server and its packages to your system

  45. 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.

  46. The next prompt asks if you want security updates to be installed automatically or manually. It is best to allow these to run automatically

  47. 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

  48. The GRUB boot loader is what loads and runs the Ubuntu system when you power it on. Select Yes to install it

  49. 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.