Before learning how to install webmin on Amazon Generic Linux and CentOS AMI in AWS Ec2; let us check what we saw. You already read how to install CentOs or Other Linux on AWS EC2. Then we also went through a guide to access your VPS (Linux EC2 server) using key-pairs.
Now when you are all set and ready, you must be eager to install Webmin. Webmin as all know, is a complete Server administration platform. You will have everything in GUI. You will be able to control domains, subdomains, users, SQL databases, rights, Web services etc. Most important thing – it is most preferred Control Panel and totally Free.
This guide will be just copy-paste thing which you can use without problems. You have to copy from here and hit ‘Right click button’ on mouse in PuTTY window. Just sometime depending on your linux install (Amazon Generic or CentOS) some commands will differ. Also, version number may give errors as software will keep updating but not this guide.
So, let’s get started. I hope you are already accessed your server via SSH (PuTTY) and now are at command prompt.
First, install ‘wget’;
sudo yum install wget
Secondly, run the update. It is not mandatory but always a good idea to get it done first.
sudo yum update
I will be using ‘sudo’ in front of every command as Amazon Linux doesn’t allow root login and with Sudo User like ec2-user needs to prefix ‘sudo’. To make things easier, you can type this in first;
After this you can omit those sudo from every command.
CentOs and other linux doesn’t need sudo in every way as they will login via root.
Now, we have to download Webmin package.
Please note that you will be downloading current RPM package. At writing of this article it was version ‘1.600-1’. Change it in next command if version is updated. Non-matching number will give error because it is not the version you downloaded.
sudo rpm -U webmin-1.600-1.noarch.rpm
Don’t ever forget sudo if you are not root user or you can get that ‘Permission Denied’. Check screenshot for taking care of version number and sudo.
Installation will start and PuTTY screen will not reply for sometime. It’s AWS EC2 so it will be very fast than other VPS. After it is completed you will receive confirmation saying that now you can access it ‘http://Your_Server_IP_Add:10000’ using ‘root’ as user.
Now it is crucial to make some changes to firewall/IPtables to be sure of security thing.
service iptables status
Reminder: You must be using Generic Linux from Amazon. Remember on CentOS/Debian etc it is ‘root‘ user with all access and for Amazon Linux it is always ‘ec2-user‘ without full root privileges. So, you need to add “sudo” if on Amazon Linux.
sudo service iptables status
Update 04-MAY-2013: If you are getting some other errors like ‘Firewall Not Running’ or ‘iptables: unrecognized service ‘ then this needs to be fixed due to updates to Linux OS. Fix it by reading this article and then come back.
Let’s stop firewall to make some changes to it.
sudo service iptables stop
Now, we have to add port ‘10000’ to it which is needed to access Webmin. Without this server’s firewall will not give access to any incoming connection from port ‘10000’.
sudo iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
Let’s save this firewall rule;
sudo /sbin/service iptables save
Now, restart the firewall.
sudo service iptables restart
Now flushing any previous rules.
sudo iptables -F
Start the firewall and check the firewall configuration again;
sudo service iptables restart
sudo service iptables status
The information shown in status must have mention of port 10000.
If not then repeat the procedure by stopping firewall again. For some reason it may happen that your server’s firewall was already stopped at first place – this is usual. Keep going. When everything works out. Proceed ahead.
Let’s restart the server.
You will be disconnected from server. (What an obvious thing I am telling!!!). You will need to reconnect with PuTTY after 1-2 minutes.
Warning: If you are using Elastic IP then you may need to go back to AWS Control Panel and reassign the IP to instance after it is restarted.
For tutorial to assign and manage EIP easily go HERE.
Now, let’s access the Webmin. This is actually pain when you are using Amazon Linux and no Elastic IP (EIP). With CentOS, even without EIP it is very easy. If you have assigned EIP then use URL like this in browser;
If you don’t have EIP then take the IP of your server. It will be something like for Amazon Generic Linuxes;
HINT: You can get it from EC2 Panel and also from IP address field of PuTTY.
Now paste ‘YOUR’ server’s IP address in your browser as shown (with Port 10000) and hit enter.
If you are using Amazon Linux, then there are 99% chances are that you will get error that this is not the valid address or the web server is running in SSL mode. It will tell you to click on a link (which is actually your Private IP). However, nothing will work. Check screenshot;
For some reason server tells you to try Private IP which will never work. Solution is you have to access Public IP (above one) with ‘https’ for using SSL mode. Try this;
For EIP use;
A warning will appear saying that there is an SSL error and security certificate isn’t trusted. It is because you have not installed one and still you are using SSL mode from a Public IP. It is all ok. Just hit ‘Proceed’ in Chrome and ‘I Understand the Risk’ in Mozilla Firefox. It won’t come again unless you clean your browser cache.
Please Note: This error is for only Amazon Linux Users and not CentOS, Debian etc.
People using EIP with other Linux can directly use that to go to Webmin. No issue. You can find tutorial to set EIP here but I think it is more important to have stable server running first.
Troubleshooting: If you can’t access EIP in AWS, then please check your Security Group settings in AWS Instance Control Panel. The standard ports 80 (http), 10000 (Webmin), 21 (FTP), 53 (DNS) are the least requirement to be opened on a security group as it is kind of firewall.
After you accept the risk (there is none – trust me); You will land on Webmin Login Page. Last problem is here. As we know Amazon EC2 servers doesn’t allow passwords in SSH (like in PuTTY). So, you never had one. How you are going to access it? Next thing; Webmin will only accept user ‘root‘ and not ‘ec2-user‘ – no matter what your linux is.
So, what about we change ‘root’ password now from PuTTY? Seems good. Right?
sudo /usr/libexec/webmin/changepass.pl /etc/webmin root PASSWORD
In place of PASSWORD type in your new password for ‘root’ user. You can also check out the whole tutorial here if someday you lose your webmin password.
Now restart the Webmin;
sudo service webmin restart
Go back to your browser and refresh the Webmin login page. Use ‘root‘ as username and new password to access it.
Tada… You should be inside your Server’s Webmin Panel. Go ahead and explore.
I hope it all worked out for you. Next thing is to install latest PHP, Apache, and MySQL packages before proceeding for Domain configuration. Stand by for that tutorial or just motivate me to do it ASAP by commenting.
Any comments and problems welcome.