Kiến Thức Linux Linux Nâng Cao

How to install Webmin and secure it with Let’s Encrypt SSL on Ubuntu 20.04 LTS

Webmin

Webmin is a free, open-source, and web-based application used for managing Linux-based systems. It has a powerful and easy to use web interface that allows you to manage all kind of services and configuration settings on the system. It is very difficult for any Linux beginner user to edit the configuration file, set up web server, FTP server, run commands, install packages or manage email forwarding. With Webmin, you can perform these tasks through an easy-to-use web interface.

With Webmin, you can administrate most parts of your Linux system including, set up user accounts, disk quotas, install, remove and update packages, change the system IP address, setup firewall, manage database, set up web servers, and many more.

In this tutorial, we will show you how to install Webmin and secure it with Let’s Encrypt SSL on Ubuntu 20.04 server.

Prerequisites

  • A server running Ubuntu 20.04.
  • A valid domain name pointed with your server.
  • A root password is configured on your server.

Update the System Packages

Before starting, it is recommended to update your system packages to the latest version. You can do it with the following command:

apt-get update -y
apt-get upgrade -y

Once your system is updated, restart it to implement the changes.

Install Webmin

By default, Webmin is not available in the Ubuntu standard repository. So you will need to add Webmin repository in your system.

First, install required packages with the following command:

apt-get install software-properties-common apt-transport-https wget -y

Once all the packages are installed, import the Webmin GPG key with the following command:

wget -q http://www.webmin.com/jcameron-key.asc -O- | apt-key add -

Next, add the Webmin repository to your system with the following command:

add-apt-repository "deb [arch=amd64] http://download.webmin.com/download/repository sarge contrib"

Once the repository is added, install the Webmin by running the following command:

apt-get install webmin -y

Once the installation has been completed successfully, you should get the following output:

Webmin install complete. You can now login to https://webmin.linuxbuz.com:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.
Processing triggers for systemd (245.4-4ubuntu3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for mime-support (3.64ubuntu1) ...

You can also verify the status of Webmin service with the following command:

systemctl status webmin

You should see the following output:

? webmin.service - LSB: web-based administration interface for Unix systems
     Loaded: loaded (/etc/init.d/webmin; generated)
     Active: active (running) since Wed 2020-06-24 06:06:13 UTC; 3min 50s ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 3 (limit: 2353)
     Memory: 29.4M
     CGroup: /system.slice/webmin.service
             ?? 9393 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
             ??10196 gpg-agent --homedir /root/.gnupg --use-standard-socket --daemon

Jun 24 06:06:11 ubuntu20 systemd[1]: Starting LSB: web-based administration interface for Unix systems...
Jun 24 06:06:11 ubuntu20 perl[9378]: pam_unix(webmin:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=  user=root
Jun 24 06:06:13 ubuntu20 webmin[9378]: Webmin starting
Jun 24 06:06:13 ubuntu20 systemd[1]: Started LSB: web-based administration interface for Unix systems.
Jun 24 06:08:52 ubuntu20 perl[9977]: pam_unix(webmin:session): session opened for user root by (uid=0)
Jun 24 06:08:52 ubuntu20 webmin[9977]: Successful login as root from 27.61.157.164

You can also stop the Webmin service using the following command:

systemctl stop webmin

At this point, Webmin is installed and listening on port 10000.

Access Webmin Web UI

Now, open your web browser and type the URL https://your-ip-address:10000. You should see the message about the untrusted SSL certificate. Because Webmin uses an untrusted self-signed SSL certificate:

 

Ignore the above message and click on the proceed to your-ip (unsafe). You should see the Webmin login page:

Provide your root username, password and click on the Sign in button. You should see the Webmin dashboard in the following screen:

Working with Webmin

You can now perform several things on your Linux system. In this section, we will show you how to update packages, install git and create a new user with Webmin web interface.

Install and Update Packages

You can install your desired package and update all packages using the Webmin web interface.

For example, if you want to install a Git package, click on the Systems => Software packages. You should see the following screen:

Now, select “Package from APT“, type git, and click on the Install button. You should see the list of all packages related to git in the following screen:

Now, click on the Install Now button to install the Git in your system. Once the installation has been completed, you should see the following screen:

If you want to update the packages, click on the System => Software Package Updates. You should see the following screen:

Now, select package that you want to update and click on the Update Selected Packages button.

Create and Manage Users

Webmin also allows you to create, edit and delete user accounts on your system.

To create a new user, click on the System => Users and Groups. You should see the following screen:

Click on the Create a new user button. You should see the Create User screen:

Provide your username, Select Automatic for User ID, Provide your Real Name, For Home Directory, select Automatic, Select Normal Password and type your desired password then click on the Create button to create a new user.

Secure Webmin with Let’s Encrypt SSL

By default, Webmin is configured to use a self-signed certificate. So it is recommended to secure Webmin with a trusted SSL certificate.

Before starting, you will need to install Apache in your system. You can install it with the following command:

apt-get install apache2 -y

Once the Apache webserver is installed. Start the Apache service and enable it to start at system reboot with the following command:

systemctl start apache2
systemctl enable apache2

You can verify the status of Apache service using the following command:

systemctl status apache2

You should get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2020-06-24 06:12:46 UTC; 12min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 86885 (apache2)
      Tasks: 10 (limit: 4691)
     Memory: 55.4M
     CGroup: /system.slice/apache2.service
             ??86885 /usr/sbin/apache2 -k start
             ??87934 /usr/sbin/apache2 -k start
             ??87935 /usr/sbin/apache2 -k start
             ??87936 /usr/sbin/apache2 -k start
             ??87937 /usr/sbin/apache2 -k start
             ??87938 /usr/sbin/apache2 -k start
             ??87944 /usr/sbin/apache2 -k start
             ??87945 /usr/sbin/apache2 -k start
             ??87946 /usr/sbin/apache2 -k start
             ??87947 /usr/sbin/apache2 -k start

Jun 24 06:06:11 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...

Next, Login to your Webmin web interface. You should see the following screen:

Now, click on your server’s hostname. You should see the Hostname and DNS Client screen in the  following page:

Provide your fully qualified Domain Name into hostname field and click on Save button to save the changes you have made.

Next, click on the Webmin => Webmin Configuration. You should see the following screen:

Now, click on the SSL Encryption. You should see the following screen:

Click on the Let’s Encrypt Tab, Provide your domain name in Hostnames field, Provide your website root directory in Other directory fields, and click on the Request Certificate button to install the certificate.

If you want to see your current certificate details, click on the Webmin => Webmin Configuration and click on the Current Certificate tab. You should see your Let’s Encrypt SSL certificate in the following screen:

Now, logout from your Webmin interface and log in again using the secure URL https://webmin.linuxbuz.com.

Conclusion

In the above tutorial, you learned how to install Webmin on Ubuntu 20.04. You also learned how to update packages, create a user, and secure Webmin with Let’s Encrypt SSL. You can now easily manage your Linux system through the Webmin web interface. For more information about how to use Webmin, visit the Webmin documentation. Feel free to ask me if you have any questions.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Tags

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !