
Initial Server Setup for Ubuntu 22.04 guide
Ubuntu 22.04 is the latest LTS (Long Term Support) release of the popular Linux operating system. If you’re planning to host a website or run a server using Ubuntu 22.04, it’s essential to properly set up your server to ensure its security and optimal performance. In this guide, we’ll go through the initial server setup for Ubuntu 22.04, which includes securing your server, setting up a user account, and configuring basic system settings.
Update the System Packages
The first step is to update the system packages to ensure that your server has the latest security patches and bug fixes. Run the following command to update the package lists:
sudo apt update
Once the package lists are updated, run the following command to upgrade the packages:
sudo apt upgrade
Secure Your Server
The second step is to secure your server by setting up a firewall and disabling root login. Ubuntu 22.04 comes with the UFW (Uncomplicated Firewall) firewall installed by default. Run the following command to enable the UFW firewall:
sudo ufw enable
Once the firewall is enabled, run the following command to allow SSH traffic:
sudo ufw allow ssh
Next, disable root login by editing the SSH configuration file. Run the following command to open the file in the nano text editor:
sudo nano /etc/ssh/sshd_config
Find the line that reads PermitRootLogin yes and change it to PermitRootLogin no. Save and exit the file by pressing CTRL+X, then Y, and then ENTER.
Create a New User
The next step is to create a new user account with sudo privileges. This user will be used to perform administrative tasks on the server. Run the following command to create a new user:
sudo adduser username
Replace “username” with the name of the user you want to create. Follow the prompts to set a password and other user details.
Next, add the new user to the sudo group by running the following command:
sudo usermod -aG sudo username
Configure Timezone and Locale
The last step is to configure the timezone and locale settings. Run the following command to configure the timezone:
sudo timedatectl set-timezone timezone
Replace “timezone” with the name of your timezone, such as “America/New_York”.
Next, configure the locale by running the following command:
sudo update-locale LANG=en_US.UTF-8
Replace “en_US.UTF-8” with the appropriate locale for your location.
Conclusion
In this guide, we’ve gone through the initial server setup for Ubuntu 22.04. By following these steps, you can ensure that your server is secure, properly configured, and ready to host websites or run applications.