As you get your new Ubuntu server ready, there are certain initial configurations that you must do. These configurations will add initial level of security and will setup a solid foundation for your web server. After Initial Ubuntu Server Configuration for Nginx, you can Configure Nginx, MariaDB, PHP 8.1 (LEMP Stack) which you can use to host your website or web application.

In this Tutorial
What is Root?
Root is a default user in Linux operating system. It has highly elevated privileges and thus it is advised not to use it on a regular basis. Because of the elevated privileges, root user can run any commands and thus it may be destructive.
Why Initial Configuration of Server is Important?
When you get a VPS, its just barebone and its very easy for anyone to get its access. This is the reaosn why it is very important to do a basic setup of firewall and sudo user. Firewall will block unwanted requests to your server. You can even configure it to safeguard your server from DDOS attack as well as any other kind of unauthorised access.
Having a sudo user is very important when you are working on Linux. as explained above, root user comes with high privileges and with one wrong command you may end up destroying your server. Hence, we recommend you to always operate Linux with sudo user only. Many commands and files are restricted for sudo user, which adds a layer of protection for your server.
Initial Ubuntu Server Configuration
In this tutorial, we will perform the following steps
Step 1 – Login to your server as “root”
As its a new server, the first thing that you will have to do is login as “root” user. If you have opted for private key, you will have to first install the SSH key. If you didn’t, then you can just use putty tool, enter your server’s IP under “host name” and enter “22” under “port” and click “open”. Click on “Accept” in the dialog box appeared.
Now you will see a black window with “login as”.
- Type “root” and hit “Enter” key
- Type your root password (password that you have entered at the time of creating the server)
Hurrey! you have successfully logged in to your server. Now lets proceed further.
Step 2 – Create a new user
After creating new user, we will always login using this new user only
# adduser jack
You can replace “jack” with whatever name you like. Hit “Enter”, and this command will create a new username named jack and will ask you for a new password. Make sure to enter a strong password. Next the system will ask some questions that you can fill as per your wish.
Setp 2 – Assigning administrative privileges
Now that you have a new regular user, we will have to assign administrative privileges to the user so that the user can perform various administrative tasks just by putting “sudo” infront of the command. we also have to add the user to the “system group” because in ubuntu, members of “system group” can run commands using “sudo” by default.
# usermod -aG sudo jack
This command will add user to “system group” and assign administrative privileges as well.
Step 3 – Setting up a firewall
Ubuntu uses UFW firewall. Configuring ufw firewall will ensure that only allowed connections will be able to communicate with the server. This will add a solid layer of security for the server.
OpenSSH is the service that allows you to connect your ubuntu server remotely. Given below command will examine the installed profiles.
# ufw app list
Output
Available applications:
OpenSSH
Now the first thing that you have to do is to ensure that you can connect to your ubuntu server without any issue. So you must allow OpenSSH profile in the firewall using the command given below
# ufw allow OpenSSH
Now type the below command to enable the firewall
# ufw enable
Type “y” and hit “Enter” key
Now cross check whether you have done the right configuration
# ufw status
Output
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Congratulations, you have just configured your firewall that is allowing only the OpenSSH connections and denying all the others.
Conclusion
We recommend you to always perform the initial setup before starting the configuration as it sets up a solid base for your server. With this, you have successfully completed your Ubuntu server’s initial configuration. Now you can go ahead and install the applications that you wish to.
Leave a Reply