ubuntu logo

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Spread the love

Here are the things that I always install for my Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server.

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server:

Enable ssh to allow remote access to the server:

The first thing that I always set up on a newly installed Ubuntu server 20.04 install is ssh so that the server can be connected to remotely. For more information on ssh go to the ssh website.

The installation of ssh server on ubuntu 20.04 is very easy and consists of 2 commands:

First of all install ssh with the following command:

sudo apt install ssh
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server 1

After ssh is installed it then needs to be enabled by running the following command:

sudo systemctl enable --now ssh
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server 2

Ssh access is now setup, Before we can connect to the server remotely we need to find out its ip address by running the following command:

ip a

This will display the servers ip address:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server 3

As you can see from the image above my server currently has an ip of 192.168.0.75 so I can now use this IP to connect to it remotely using ssh:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Click Yes to trust the server:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Log in with username ubuntu:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

And the new password that we changed on the first login:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Now we are connected to the server via ssh and con configure it without having to physically connect to its console any more.

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Set Server name.

At the moment our server name is ubuntu. This is fine if it will be your only ubuntu server but I have a number (growing all the time) of ubuntu servers so I want to give the server a new name which will describe it clearly so that I can identify the server easily,

This is a simple process too:

With the text editor of you choice edit (my editor of choice is vim) sdit the following file.

sudo vim /etc/hostname
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

The hostname gile will contain the server’s name:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Delete the current name and add the required name:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Save the file and then reboot the server for it to pick up its new name:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Set a static IP address:

I prefer to set a static ip dynamically using my dhcp server but if you prefer to add a static IP address then this can easily be done using the following process:

Find the correct interface name:

Open a terminal and run the following command:

ip a
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

In the example above the network card is eth0 as it is the only interface with an ip address.

Backup the networking file

It is a good idea to back up the networking file before you make any changes so that it can be quickly reverted if things go wrong. Run the following command to make a backup copy of the file:

sudo cp /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak

This will create a file called 00-installer-config.yaml.bak in the /etc/netplan/ folder in case you need it.

Edit the 00-installer-config.yaml file to set the static IP Address

Edit the 00-installer-config.yaml file in your desired editor

vim /etc/netplan/50-cloud-init.yaml
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

If your server is set to dhcp then you will see something like:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Edit the file to look something like:

Save the file.

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Apply the changes:

sudo netplan apply
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

The server will then be using the new address. If you were connected via ssh you will have to open a new session and connect to the NEW IP ADDRESS:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

The server will now use this address every time it is rebooted from now on.

To revert the changes you just need to do the following:

Over write the edited file with the backup file:

sudo cp /etc/netplan/50-cloud-init.yaml.bak /etc/netplan/50-cloud-init.yaml
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Reload netplan:

sudo netplan apply
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

The server will now be configured for dhcp and should have its old ip address again:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Install Software Updates:

It is a good idea to make sure that all of the updates that have been released since the iso used for installation are installed before you start installing and configuring software on the server. This is a simple process that can be done by running one command:

sudo apt-get update && sudo apt-get upgrade -y
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

This will then install all of the updates:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server
Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

Once the updates have been installed the installer will go back to the command prompt:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

It is always a good idea to reboot the server and to try and run the installer again just to make sure that all updates have been installed:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

It should show that there are 0 updates to install:

Initial Ubuntu Server 20.04 setup on a freshly installed Ubuntu 20.04 server

The server is now ready to install what ever software that you would like to install. For some ideas of what to install go to our Ubuntu Section of the site.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top