Webmin CentOS Install for Easier VPS Management

Manage a CentOS VPS Using Webmin for System Administration

A Virtual Private Server (VPS) is a cost effective way to host web and cloud based solutions or high volume web sites. A VPS provides more resources (memory, processing power and disk space) than shared hosting without the cost of leasing dedicated hardware (although a VPS will not be as powerful as a dedicated machine). Some VPS packages only provide a minimal Linux system. Access to that minimal system is usually via a secure shell (SSH). Managing a Linux system remotely over SSH can be cumbersome. To make the system administration easier a web based management tool is useful. A commercial tool such as cPanel is often provided at extra cost. Open source alternatives like ZPanel and Webmin are available. In this tutorial article the Webmin system administration tool will be installed on a CentOS based VPS. CentOS, based on a Red Hat Linux distribution, is commonly available for VPS packages. This article assumes that the minimal installation of CentOS is used for the VPS operating system. The minimal CentOS does not have the desktop environment installed. The steps for the Webmin CentOS install are:

  1. Update CentOS using yum update.
  2. Add Webmin to the CentOS yum repositories.
  3. Add the Webmin package PGP key to the RPM keyring.
  4. Allow Webmin through the CentOS iptables firewall.
  5. Install Webmin using yum install webmin.
  6. Start Webmin and start using it.

Webmin Install Running on CentOS

Practice Makes Perfect For Webmin CentOS Installation

Webmin CentOS InstallThese Webmin CentOS install instructions can be practised on a local computer using a virtual machine. Practising the installation reduces the chance of making a mistake on a live server and risk requiring the server to be reset by the service provider. If a VPS needs to be reset it may result in data lose. Always backup any data that needs to be kept when making changes to live servers. See the Further Information section at the end of the tutorial for a list of articles on using a virtual machine for CentOS.

Log on to CentOS VPS Via SSH

In this article it is assumed that the log in user is root, or a user capable of becoming a super user (sudo). For all the commands enter the text that follows the # and press return (Enter). The text before the # may differ from system to system so is not shown. The sudo versions of the commands are not shown as it is assumed the reader can learn how to use sudo elsewhere. Log in to the CentOS VPS system using SSH. On a Windows machine a programme such as PuTTY can be used for the terminal.

Update CentOS

Before installing Webmin it is worth ensuring CentOS is up-to-date. Update CentOS using yum:

# yum update

Then reboot:

# reboot

Log back into CentOS.

Add Webmin To Yum Repositories

To manage the Webmin install via Yum create a Webmin Yum repo in the Yum repository directory /etc/yum.repos.d. Use the vi editor to create a webmin.repo file:

# vi /etc/yum.repos.d/webmin.repo

Press i to enter insert mode and enter the following:

name=Webmin Distribution Neutral

Press the escape (Esc) key to return to vi command mode and enter colon then wq to execute the vi write and quit commands (:wq). If you want to check the contents of the webmin.repo file use the cat command:

# cat /etc/yum.repos.d/webmin.repo

Add the RPM Key File for Webmin

Add the PGP key that the Webmin RPM package is signed with to the RPM keyring:

# rpm –import http://www.webmin.com/jcameron-key.asc

Allow Webmin Through the CentOS Firewall

On CentOS iptables is used to filter network traffic. The default iptables settings for the minimal CentOS installation is to only allow SSH traffic (on port 22). The current iptables settings can be listed with the -L command:

# iptables -L

Webmin runs on port 10000 which requires editing the iptables rules configuration file using vi and restarting the firewall.

Adding an Iptables Firewall Rule for Webmin Using Vi

Use vi to edit the firewall rules:

# vi /etc/sysconfig/iptables

Move the cursor to the line after the SSH rule and enter insert mode (by pressing i). Enter the new rule -A INPUT -p tcp -m tcp –dport 10000 -j ACCEPT and save the file and quit (using :wq).

Webmin Centos Install Iptables Firewall Rule

Restart Iptables to Enable the New Webmin Firewall Rule

Issue the command /etc/init.d/iptables restart to apply the new Webmin firewall rule:

# /etc/init.d/iptables restart

Install Webmin Using Yum

Use yum to install Webmin via the configuration file webmin.repo created earlier:

# yum install webmin

Start Webmin

Issue the command /etc/init.d/webmin start:

# /etc/init.d/webmin start

Using a browser enter the CentOS server’s address adding port 10000, e.g. if the CentOS server is called myServer use http://myserver.com:10000. Use the hostname command to find the host name:

# hostname

Webmin Install Login on CentOS Server

Access Webmin from Localhost on Local VM using NAT

If the CentOS server is running on a virtual machine (VM) using VirtualBox, the VM will need configuring with a port forwarding rule. Using Network Address Translation (NAT) the localhost port 10000 traffic is forwarded to the VM’s port 10000. Using the VirtualBox Manager program select the Settings for the CentOS VM.

Webmin NAT Via VirtualBox Network Settings

Add a port forwarding rule for TCP to forward Host Port 10000 to Guest Port 10000.

Webmin VirtualBox NAT Rule

When entering the address localhost:10000 into the browser (http://localhost:10000) it will forward to the correct port on the VirtualBox VM.

Check that Webmin is Running on CentOS

To check that Webmin is running via the SSH terminal use /etc/init.d/webmin status:

# /etc/init.d/webmin status
Webmin (pid 1056) is running

Log In to Webmin Using Default CentOS Root User

The default log in for Webmin is the same as the default CentOS root user. Log into Webmin. Use the web interface to explore the system administration options available.

Webmin Installed and Running on CentOS VPS

Further Information


One thought on “Webmin CentOS Install for Easier VPS Management

  1. Pingback: Unzip File on VPS? How to Extract a Zip File on a Linux VPS -Tek Eye

Leave a Reply

Your email address will not be published. Required fields are marked *

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.