How to install Ubuntu Server – Focal Fossa 20.04LTS
Although I do have a few old desktop computers lying around and so could have taken a Windows Licence from one of them to use Windows for my server I fancied trying Linux. Ubuntu seems to be a very popular choice and I knew there would be plenty of help available when (not if!) I needed it. Since this new machine would be running headless I figured Ubuntu Server would be the natural choice. Obviously I could have chosen Ubuntu Desktop but that would mean installing all the desktop components and all the other bloat that goes with it. Don’t get me wrong, Ubuntu is not a bloated operating system but nevertheless I’d still be installing more stuff than I would be using. The downside with Ubuntu Server, for many, is there is no GUI and so you have to do everything from “the command line”. However, I found out I could run a “virtual desktop” using VNC so I decided that Ubuntu Server would be the perfect choice after all. If I hit a brick wall I could always wipe the drive and start over using Ubuntu Desktop. Or dare I say it, Windows.
The installation of Ubuntu Server is actually very straight forward. You first off need to download the ISO image from the Ubuntu Website and burn it to a CD/DVD. The process for installing Ubuntu Server is almost identical for Intrepid Ibex 8.10, Jaunty Jackalope 9.04, Karmic Koala 9.10, Lucid Lynx 10.04LTS, Precise Pangolin 12.04LTS, Saucy Salamnder 13.10, Trusty Tahr 14.04 and Xenial Xerus 16.04 so this guide will work equally well for these earlier versions too.
NOTE: It is quite normal for people to want to install the latest and greatest version of a particular OS but in the case of Ubuntu I would recommend sticking with the LTS (Long Term Support) versions. Non LTS versions often have bugs and little in the way of additional features over and above the LTS versions preceding them. Furthermore the LTS versions of Ubuntu Server are supported for 5 years after being released whereas the non-LTS versions are only supported for 18 months.
That said, at the time of writing the latest LTS version is Focal Fossa 20.04 but this version is not without issues. VNC with the GNOME shell does not work particularly well but is improving all the time. Pop over to the forums for the latest views on this release.
So, onto the install. You’ll need a keyboard, screen and Ethernet cable plugged into your new server for this part.
Firstly, you need to make sure the server is set to boot from the CD/DVD drive. You can do this by going into the BIOS (by pressing the [Del] key when it’s booting) and changing the first drive to be the CD/DVD drive if it’s not set like that already.
If you’ve just jumped into this guide here and have not been following things from the start (meaning you will likely not be using the same motherboard as me) then hitting the [Del] key to get into the BIOS during boot might not work for you. Try instead hitting [Esc], [F1], [F8] or [F10] to get you into the BIOS when the server is booting up.
If I’m ever unsure what the key is I just hit all the Function keys in quick succession when it’s booting and one of them usually does the trick!
Once the server has booted from the CD/DVD you’ll be presented with the Ubuntu Welcome Screen. Follow the onscreen instructions to install Ubuntu Server. Just a few points worth mentioning:
- When prompted, choose a strong password. But make sure it’s one you’ll not mind typing lots of times in the future!
- When asked if you want to “configure your home directory for encryption”, please choose <No>.
If you really want to encrypt it then you’ll need to log onto your server before you can run any processes (eg. cron jobs) which access your home directory. This is because your home directory is only unencrypted (and thus available to be read from or written to) once you’ve logged onto the server. - Drive Partitions. In earlier versions of Ubuntu Server you basically had two main choices when it came to partitioning your system drive: The first option was to manually configure the partitions yourself and the second option was to let Ubuntu do the hard work for you. Whilst the latter might sound attractive at first, the downside was that Ubuntu used the WHOLE of your selected drive for the installation. Whilst there was nothing inherently wrong in doing this it could cause problems later on if you ever decided to wipe the OS and start over, since you’d have to move all your “user data” off the OS drive before you could reinstall, or of course risk losing all your data.
Thankfully they’ve now addressed that shortcoming. So you can now have the benefits of a manual configuration (where you can decide on your own partition sizes) but Ubuntu does all the hard work for you.
So, when you reach the “partition disks” or “Guided storage configuration” screen, choose “Guided – use entire disk and set up LVM” or “Use an entire disk and set up this disk as an LVM group” and select the disk you want to install Ubuntu on. You’ll then be presented with a screen where you can choose exactly how much of the drive (Volume Group) you want to use for the installation. I chose 30GB which is MORE than plenty. - Managing Updates: This is a matter of personal preference. I choose the “No automatic updates” option and then manually kick off the updates when I feel the urge.
- When asked which software packages you want to install I suggest you choose the following two: OpenSSH Server & Samba File Server since these will come in handy throughout the rest of these guides. I suggest you also leave the standard system utilities option checked. Obviously you are free to choose whichever ones you like!
If you want to run virtual machines on your server then by all means select Virtual Machine Host too. On 20.04 you only get to choose OpenSSH Server and you do not need to Import SSH identity so you can leave that option unchecked. There is no need to install any of the server snaps from the following page that comes up. - You can select (and also de-select) packages by highlighting the relevant options with your cursor and pressing the Spacebar. Hit the Tab key to jump out of the list and onto the <Continue>/<Next> menu option.
- When you reach the “Install the GRUB boot loader on a hard disk” screen choose . NOTE: This option has been removed from Focal Fossa 20.04.
- When the installation has completed remove the installation CD/DVD from the drive and let the system reboot.
How to upgrade packages
It’s likely that the packages you’ve just installed from the downloaded installation CD/DVD have been updated since the disc image was built on the Ubuntu website. That’s not a problem as you can bring your system fully up to date by issuing the following two commands:
sudo apt-get update
to update the package index. You’ll be prompted for a password. This is the password you created during the install above.
Then issue the following command to update the installed packages:
sudo aptitude safe-upgrade
sudo: aptitude: command not found
If you receive this error after typing the above command then you can solve it by installing aptitude manually as follows:
sudo apt-get install aptitude
It’s recommended you issue the above update/upgrade commands from time to time to keep your system fully up to date, assuming of course that you chose “No automatic updates” when you installed Ubuntu.
You can save yourself a bit of time by issuing multiple commands on the one line. To separate individual commands use the “;” character. So, you’d issue the above two commands on the one line as follows:
sudo apt-get update;sudo aptitude safe-upgrade
What is the difference between && and ; in Unix
Above I just said that the command separator is a semi-colon. But you can also use && to separate two commands. The difference between the two is with && the second command will be executed only if the first command succeeds. If it fails for any reason then the second command will not be executed. In the above example it doesn’t really matter which separator you use since if the first command fails then it’s likely the second one will too.
How to check which version of Ubuntu I’m running
If you’ve already installed Ubuntu and simply want to check which version you’re running then issue the following command in a Terminal or Putty Session:
lsb_release -a
vim is not installed by default on some versions of Ubuntu
The versions of Ubuntu between after 10.04 and 12.04 didn’t install vim by default. vim is a text editor which you will be using extensively. Fortunately it is a simple matter of typing the following command to install it (Note: if it’s already installed then Ubuntu will tell you so and do nothing):
sudo apt-get install vim
How to reboot the Server
Once you’ve installed Ubuntu Server you should make sure the server can boot properly. So type the following command at the prompt to reboot the server:
sudo reboot -h now
Once it’s rebooted and assuming everything’s working fine you’ll end up back at the command prompt.
How to set a Fixed or static IP address in Ubuntu
I think it’s always a good idea to give your server a fixed IP address so your devices can always find it on your network even if your router decides to assign it a different address than it had originally.
How to administer Ubuntu Server
To administer our server we’re going to Install Putty. This will give us a “Command Line” interface. Since I didn’t want to have to learn hundreds of Linux commands I decided to Install VNC as well. VNC provides a virtual desktop view onto your server exactly as if you’d installed Ubuntu Desktop (but obviously without all the extra desktop applications) and so, for the Windows veterans amongst us, the transition from Windows to Linux doesn’t have to be quite so painful since you’ll have a nice GUI to play with.
As we’re essentially building a server and not a desktop computer there are some “server functions” that can’t easily be configured using the Gnome desktop and so for this we’re going to Install Webmin.