Ubuntu Server 22.04 is the latest release of the popular Linux distribution for servers. In this article, we will discuss the initial configuration steps for Ubuntu Server 22.04 that can help ensure security and optimize the performance of your 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 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.
Some of these packages can be installed from the Ubuntu Software Center.
For the configuration of users, open the terminal and run the following commands:
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.
SSH server enables remote maintenance of the operating system through the internet. To configure ssh, simply run the following command:
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 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:
To run Lynis, execute :
Lynis will analyze OS and provide a report of any vulnerabilities found.
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.
In this guide we deploy and setup new server based on Ubuntu server 22.04, include remote shell setup,OS update, firewall setup and vulnerabilities scan.