How to install Webmin on RHEL 8 / CentOS 8

Webmin is web-based administrator’s tool that can manage many aspects of the system. After installation, we can manage our machine’s resources, the server applications running on it, set up cronjobs, just to name a few. It comes with it’s own http server, no additional container or webserver required. The rich function set is accessible trough a web interface, so all we need is a browser to manage our system remotely.

In this tutorial we will install Webmin on RHEL 8 / CentOS 8, add the necessary service file for easy management, and log in to the WUI (Web User Interface).

In this tutorial you will learn:

  • How to install Webmin from tarball
  • How to add and test systemd service file
  • How to access the web interface

Installed Webmin on RHEL 8

Installed Webmin on RHEL 8

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8 / CentOS 8
Software Webmin 1.900
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install webmin on Redhat 8 step by step instructions



The only thing needed by Webmin is some perl packages. We will work as the root user, and Webmin need to run as root, to be able to manage everything.

  1. To solve dependencies before installation, we can use dnf to install package Net::SSLeay as shown below:
    dnf install perl perl-Net-SSLeay

    The other needed module is Encode::Detect. We can install this module easily if we got cpan installed:

    cpan[1]> install "Encode::Detect"
    [...]
      JGMYERS/Encode-Detect-1.01.tar.gz
      ./Build install  -- OK

    After the module is installed successfully, we can exit cpan, we will not need it for now.

    cpan[2]> exit
  2. Next we download the tarball package of Webmin:
    # wget http://prdownloads.sourceforge.net/webadmin/webmin-1.900.tar.gz

    And extract it:

    # tar -xvf webmin-1.900.tar.gz

    Then enter the directory that is created in the process:

    # cd webmin-1.900/


  3. We invoke the setup script, and need to answer a few questions. The argument given here is the target directory where Webmin will be installed. This can be anything that is convenient. We’ll leave everything on the defaults for the purpose of this tutorial.
    # ./setup.sh /usr/local/webmin
    
    ***********************************************************************
    *            Welcome to the Webmin setup script, version 1.900        *
    ***********************************************************************
    Webmin is a web-based interface that allows Unix-like operating
    systems and common Unix services to be easily administered.
    
    Installing Webmin from /root/temp/webmin-1.900 to /usr/local/webmin ...
    
    ***********************************************************************
    Webmin uses separate directories for configuration files and log files.
    Unless you want to run multiple versions of Webmin at the same time
    you can just accept the defaults.
    
    Config file directory [/etc/webmin]: ENTER
    Log file directory [/var/webmin]: ENTER
    
    ***********************************************************************
    Webmin is written entirely in Perl. Please enter the full path to the
    Perl 5 interpreter on your system.
    
    Full path to perl (default /usr/bin/perl): ENTER
    
    Testing Perl ...
    Perl seems to be installed ok
    
    ***********************************************************************
    For Webmin to work properly, it needs to know which operating system
    type and version you are running. Please select your system type by
    entering the number next to it from the list below
    ---------------------------------------------------------------------------
      1) Pardus Linux           2) SmartOS                3) Sun Solaris          
      4) Lycoris Desktop/LX     5) Caldera OpenLinux eS   6) Caldera OpenLinux    
      7) Asianux Server         8) Asianux                9) Whitebox Linux       
     10) Tao Linux             11) CentOS Linux          12) Springdale Linux     
     13) Virtuozzo Linux       14) Scientific Linux      15) Gralinux             
     16) NeoShine Linux        17) Endian Firewall Linu  18) Oracle Enterprise Li 
     19) Oracle VM             20) XenServer Linux       21) CloudLinux           
     22) MostlyLinux           23) Cloudrouter Linux     24) Sangoma Linux        
     25) Redhat Enterprise Li  26) Redhat Linux Desktop  27) AlphaCore Linux      
     28) X/OS Linux            29) Haansoft Linux        30) cAos Linux           
     31) Wind River Linux      32) Amazon Linux          33) Redhat Linux         
     34) Fedora Linux          35) White Dwarf Linux     36) Slamd64 Linux        
     37) Slackware Linux       38) Xandros Linux         39) APLINUX              
     40) BigBlock              41) Ubuntu Linux          42) Mepis Linux          
     43) Devuan Linux          44) Raspbian Linux        45) Linux Mint           
     46) Debian Linux          47) SuSE OpenExchange Li  48) SuSE SLES Linux      
     49) SuSE Linux            50) United Linux          51) Corel Linux          
     52) TurboLinux            53) Cobalt Linux          54) Mandrake Linux Corpo 
     55) pclinuxos Linux       56) Mageia Linux          57) Mandrake Linux       
     58) Mandriva Linux        59) Mandriva Linux Enter  60) Conectiva Linux      
     61) ThizLinux Desktop     62) ThizServer            63) MSC Linux            
     64) SCI Linux             65) LinuxPPC              66) Trustix SE           
     67) Trustix               68) Tawie Server Linux    69) TinySofa Linux       
     70) Cendio LBS Linux      71) Ute Linux             72) Lanthan Linux        
     73) Yellow Dog Linux      74) Corvus Latinux        75) Immunix Linux        
     76) Gentoo Linux          77) Secure Linux          78) OpenNA Linux         
     79) SoL Linux             80) Coherent Technology   81) Playstation Linux    
     82) StartCom Linux        83) Yoper Linux           84) Caixa Magica         
     85) openmamba Linux       86) FreeBSD               87) DragonFly BSD        
     88) OpenBSD               89) NetBSD                90) BSDI                 
     91) HP/UX                 92) SGI Irix              93) DEC/Compaq OSF/1     
     94) IBM AIX               95) SCO UnixWare          96) SCO OpenServer       
     97) Mac OS X              98) Darwin                99) OpenDarwin           
     100) Cygwin                101) Sun Java Desktop Sys  102) Synology DSM         
     103) Generic Linux         104) Windows              
    ---------------------------------------------------------------------------
    Operating system: 25
    
    Please enter the version of Redhat Enterprise Linux you are running
    Version: 8
    
    Operating system name:    Redhat Enterprise Linux
    Operating system version: 8
    
    ***********************************************************************
    Webmin uses its own password protected web server to provide access
    to the administration programs. The setup script needs to know :
     - What port to run the web server on. There must not be another
       web server already using this port.
     - The login name required to access the web server.
     - The password required to access the web server.
     - If the webserver should use SSL (if your system supports it).
     - Whether to start webmin at boot time.
    
    Web server port (default 10000): ENTER
    Login name (default admin):  ENTER
    Login password: type secure password
    Password again: type secure password again
    Use SSL (y/n): n
    Webmin does not support being started at boot time on your system.
    ***********************************************************************
    Copying files to /usr/local/webmin ..
    ..done
    
    Creating web server config files..
    ..done
    
    Creating access control file..
    ..done
    
    Inserting path to perl into scripts..
    ..done
    
    Creating start and stop scripts..
    ..done
    
    Copying config files..
    ..done
    
    Creating uninstall script /etc/webmin/uninstall.sh ..
    ..done
    
    Changing ownership and permissions ..
    ..done
    
    Running postinstall scripts ..
    ..done
    
    Enabling background status collection ..
    ..done
    
    Attempting to start Webmin mini web server..
    Starting Webmin server in /usr/local/webmin
    Cron 15468873867543 missing any time spec
    ..done
    
    ***********************************************************************
    Webmin has been installed and started successfully. Use your web
    browser to go to
    
      http://rhel8lab.linuxconfig.org:10000/
    
    and login with the name and password you entered previously.

    Notice that RHEL 8 is too new for this version of Webmin, and so the automatic start at boot time is not yet supported. We will solve that with systemd.



  4. Before we can access the WUI, we need to open the port on the firewall we set Webmin to serve on, in this case the default, port 10000:
    # firewall-cmd --zone=public --add-port=10000/tcp --permanent
    success
    # firewall-cmd --reload
    success
  5. Next we create the service file called /etc/systemd/system/webmin.service with the following content:
    [Unit]
    Description=Webmin
    Requires=local-fs.target
    After=basic.target
    Conflicts=shutdown.target
    
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/etc/webmin/start
    ExecStop=/etc/webmin/stop
    ExecReload=/etc/webmin/reload
    
    [Install]
    WantedBy=multi-user.target

    We need to reload systemd, so it can see the changes:

    # systemctl daemon-reload

    Keep in mind that the setup script executed in the previous step also started the Webmin service, which is not in the realm of systemd at the moment.

  6. We’ll stop the server with it’s own script by entering the /etc/webmin directory, and executing the stop script generated by the setup:
    # ./stop 
    Stopping Webmin server in /usr/local/webmin
  7. Now we can safely manage the service with systemd:
    # systemctl start webmin

    And check it’s status:

    # systemctl status webmin
      webmin.service - Webmin
       Loaded: loaded (/etc/systemd/system/webmin.service; disabled; vendor preset: disabled)
       Active: active (exited) since Mon 2019-01-07 20:31:31 CET; 45min ago
      Process: 16004 ExecStart=/etc/webmin/start (code=exited, status=0/SUCCESS)
     Main PID: 16004 (code=exited, status=0/SUCCESS)
        Tasks: 0 (limit: 12544)
       Memory: 2.3M
       CGroup: /system.slice/webmin.service


  8. We can add the missing autostart on boot by enabling the systemd service:
    # systemctl enable webmin
    Created symlink /etc/systemd/system/multi-user.target.wants/webmin.service -> /etc/systemd/system/webmin.service.
  9. And access this rich tool from a browser, by entering http://<name-or-ip-address-of-the-machine>:10000 to the address bar of the browser.
    Login page of Webmin.

    Login page of Webmin.

    We need to provide the admin username and password we specified during setup, and we can start using our new management interface.