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
After ssh is installed it then needs to be enabled by running the following command:
sudo systemctl enable --now ssh
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:
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:
Click Yes to trust the server:
Log in with username ubuntu:
And the new password that we changed on the first login:
Now we are connected to the server via ssh and con configure it without having to physically connect to its console any more.
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
The hostname gile will contain the server’s name:
Delete the current name and add the required name:
Save the file and then reboot the server for it to pick up its new name:
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
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
If your server is set to dhcp then you will see something like:
Edit the file to look something like:
Save the file.
Apply the changes:
sudo netplan apply
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:
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
Reload netplan:
sudo netplan apply
The server will now be configured for dhcp and should have its old ip address again:
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
This will then install all of the updates:
Once the updates have been installed the installer will go back to the command prompt:
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:
It should show that there are 0 updates to install:
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.
Thanks a lot for the clear instructions