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 automated installation

Sometimes, we have a large number of servers to install. In this case, the manual installation will take a lot of time to perform a repetitive task. To solve this problem, there is the automation installation, or what we call the network boot.

For this, we need a machine equipped with a DHCP server and a TFTP server that will provide us the services and configuration files that we need for the system to be installed.

The PXE process

The client computer (our future server) will boot its network interface in the PXE (Preboot Execution Environment) mode. Then, the DHCP present on the network will send it the pxelinux.0 file; this will be explained later. Thus, the client computer accesses the pxelinux.cfg configuration file via TFTP, which contains the necessary information required to launch the installation process.

The PXE installation procedure

Let's start with the server installation:

  1. First of all, install the DHCP server by using the sudo apt-get install isc-dhcp-server -y command, and then configure it by using the /etc/default/isc-dhcp-server file to use the network that you want for listening (such as eth0).

    In the /etc/dhcp/dhcpd.conf file, you should configure some parameters such as the subnet and the address range. Then, restart it by using the following command:

    sudo service isc-dhcp-server restart
  2. After this, install the following packages that are necessary if you wish to set up the PXE environment:

    sudo apt-get install apache2 tftpd-hpa inetutils-inetd

    Now, it is time to configure the TFTP service. To do this, add the following two lines to the /etc/default/tftpd-hpa file:

    OPTIONS="-l -s /var/lib/tftpboot"

    Also, add the following line at the end of the /etc/inetd.conf file:

    tftp    dgram   udp    wait    root    /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

    Then, reboot the service using the sudo /etc/init.d/tftpd-hpa restart command.

  3. Now, we need to copy the installation files to the PXE server. In our example, I used the ISO image that I have in my home directory. First of all, mount it by using the following command:

    sudo mount loop /home/abdelmonam/ubuntu-15.04-server-amd64.iso /mnt

    Then, copy the required files to the server by using the following commands:

    cd /mnt
    sudo cp -fr install/netboot/* /var/lib/tftpboot/
    sudo mkdir /var/www/Ubuntu
    sudo cp -fr /mnt/* /var/www/ubuntu/

    After doing this, modify the /var/lib/tftpboot/pxelinux.cfg/default PXE config file by adding the following lines at the end:

    label linux
    kernel ubuntu-installer/amd64/linux
    append ks= vga=normal initrd=ubuntu-installer/amd64/initrd.gz
    ramdisk_size=16432 root=/dev/rd/0 rw  --

    Be careful when adding the IP address.

  4. The last step required to set up the PXE server is to add the following lines at the end of the /etc/dhcp/dhcpd.conf file:

    allow booting;
    allow bootp;
    option option-128 code 128 = string;
    option option-129 code 129 = text;
    filename "pxelinux.0";

    Then, reboot the DHCP server by using the following command:

    sudo service isc-dhcp-server restart

Let's move on to the client configuration. In our case, I used a virtualbox instance to test this kind of installation:

  1. Create the virtual machine with the characteristics that you want via the virtualbox manager.

  2. Then, go to the Settings of the machine and select the System tab. In the Boot Order part, deselect all options and select Network, as shown in the following screenshot:

  3. Select the Network tab and configure the network adaptor to act as a bridge.

  4. Finally, start your VM. You will see the following interface:

Enjoy watching the server installation if you were doing it locally from a CD.


The PXE installation can be used to install a lot of machines in parallel as well as to install Ubuntu Server on machines without a CD-ROM driver.

The installation process will be entirely automated if you combine the PXE method with a kickstart and/or preseed file. A good starting point for working with kickstart is

Additional resources

Since this book consists of the essentials for the Ubuntu Server, we can't cover topics in depth. Therefore, here are some useful links that will help you go as far as you want in this subject: