There is a new revision of this tutorial available for Ubuntu 16.04 (Xenial Xerus).

How to install a Ubuntu 16.04 (Xenial Xerus) Minimal Server - Page 2

Please check if the installer detected your time zone correctly. If so, select Yes, otherwise No:

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 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 iare 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:

sudo -s

(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 8.8.4.4, 8.8.8.8 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):

man resolvconf

Open the network configuration file with nano:

nano /etc/network/interfaces

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 8.8.8.8 8.8.4.4

Then restart your network to apply the changes:

service networking restart

Then edit /etc/hosts.

nano /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

Afterward, run:

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 Howtoforge 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:

SSH Login

Username: administrator
Password: howtoforge

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.

Ubuntu: http://www.ubuntu.com/

Share this page:

0 Comment(s)

Add comment

Comments

From: Till Brehm