Book Image

Ubuntu Server Essentials

By : Abdelmonam Kouka
Book Image

Ubuntu Server Essentials

By: Abdelmonam Kouka

Overview of this book

Ubuntu is a Debian-based Linux operating system built on top of the Debian architecture. It is used to make operating systems for multiple platforms, including phones, desktops, TVs and mobiles. It has made some serious progress in the realms of efficiency and user friendliness. With evolving technology trends, demands on software have changed, with more and more skilled users. Over the past few years, services such as Facebook, Twitter, and push notifications on smartphones mean that users are used to being up to date with everything that happens all the time. With SignalR, the applications stay connected and will generate notifications when something happens either from the system or by other users. This provides new opportunities for the system administrators, to enter this new and exciting world of real-time application development. This is a concise and a cost-friendly guide, packed with up-to-date essentials on Ubuntu Server fundamentals. It will guide you through deploying and configuring Ubuntu servers in your office environments. You’ll start by installing Ubuntu Server, then move to the most useful aspect —the command-line interface inside it. You’ll extend your knowledge by learning how to administrate and configure Ubuntu Server. You will also see how to deploy services on Ubuntu Server and find out how to secure it. You’ll get to grips with the virtualization and cloud computing facilities provided by Ubuntu, and finally, you’ll gain some very useful tips.
Table of Contents (13 chapters)

The manual installation

In this section, we will have a look at how to install Ubuntu Server manually, either from the CD or the USB key. Here, we will only cover the installation from the CD; the same procedure applies for the installation from the USB key. In the latter case, you should configure your computer (using the BIOS interface) to boot from USB.

There is another way to manually install Ubuntu Server, which is via network, but since we will see this procedure in depth in the next Automated installation section, we will not cover it here.

A simple installation from a CD

The procedure for installing Ubuntu from a CD is the same as that for most of the Linux distributions. So, if you are familiar with this, you can save time and move directly to the next section. If you are a newbie in this field, please follow this section closely, since the next sections (advanced installation and automated installation) will be based on this. Note that for Ubuntu Server edition, there is no graphical environment like the one in the desktop edition. So, you will need to use only the keyboard and not the mouse. The stepwise procedure to install Ubunto from CD is as follows:

  1. First of all, download the installation CD image that matches your CPU architecture from the download page at and burn it on to an empty CD.

  2. Secondly, verify that your server BIOS is configured to boot on a CD-ROM drive; if this isn't the case, take care that you change it.

  3. Insert your CD in to the CD-ROM drive and boot it.

  4. Just after the boot process starts, you will be asked to select the installation language. Choose the one that you want. Don't worry if you choose some other language by mistake. You will soon learn how to change the settings.

  5. Now, you will get the following interface:

    You can see a lot of options that cater to your needs:

    • If you just press the Enter key when selecting the default Install Ubuntu Server option, you will start the installation process.

    • The second option, Multiple server install with MAAS, will be covered later in the chapter when talking about virtualization and cloud.

    • Some people prefer starting with the third option, Check disk for defects, to verify that the burn process of the ISO file on the CD was done correctly.

    • The fourth option, Test memory, is very helpful, especially when your server starts crashing and you suspect a RAM-related problem.

    • You can use the fifth option, Boot from first hard disk, to bypass the boot from the CD in case you forgot it by mistake in the CD-ROM driver.

    • Finally, the last option, Rescue a broken system, turns a CD into a rescue disk that is useful for backup and recovery.

    • In most of the cases, all that you need to do is launch the installation by pressing the Enter key when selecting the default Install Ubuntu Server option, but there are some cases where you need some special options, either because of some specific hardware-related need of your machine, or because you need to customize the kernel parameters of the server for future use. For this purpose, Ubuntu gives you a lot of possibilities via the bottom menu on the boot splash screen, which can be accessed via the function keys.

    • If you press F1, you will see an interactive help screen with documentation for the rest of the options.

    • If you accidentally chose the wrong language at the time of booting, press F2 to change it. The boot screen will automatically choose a keyboard mapping based on your language.

    • If you want a different mapping (for example, in my case, I am preparing screenshots for this book in English but I am using a French keyboard), press F3 to choose from a list of keyboard mapping options. The boot screen also has a lot of great accessibility options.

    • The F4 key displays a list of installation modes from which you can choose to install Ubuntu Server by using an OEM installation, a minimal system, and a minimal virtualization guest. The OEM installation is available for manufacturers. The minimal virtualization guest gives you an easy way to install a virtualized version of Ubuntu.

    • The F5 key shows an accessibility menu that allows you to choose a high-contrast screen, a screen magnifier, a screen reader, a braille terminal, keyboard modifiers, and even an on-screen keyboard.

    • The real power and control over the boot process is available once you press the F6 key. Here, you can see a menu of the common arguments that help the CD boot on difficult hardware. If you press the Esc key, you will move from this menu to the boot prompt. You can type extra kernel boot parameters that you might need for your hardware, as shown in the following screenshot:

  6. Just after launching the installation process, you will be asked to choose the language of the installation procedure, which will be the default language of the server that you wish to install. Select the one that you want by using the up/down arrow keys on your keyboard and then press the Enter key. You will also be asked for the location of the server (based on this, the system will fix the server time settings). Then, you have a choice of either letting the installer detect your keyboard layout, or you entering it manually.

  7. After performing these steps, the installer starts the installation process by detecting the hardware and loading some packages. Then, it moves on to configure the network settings by using DHCP (Dynamic Host Configuration Protocol) and asking for the hostname that you would like to give to your server. If you wouldn't like to use DHCP for network configuration, choose go back or simply press the Esc button to go to the first interface of network configuration, where you will find the Configure the network manually option, as shown in the following screenshot:

    By making this choice, you will be asked via different interfaces to enter your IP address, Netmask, the default Gateway, and DNS.


    Note that if you enter wrong information by mistake and you realize just after pressing the Enter key, don't worry. You can go back easily to the previous interface and re-enter the correct data. All that you need to do is choose Go Back or simply press the Esc button.

    Also note that this data is not a tattoo, and you can change it later. We will have a look at how to do this in the next chapter.

  8. At this point, we have almost finished the network settings part. We will be asked for the hostname in the next screen, and then we will move on to the user settings. First of all, you will be asked about the full username. Then, you will get an interface that asks for the Ubuntu username, which will be used for authentication with a proposition derived from the full username that you entered before. You can accept the proposition or modify it. Finally, you will be asked to enter and re-enter a password for this user. Be careful in this step because the keys entered will be hidden, as shown in the following screenshot. Therefore, it is important to remember the keys that you have entered:

    Next, you will be asked whether you would like to encrypt your home directory. Don't do that unless you know what you are doing. At the end of this step, you will be asked to check your time zone. Change it in case it is incorrect.

  9. Now, the most critical part of the installation arrives—partitioning! If you are using a new hard disk, you will see a screen, as shown in the following screenshot:

    If you are using a used hard disk, you will receive an interface that is a little different. It contains in general the same four options with the options related to the reuse of the existing partitions. The first three options are the recommended ones for a newbie. In our case, we will choose the Guided—use entire disk and set up LVM option. The Manual option will be covered in the Advanced installation section.

    On pressing the Enter key, you will be taken to the next screen, where you will be asked to choose the disk that you would like to partition. You will then be taken to an interface, which will ask for your permission to write changes on the disk with the No option selected. We of course need to make changes to the disk. We should just verify that we created a backup of our data on the disk before moving on. The next step is to select the Yes option and press the Enter key. Before you finish this step, you will be asked to enter the size of each volume group that you will be using for this partitioning. You can answer with a number followed by a symbol such as MB, GB, and TB, or simply use a percentage. Finally, you will get a summary of the partitioning step, which needs to be confirmed before it is applied, as shown in the following screenshot. Select the Yes option and press the Enter key:

  10. At this point, the real installation process starts. During the installation, the installer needs only the CD, but if there is an Internet connection, it can be used to download software lists and install the latest updates. For that, it will ask you to either enter the proxy settings if you have one, or to keep this field empty.

    After this step, the installer will start downloading the software list (we will cover this later in the next chapter). This step can take some time, depending on your Internet speed:

    After a few minutes, the installation process starts:

    During this step, you will be asked about the update policy. Personally, I recommend that you deactivate the automatic installation of updates. It is better when the administrator manages the installation of updates manually depending on the servers that are running on Ubuntu Server.

  11. One of the useful facilities that are given by the Ubuntu installer is the ability to choose to install server packages such as the SSH and DNS server. You can choose one of them by pressing the space bar, and you can continue the installation process by pressing the Enter key. In our case, we will decide not to install a server at this step. We will have a look at how to do this in a later chapter:

  12. Finally, you will be asked to confirm the installation of the GRUB boot loader to the Master Boot Recorder (MBR). Then, you will get the following notification at the end of the installation process:

Upgrading from an old release

In case you have an existing Ubuntu Server and you would like to upgrade it to the newest release, you can use the do-release-upgrade command. This command is a part of the update-manager-core package; it does not have any graphical dependencies and is installed by default.

You can check the options list associated with this command by running the following:

do-release-upgrade --help

You will find the following options very useful:

  • do-release-upgrade --check-dist-upgrade-only: The --check-dist-upgrade-only option checks for a new version. If a new version is found, it is displayed as a result in the terminal. Once executed, this command performs only a verification job; no upgrade is made.

  • do-release-upgrade --sandbox: The --sandbox option is used to test an upgrade in a protected environment. This is particularly useful if you wish to test the deployment of an upgrade prior to its application in the production environment.

  • do-release-upgrade: The do-release-upgrade tool researches and makes an upgrade to the next LTS or stable version available, if it exists.


The upgrade policy used by the do-release-upgrade tool is defined in the /etc/update-manager/release-upgrades file. The prompt variable at the end of the file indicates whether only the LTS versions will be considered or all the versions (the LTS ones as well as the regular ones) will be searched for when asking for an upgrade. The prompt variable can take as values lts for the LTS versions, normal for all versions, and never to never search for new versions.

You should only use the Prompt=lts mode when you are deploying a version of Ubuntu that is already an LTS. Otherwise, no new version will be detected by do-release-upgrade.