This tutorial shows the installation of a basic Ubuntu 20.04 LTS server in detail with many screenshots. The purpose of this guide is to show you the installation of Ubuntu 20.04 LTS which can be used as a basis for our other Ubuntu tutorials here on howtoforge like our perfect server guide. This tutorial uses an LTS branch that gets updates for 5 years from Ubuntu and is recommended for use on the server.
To install Ubuntu Server, you need the following prerequisites:
Ubuntu 20.04 ISO image server, available here: https://releases.ubuntu.com/20.04/ubuntu-20.04-live-server-amd64.iso (for Intel 64bit and AMD CPUs). Look here for other Ubuntu downloads: https://releases.ubuntu.com/20.04/
A fast internet connection is recommended when package updates are downloaded from the Ubuntu server during installation.
2. Introductory Notes
In this tutorial, I use hostname server1.example.com with the IP address 192.168.0.100 and gateway 192.168.0.1 This setting may be different for you, so you must change it if necessary.
3. Installing the Ubuntu Basic System 20.04
Insert the Ubuntu install CD / DVD / USB stick into your system and boot from it. When you install the OS on a virtual machine like I would do it here, then you should be able to choose an ISO file that is downloaded as a source for CD / DVD drives in VMWare and Virtualbox without having to burn it on a CD first. Start the server or virtual machine, it will boot the system and start the installer.
The first screen of the Ubuntu installer will display the language chooser. Please choose your language for the installation process:
On the next screen, you can choose the keyboard layout. English keyboard will be good for many users. In this case, select “Finish” at the end of the screen and press the “Back” button, to go to the next step. In my case, I’m using a German keyboard layout, this means I have to navigate to the “Layout” option by pressing the “Tab” button on my keyboard until the Layout option is highlighted. Then press the “Back” button to open the Layout selector.
Choose a keyboard layout that matches the keyboard attached to the server.
The exact keyboard layout for my installation is selected now. Select “Finish” at the end of the screen and press “Back”, to go to the next step.
The Ubuntu Installer now shows which network cards are detected on the server. The name of the network device that is automatically set is EN33. IPv4 addresses have been automatically assigned via DHCP. I will change it later to a fixed IP address when the base system has been installed. If your network does not have a DHCP server, then you can enter a fixed IP address now by selecting a network card (press Tab until it is highlighted and then press Back).
Now you can specify the proxy server address if a proxy is needed to access the internet. In my case, no proxy was needed, so I just chose “Finish” to go to the next installation step.
Here you can choose from where the Ubuntu mirror server updates and installation files must be downloaded. I will keep the default and go to the next installation screen.
The Ubuntu server installer now shows hard disks that have been detected on the server. The installation disk is 40GB HD on / dev / sda here. I would choose to use the entire disk for my Ubuntu installation. If you need a special layout consisting of several partitions, select “Custom Layout” and create the partition as needed.
The installer shows the default storage configuration below. It consists of a 1MB BIOS_grub partition plus one large / partition which will contain the operating system installation. Select “Finish” to proceed to the next screen.
Now it’s time to set the server name (hostname) and the administrator’s username and password. I will choose the username ‘administrator’ here only as an example, please use a different and safer name in your original settings. The Ubuntu shell user that we created in this step has sudo permission, this means that it can manage the system and become a root user through sudo.
Most Linux servers are managed over a network using SSH. In this step, the Ubuntu installer can install the SSH server directly. Select the “Install OpenSSH Server” checkbox and proceed to the next step.
In this step, you can pre-install services that are commonly used through the Snap installer. I did not choose any service here because the purpose of this guide is to install a minimal base system. You can install services via apt or snap at any time later.
Ubuntu installation completed successfully. Select “Reboot” to boot the server to the newly installed Ubuntu 20.04 system.
4. First login
Successfully logged into Ubuntu 20.04 Server.
5. Get root privileges
After rebooting, you can log in with the username previously created (e.g. Administrator). Because we have to run all the steps of this tutorial with root privileges, we can add all the commands in this tutorial with the sudo string, or we have root now by typing:
You can enable root login by running:
sudo passwd root
And give the password root. You can then log in directly as root, but this is liked 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 choose to install the OpenSSH server during the above system installation, you can do it now:
sudo apt-get -y install ssh openssh-server
From now on you can use SSH clients like Putty and connect from your workstation to your Ubuntu 20.04 (Focal Fosset) server.
7. Install a shell-based editor (Optional)
Here we will install two text-based editors. The Nano Editor is easier to use for beginners while others prefer the traditional vi / vim editor. The default vi program has some strange behavior on Ubuntu and Debian; to fix this, we installed vim-nox:
sudo 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 can change it now because the server must have a static IP address. If you want to maintain a DHCP-based network configuration, skip this chapter. On Ubuntu 20.04, the network is configured with Netplan and the configuration file is /etc/netplan/01-netcfg.yaml. The traditional network configuration file / etc / network / interfaces are no longer used. Edit /etc/netplan/00-installer-config.yaml and adjust it to your needs (in this sample setting I will use the IP address 192.168.0.100 and the DNS server 220.127.116.11, 18.104.22.168.
Open network configuration file with nano:
sudo nano /etc/netplan/00-installer-config.yaml
The server uses DHCP right after installation; the interface file will look like this:
# This is the network config written by 'subiquity' network: ethernets: ens33: dhcp4: true version: 2
To use a static IP address 192.168.0.100, I will change the file so that it looks like this afterwards:
# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: ens33: dhcp4: no dhcp6: no addresses: [192.168.0.100/24] gateway4: 192.168.0.1 nameservers: addresses: [22.214.171.124,126.96.36.199]
IMPORTANT: Indentation of important lines, add lines as shown above.
Then restart your network to apply changes:
sudo netplan generate sudo netplan apply
Then edit /etc/hosts.
sudo 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 our machine hostname as follows:
sudo echo server1 > /etc/hostname sudo hostname server1
The first command sets the hostname “server1” in the / etc / hostname file. This file is read by the system at boot. The second command sets the hostname in the current session so we don’t need to restart the server to implement the hostname.
As an alternative to the two commands above, you can use the hostname command which is part of the systemd package.
sudo hostnamectl set-hostname server1
After that, run:
hostname hostname -f
The first command returns a short hostname while the second command shows an eligible domain name (fqdn):
root@server1:/home/administrator# hostname server1 root@server1:/home/administrator# hostname -f server1.example.com root@server1:/home/administrator#
If you want to adjust the keyboard layout of the server, run this command:
sudo dpkg-reconfigure keyboard-configuration
Congratulations! Now we have 20.04 Ubuntu server base settings which provide a solid foundation for all types of Ubuntu Server settings.
9. Virtual Machine Image
This tutorial is available as a ready-to-use virtual machine in OVA / OVF format for Howtoforge customers. The VM format is compatible with VMWare and Virtualbox and other tools that can import ova or ovf formats. You can find the download link near the top menu near the top. Click on the file to start the download.
VM login details are:
Administrator user has sudo permission.
Please change the password after the first boot.
The VM is configured for a static IP 192.168.0.100, the IP can be changed in the /etc/netplan/00-installer-config.yaml file as shown in step tutorial 8. The VM keyboard layout that can be downloaded is AS. keyboard layout.