Ubuntu Server 22.04 LTS (Jammy Jellyfish) is the latest long-term support release of the popular Linux distribution, widely used for web hosting, cloud computing, and enterprise-level infrastructure. In this comprehensive guide, we’ll walk you through the essential initial configuration steps for Ubuntu Server 22.04, focusing on server security, network settings, firewall configuration, and performance tuning. Whether you're deploying a web server, database server, or application stack, these best practices will help you build a stable, secure, and high-performing Ubuntu Server environment right from the start.
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.
Configure users
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.
Configure ssh
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.
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.
Conclusion
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
Frequently Asked Questions (FAQ)
- What are the first steps after installing Ubuntu Server 22.04?
After installing Ubuntu Server 22.04 LTS, you should immediately update your system packages, configure a firewall using UFW, set up a non-root user with sudo privileges, and install essential software like nano, build-essential, and unattended-upgrades. - How do I enable SSH access on Ubuntu Server?
Install the OpenSSH server using sudo aptitude install openssh-server, then configure SSH key-based access for your user to enhance security. - Is Ubuntu Server 22.04 secure by default?
Ubuntu Server includes several built-in security features, but it's recommended to harden your server by enabling a firewall, disabling unused services, and running a vulnerability scan using tools like Lynis. - Can I optimize the performance of my server?
Yes. Performance tuning includes disabling unnecessary services, adjusting kernel parameters, optimizing swap usage, and tweaking network settings to better suit your workload. - How can I check for security vulnerabilities on my Ubuntu Server?
You can use Lynis, a powerful auditing tool, to scan your system and receive a detailed report on potential vulnerabilities and suggested hardening steps.