Rocky and Alma Linux setup are almost the same and so is the configuration. Here in this guide, we will do some initial Rocky or Alma Linux server setup that will add a solid foundation as well as it will also add a good layer of security.
Prerequisite
- You must have a Rocky or Alma Linux server installed
- Root user and password ready
Step 1 – Login as root
1. Open the “putty” SSH tool, and enter your “server’s public IP address” in the Host Name field. Enter “22” in port and click on “Open“.
2. If it shows you any kind of warning, click on “accept”.
3. Enter “root” in place of username and hit “Enter”
4. Enter the “password” and hit “Enter“
Step 2 – Creating a new user
The first thing that we will do is, we will create a user so that we can perform further actions.
$ adduser ashish
Step 3 – Assigning “sudo” privileges to the new user
Execute the below command to create a new user “ashish”
$ usermod -aG wheel ashish
1. Set password for new user
$ passwd ashish
Note: Enter the password of your choice. Make sure to enter a strong password.
Step 3 – Installing and setting up firewall
Rocky and Alma Linux works best with “Firewalld” as the firewall. Hence, we will install the same for our setup
$ dnf install firewalld -y
The above command will install Firewalld on your server.
Step 4 – Start, enable and setup firewall
Execute the following commands to start and enable the firewall
$ systemctl start firewalld
$ systemctl enable firewalld
“OpenSSH” is enabled by default in the firewall so we will add “http” and “https” in the firewall so that our server can accept on both “http” and “https” requests.
Step 5 – Allow http and https in firewall
Execute the given below commands one by one to allow http and https through the firewall
$ firewall-cmd --permanent --add-service=http
$ firewall-cmd --permanent --add-service=https
Reload the firewall to apply new rules
$ firewall-cmd --reload
That’s it, you have your server with a solid foundation.