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.
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.
name=Webmin Distribution Neutral
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
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)
-----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:
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
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:
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:
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:
Now restart Webmin:
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.