To install a Ubuntu LTS Server, you will need the following prerequisites:
- The Ubuntu 16.04 server CD, available here: http://releases.ubuntu.com/xenial/ubuntu-16.04.3-server-i386.iso (32Bit) or http://releases.ubuntu.com/xenial/ubuntu-16.04.3-server-amd64.iso (64Bit).
- A fast internet connection is recommended as the package updates get downloaded from Ubuntu servers during installation.
2. Preliminary Note
In this tutorial, I use the hostname server1.example.com with the IP address 192.168.1.100 and the gateway 192.168.1.1 These settings might differ for you, so you have to replace them where appropriate.
3. The Base System
Insert your Ubuntu install CD into your system and boot from it. When you install the OS in a virtual machine like I do it here, then you should be able to select the downloaded ISO file as source for the CD/DVD drive in VMWare and Virtualbox without burning it on CD first.
The first screen will show the language selector. Plese select your language:
Then choose the option Install Ubuntu Server:
Select the language for the installed Operating System:
Then choose your location. The location settings are important for the keyboard layout, locale and timezone of your server:
Choose a keyboard layout: You have the option to let the Ubuntu installer detect the keyboard layout automatically by choosing “yes” here. I prefer to select the right keyboard from a list and therefore, I choose No & keyboard layout as German:
The installer checks the installation CD, your hardware, and configures the network with DHCP if there is a DHCP server in the network:
Enter the hostname of the system. In this example, my server is named server1.example.com, so I enter server1.example.com:
Ubuntu does not let you log in as root user directly. Therefore, we create a new system user here for the initial login. I will create a user with the name Administrator and user name administrator (don’t use the user name admin as it is a reserved name on Ubuntu Linux):
Choose a password
I don’t need an encrypted private directory, so I choose No here:
Please check if the installer detected your time zone correctly. If so, select Yes,
Now you have to partition your hard disk. For simplicity’s sake I select Guided – use entire disk and set up LVM – this will create one volume group with two logical volumes, one for the / file system and another one for swap (of course, the partitioning is totally up to you – if you know what you’re doing, you can also set up your partitions manually).
Select the disk that you want to partition:
When you’re asked to Write the changes to disks and configure LVM?, select Yes:
If you have selected Guided – use entire disk and set up LVM, the partitioner will create one big volume group that uses all the disk space. You can now specify how much of that disk space should be used by the logical volumes for / and swap. It makes sense to leave some space unused so that you can later on expand your existing logical volumes or create new ones – this gives you more flexibility.
When you’re finished, hit Yes when you’re asked Write the changes to disks?:
Afterward, your new partitions are being created and formatted.
Then the base system is being installed. This will take a few minutes.
Now the package manager “apt” gets configured. Leave the HTTP proxy line empty unless you’re using a proxy server to connect to the Internet:
I like to update my servers automatically. Therefore, I select Install Security Updates automatically.
Of course, it’s up to you what you select here:
The only items I select here are OpenSSH server and Standard System Utilities so that I can immediately connect to the system with an SSH client such as PuTTY after the installation has finished:
The installation continues:
Select Yes when you are asked Install the GRUB boot loader to the master boot record?:
The installer now finished the Ubuntu installation.
The base system installation is now finished. Remove the installation CD from the CD drive and hit Continue to reboot the system:
The base installation is finished now. In the next chapter, I will explain the configuration of the static network address and install a shell based text editor for editing configuration files.
4. First Login
Now Login on the shell (or remotely by SSH) on the server as user “administrator”. The username may differ if you have chosen a different name during setup.
5. Get root Privileges
After the reboot, you can log in with your previously created username (e.g. administrator). Because we must run all the steps from this tutorial with root privileges, we can either prepend all commands in this tutorial with the string sudo, or we become root right now by typing:
(You can as well enable the root login by running)
sudo passwd root
And giving root a password. You can then directly log in as root, but this is frowned upon by the Ubuntu developers and community for various reasons. See https://help.ubuntu.com/community/RootSudo.)
6. Install the SSH Server (Optional)
If you did not select to install the OpenSSH server during the system installation above, you could do it now:
apt-get install ssh openssh-server
From now on you can use an SSH client such as PuTTY and connect from your workstation to your Ubuntu 16.04 (Xenial Xerus) server.
7. Install a shell based editor (Optional)
Here we will install two text based editors. The Nano editor is easier to use for newbies while others prefer the traditional vi/vim editor. The default vi program has some strange behavior on Ubuntu and Debian; to fix this, we install vim-nox:
apt-get -y install nano vim-nox
8. Configure the Network
Because the Ubuntu installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. If you want to keep the DHCP based network configuration, then skip this chapter. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.1.100 and the DNS servers 220.127.116.11, 18.104.22.168 starting with Ubuntu 12.04, you cannot edit /etc/resolv.conf directly anymore, but have to specify your nameservers in your network configuration – see for more details):
Open the network configuration file with nano:
The server is using DHCP right after the install; the interfaces file will look like this:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens33 iface ens33 inet dhcp
To use a static IP address 192.168.1.100, I will change the file so that it looks like this afterward:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens33 iface ens33 inet static address 192.168.1.100 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-nameservers 22.214.171.124 126.96.36.199
Then restart your network to apply the changes:
service networking restart
Then edit /etc/hosts.
Make it look like this:
127.0.0.1 localhost 192.168.1.100 server1.example.com server1 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
Now, we will change the hostname of our machine as follows:
echo server1 > /etc/hostname service hostname start
hostname hostname -f
The first command returns the short hostname while the second command shows the fully qualified domain name (fqdn):
[email protected]:/home/administrator# hostname server1 [email protected]:/home/administrator# hostname -f server1.example.com [email protected]:/home/administrator#
Congratulations! Now we have a basic Ubuntu 16.04 server setup that provides a solid basis for all kind of Ubuntu Server setups.
9. Virtual Machine image
This tutorial is available as ready to use virtual machine in OVA / OVF format for hostiger subscribers. The VM format is compatible with VMWare and Virtualbox and other tools that can import the ova or ovf format. You can find the download link in the right menu on the top. Click on the filename to start the download.
The login details of the VM are:
The administrator user has sudo permissions.
Please change the passwords after the first boot.
The VM is configured for the static IP 192.168.1.100, the IP can be changed in the file /etc/network/interfaces as shown in the tutorial step 8.