Initial Configuration of Ubuntu Server

Update your Ubuntu system

Before proceeding with any other configuration steps, it is necessary first update the entire system by inserting this in terminal:

sudo aptitude update
sudo aptitude upgrade

This updates the software list and upgrades installed packages.

Install necessary software

To facilitate the proper functioning of the system, it is essential to install additional software packages. For instance, a text editor such as nano, a package for managing compilations such as build-essential, a package for automatic updates such as unattended-upgrades, and others.

sudo aptitude install nano build-essential unattended-upgrades

Some of these packages can be installed from the Ubuntu Software Center.

Configure users

For the configuration of users, open the terminal and run the following commands:

sudo adduser user1
sudo usermod -aG sudo user1

The command “sudo adduser user1” adds a new user, while “sudo usermod -aG sudo user1” assigns the user to the administrator group.

Configure ssh

SSH server enables remote maintenance of the operating system through the internet. To configure ssh, simply run the following command:

sudo aptitude install openssh-server

By default, the SSH server does not grant access to any user. It is necessary to configure users, allowing them access through SSH keys.

Configure the firewall

The firewall is used to ensure the safety of your system. Ubuntu Server 22.04 comes with the built-in UFW (Uncomplicated Firewall). To configure the UFW rules, execute the following commands:

sudo ufw allow 22/tcp
sudo ufw enable

The first command permits incoming connections through the SSH protocol, while the second command activates the firewall.

Check system for vulnerabilities

To check your system for vulnerabilities, you may use several tools, including Lynis. To install Lynis, run this command:

sudo aptitude install lynis

To run Lynis, execute :

sudo lynis audit system

Lynis will analyze OS and provide a report of any vulnerabilities found.

System optimisation

Several actions may be taken to optimize Ubuntu-Server 22.04, including:
– Disabling any unused services.
– Optimizing kernel configuration.
– Setting optimal swap parameters.
– Optimizing network parameters.
These are just some of the steps that can be taken to optimize the performance of Ubuntu Server 22.04.
Security and performance optimization are crucial factors in the proper functioning of your Ubuntu Server 22.04.