Webmin is an essential tool for Linux system administrators, allowing them to manage and configure their systems through a user-friendly web interface. In this tutorial, we will guide you through the process of installing Webmin on Rocky Linux 8 and securing it with Let’s Encrypt SSL. By the end of this guide, you will have a fully functional Webmin installation with enhanced security.
Prerequisites
Before we begin, make sure you have the following prerequisites in place:
- A server running Rocky Linux 8.
- A valid domain name pointed to your server’s IP address.
- The root password configured on your server.
Step 1: Install Webmin
To install Webmin, we first need to install Perl, as Webmin is written in Perl. Run the following command to install Perl:
dnf install perl -y
Next, download the latest version of Webmin tarball using the following command:
wget https://www.webmin.com/download/webmin-current.tar.gz
Once the Webmin tarball is downloaded, extract it with the following command:
tar xvf webmin-current.tar.gz
Now, create a directory to install Webmin and run the installation script:
mkdir -p /usr/local/webmin ./webmin-1.984/setup.sh /usr/local/webmin/
During the installation, you will be prompted to provide the path of the configuration directory, admin username, and password. Follow the prompts and complete the installation.
Step 2: Configure Nginx as a Reverse Proxy for Webmin
It is recommended to use Nginx as a reverse proxy for Webmin to enhance security and improve performance. To install Nginx, run the following command:
dnf install nginx -y
Once installed, create an Nginx virtual host configuration file for Webmin:
nano /etc/nginx/conf.d/webmin.conf
Add the following lines to the file:
server { listen 80; server_name your_domain.com; # Replace with your domain name access_log /var/log/nginx/webmin.access; error_log /var/log/nginx/webmin.error; location / { proxy_pass http://127.0.0.1:10000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
Save and close the file. Verify the Nginx configuration for any syntax errors:
nginx -t
If there are no errors, start the Nginx service and enable it to start at system boot:
systemctl start nginx systemctl enable nginx
Step 3: Enable SSL on Webmin with Let’s Encrypt
To secure your Webmin installation with Let’s Encrypt SSL, you need to install the Certbot client. Run the following commands to install Certbot on Rocky Linux 8:
dnf install epel-release -y dnf install certbot-nginx -y
Once Certbot is installed, run the following command to obtain and install the Let’s Encrypt SSL certificate for your Webmin domain:
certbot --nginx -d your_domain.com # Replacewith your domain name
Follow the prompts to provide your valid email address and accept the terms of service. Certbot will automatically configure Nginx to use the SSL certificate.
Step 4: Configure Webmin
To configure Webmin, you need to edit the Webmin configuration file. Open the file using the following command:
nano /etc/webmin/config
Add the following line to the file, replacing “your_domain.com” with your actual domain:
referers=your_domain.com
Save and close the file. Next, edit the miniserv.conf file:
nano /etc/webmin/miniserv.conf
Add the following lines to the file:
ssl=0 allow=127.0.0.1
Save and close the file.
Now, you need to restart Webmin. First, find the Webmin process ID:
ps -ef | grep webmin
Note the process ID and use the following command to kill the Webmin process:
kill -9 process_id # Replace "process_id" with the actual process ID
Start Webmin using systemd and enable it to start at system boot:
systemctl start webmin systemctl enable webmin
Step 5: Configure the Firewall
If you have the firewalld firewall installed, you need to allow ports 80 and 443 through the firewall. Run the following commands to allow these ports:
firewall-cmd --add-port=80/tcp --permanent firewall-cmd --add-port=443/tcp --permanent
Finally, reload the firewall service to apply the changes:
firewall-cmd --reload
Step 6: Access the Webmin Interface
Now that Webmin is installed and configured, you can access the Webmin interface through your web browser. Open your browser and enter the URL:
https://your_domain.com:10000
Replace “your_domain.com” with your actual domain. You will be redirected to the Webmin login page.
Enter your admin username and password, and click on the “Login” button. You should now see the Webmin dashboard, where you can start managing your Linux system through the web interface.
Conclusion
Congratulations! You have successfully installed Webmin with Let’s Encrypt SSL on Rocky Linux 8. With Webmin, you can easily manage and configure your Linux system using a user-friendly web interface. By securing Webmin with SSL, you ensure that your connections to the interface are encrypted and secure.
If you’re looking for reliable and scalable cloud hosting solutions, consider Shape.host. They offer Linux SSD VPS hosting with top-notch performance and excellent customer support. Explore their services today and take your web hosting to the next level.