Simple, yet detailed instructions on how to install Webmin on Centos 7, add firewall exceptions for Webmin port and even change the default Webmin port if that’s required.
Login to your remote server over SSH with root credentials. Ideally you should use putty, which supports copy and paste.
Create a new file webmin.repo in /etc/yum.repos.d/ using following command and press Enter.
vi /etc/yum.repos.d/webmin.repo
Empty vi editor will open. Press Insert button on your keyboard, which will allow you to insert commands into vi console.
Now highlight and copy (ctrl-c) below text.
[Webmin] name=Webmin Distribution Neutral #baseurl=http://download.webmin.com/download/yum mirrorlist=http://download.webmin.com/download/yum/mirrorlist enabled=1
Place the mouse cursor right at the top of putty window (vi editor file) and right click your mouse (auto paste). It will paste the copied text into vi editor.
It should look like this now:
Exit VI insert mode by pressing ESC on your keyboard. Now quit VI editor and save the changes, to do so, type
:wq
and press ENTER. VI editor will close and you’ll be back to Centos SSH command line.
We’ll need to install wyumebmin GPG key now, using following command. Just copy and paste (right mouse click in putty) this into SSH, then press ENTER.
rpm --import http://www.webmin.com/jcameron-key.asc
Note: from time to time it appears that jcameron-key.asc is not available for download. If you experiencing this problem, I’ve made a copy to my own server, so you can run this command instead:
rpm --import http://www.joe0.com/wp-content/uploads/2014/10/jcameron-key.asc
Or save this content into a file called: jcameron-key.asc and import it into your server using following command, then change url in the command above to point to your own server:
-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.0.7 (GNU/Linux) mQGiBDx9wR0RBACR3xGPTkG5Staj7EVeiVJDrYXIPF28MGCrOEGw04tQmQTALz0E YEcyfvui7KScrpHmZpy70PwgwxUDPUMik7vvRiUa9RRbJsDYyom06NGk+Z4dURhn DeNRhcBrNBfyMvUY7HSJ2JP9jhQDWb8Lo1i231tvlnY0tNudVsP484ax6wCgrBwW myad6TLYaETj0+AxGJxYgikD/iERqNF60x+WyfEH/SIOuKGlV/QoxmqOePn2gj9V DWiOOAZ9DDWD6DpRNK/UVZRD1MK37HU1ePv7i92DTL9yIbyJwFcZNkEyMU3t+GBj zf4YvaQnvtA09EdQNsC1GXxNXqYkVmTE1dHH83UK+chaXRoDQ6O9KD9SFE2vsj1d z9VPBACPgmuVcUKXag6ZBY+SBColQzwyZfXtTOCnBh0HP4HOjU4G6CRTcAgLQrdM 1Uu29Al7TaE2p8HZb37dVoTRntM+Nf5O+2dX5iHA6ncdozKGftuXQMC7z9758nUi 2E4Svo9hmroM+NKonpZByt6TilhDXrPIcNYHlNsxpTAxq+lnw7QjSmFtaWUgQ2Ft ZXJvbiA8amNhbWVyb25Ad2VibWluLmNvbT6IVwQTEQIAFwUCPH3BHQULBwoDBAMV AwIDFgIBAheAAAoJENl6OukR9jxRQZEAoIHxngo/LxLBeFF9cpEViVGgChRIAJ90 zwqcBfw02su5AavnXjv6HxXF8bkBDQQ8fcEqEAQAx88aO9zI912/tbsNjLhDXpq0 WMw5F6fUUlwYpkaspPwWZ3UgDJaR1+oL3xnJKlD1Eu5x9B3r+rxYyoFpXubWz4R6 sL1u4kMRb347+fv140dE/RGFNEmqefZDeysz1TQG1Sskyyf7sV2KRUmI8wJTwg3n IOtbyOoE3XlxI5FUrW8AAwUD/iEBdIH5DYB/FnOb/EkP3G3kCXGgTdZk7UA9HPKB dV7JckgSicpi/mX898LxQrr0jyb6nyi2900OgQUQArrviTnp37j4ciQj214gTHzf ssA40O5QR4t915z6wS4Ml+fAc5ZOeL6EQxiP+x+rz6h9+Mc8rawowY+7sBnvVw5O YoVXiEYEGBECAAYFAjx9wSoACgkQ2Xo66RH2PFH+ZgCggAyuOLaoE9t9tyJbifEz /YzvqYwAnj85Ehe8EmnKuor/k/TPtKl4MzDm =oxvD -----END PGP PUBLIC KEY BLOCK-----
You can also download the file from here and place it on your server: jcameron-key.asc
Above steps are not necessarily needed, but by adding the webmin repository and Jamie Cameron’s key it is possible to install & maintain the latest Webmin version on your Centos system.
—
Next step is to update the repositories and all available package updates, to make sure we’re installing the latest version of Webmin. Run following command:
yum check-update
Note: sometimes when webmin site is not available, you may need to download and install manually, just grab the files from: http://download.webmin.com/download/yum/
You should see something like this being output to your console:
Now we can proceed to an actual Webmin installation, execute following command:
yum install webmin -y
Above will take a moment, because we’re not installing only latest version of Webmin, but also all its dependencies.
Once done, you’ll see similar output in your console, informing you that Webmin as well as dependencies were successfully installed:
Now execute following commands to make sure that Webmin starts automatically every time you reboot your server:
chkconfig webmin on
Now reboot your server, Webmin will automatically start. Or just start the Webmin service manually from the console without a reboot (not necessary):
service webmin start
Simple, wasn’t it?
However, because most of us as accessing our servers remotely, we’ll need to cover couple more things before we’re done.
Because CentOS 7 iptables were replaced with FirewallD so we should me sure that Webmin’s default port 10000 is enabled and thus accessible externally. To do so, run following command (add –permanent to the end of the line if you’d like this to be a permanent firewall change):
firewall-cmd --add-port=10000/tcp --permanent
If it works, great. Otherwise if you get a following (very common on newly installed servers) error, it means, that FirewallD is not currently running on your system:
It means exactly what it says: FirewallD is currently not running on your Centos 7 system.
We’ll need to start it first. To do so, use following commands:
systemctl start firewalld firewall-cmd --state
Then add the firewall exception for port 10000 once again:
firewall-cmd --add-port=10000/tcp --permanent
Complete output should look like this:
Now we should be able to access Webmin by opening browser at your server’s ip address (or domain name). Go to http://ipaddress:10000. If everything worked correctly, you’ll be greeted to a Webmin login screen:
Login with your root username and password and Webmin should load:
And that is it. Webmin runs on port 10000 and is installed on Centos 7 operating system.
—
Those of you, who would like to change their default Webmin port from 10000 to something else, follow this steps:
Open file miniserv.conf (which stores webmin config) in vi console by executing following command:
vi /etc/webmin/miniserv.conf
Again, press Insert key on your keyboard to enter vi console insert mode. Look for the line 1 and line 16 which stores the port number Webmin currently listens on:
Go to line 1 and line 16 and change the port number from 10000 to whatever you wish. In my case I want to run Webmin on port 443, so that’s what I will change it to:
Now we can exit VI insert mode by pressing ESC on the keyboard and quit VI editor while saving the changes we’ve made. To do so, type:
:wq
Now, add FirewallD exception for your port (in my case 443) and remove existing exception for port 10000:
firewall-cmd --add-port=443/tcp --permanent firewall-cmd --remove-port=10000/tcp --permanent
Something it’s a good idea to reload firewall after changing ports:
firewall-cmd --reload
Now restart Webmin:
/etc/webmin/restart
You should see following output:
And we’re done, you can access Webmin on a new port (in my case 443):
Enjoy and leave me a comment if this was in any way helpful or if you’d like to add anything to these instructions.