Tutorial Overview
- Install ZPanel on Ubuntu
- Remove conflicting software
- Configure self-signed SSL for ZPanel HTTPS access
ZPanel Overview
ZPanel is one of the newer web hosting control panels available for Ubuntu 12.04, CentOS 6.4 and Microsoft Windows, however it has already reached version 10.1.1. ZPanel is a free web hosting control panel, offering many of the features that you would expect to find in a commercial control panel. Some of these feature include:
- Webmail, SMTP, POP3 and IMAP4 email access
- FTP
- Web server
- DNS
Prepare The Ubuntu VPS
Conflicting Software
ZPanel installs its own version of a number of applications, so current installations of the following software should be removed from your Ubuntu VPS prior to installing ZPanel:
- MySQL
- Apache
- Bind
- Dovecot
- Postfix
- proFTPd
The following command will remove the above applications from your Ubuntu VPS:
apt-get -y remove mysql* apache* bind* dovecot* postfix* proftpd*
You should also ensure that any other applications providing the following services are removed:
- Web servers
- FTP servers
- POP3/IMAP servers
- DNS servers
Network Ports
Being a web hosting control panel, a number of network related services are run on the ZPanel server, you must therefore make sure that any firewall on your Ubuntu VPS (i.e. software firewall) or hardware firewall allow communication on the following network ports:
- 20 and 21 : TCP / UDP (FTP)
- 25 : TCP (SMTP)
- 53 : TCP / UDP (DNS)
- 80 : TCP / UDP (HTTP)
- 110 : TCP (POP3)
- 143 : TCP (IMAP)
- 443 : TCP / UDP (HTTPS)
You can check your current IPtables settings by running the following command:
iptables -L -n -v
VPS Hostname Setup
Your Ubuntu VPS must be a member of a domain that you own and have administrative control over (e.g. example.com). In addition, it must have a fully qualified domain name (FQDN) assigned to it from within the domain (e.g. zpanel.example.com). You can check your current VPS hostname by running the following command:
hostname
Most other web hosting control panels run their administrative web server on a non-standard port in order not to conflict with any domains hosted on the VPS, however ZPanel is slightly different, in that it runs the administrative control panel on the standard HTTP port 80 and HTTPS port 443, under the fully qualified domain name (FQDN) of the VPS. For this reason, it is strongly suggested that you ensure that your VPS FQDN will not conflict with any possible future hosts or domains that you deploy within the domain.
You can change permanently change your HOSTNAME setting in the /etc/sysconfig/network file. In addition you should also change the 127.0.0.1 entry in your VPS /etc/hosts file to reflect your VPS FQDN. Then restart the networking service (WARNING: restarting the networking service may disconnect your current SSH session):
/etc/init.d/network restart
Installing ZPanel On Ubuntu
Please check the ZPanel website before proceeding with your installation to ensure that you are installing the latest version. When this article was published, ZPanel was currently on version 10.1.1. Your production environment should only ever be run via a Zpanel stable release for security reasons.
After your Ubuntu VPS has been prepared your next step is to download the current installer for ZPanel on Ubuntu. Replace [ZPANEL VERSION] with the current version of ZPanel in the following format X_X_X, for example, version 10.1.1 would be 10_1_1:
cd /root/ wget https://raw.github.com/zpanel/installers/master/install/Ubuntu-12_04/[ZPANEL VERSION].sh
We now need to start the installation script running:
sh ./[ZPANEL VERSION].sh
The installation process currently runs as follows:
- Agree to the GPL license
- Enter your timezone information
- Choose to install ZPanel as opposed to upgrade
- Enter the fully qualified domain name (FQDN) of your CentOS VPS (e.g. zpanel.example.com)
- Enter your VPS public IP address
- Enter the root password used for MySQL
Once the above steps have been completed, ZPanel will download and install to your Ubuntu VPS.
After the installation script has finished you can access your ZPanel installation using either of the following:
http://[VPS IP ADDRESS] - e.g. http://192.168.2.1 http://[VPS FQDN] - e.g. http://zpanel.example.com http://[DOMAIN NAME] - e.g. http://example.com
Your ZPanel server is now up and running on your Ubuntu VPS!
Configuring Self Signed SSL / HTTPS Access
First we need to ensure that OpenSSL is installed on your VPS:
apt-get -y install openssl
Next we need to generate a self-signed certificate that ZPanel will use to secure your connection:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out /etc/pki/tls/certs/zpanel.crt -keyout /etc/pki/tls/certs/zpanel.key
The ZPanel Apache web server now needs to be configured to use the new certificate:
nano /etc/httpd/conf.d/ssl.conf
Find the SSLCertificateFile and SSLCertificateKeyFile entries and change them to:
SSLCertificateFile/etc/pki/tls/certs/zpanel.crt
SSLCertificateKeyFile/etc/pki/tls/certs/zpanel.key
Once the above changes have been made, save and exit from the file.
Finally, we need to redirect all HTTP based ZPanel login attempts to the secure HTTPS URL. Login to ZPanel and navigate the menu system as follows:
Zpanel -> Admin -> Module Admin -> Apache Admin
Within the Global Zpanel section, insert the following:
Redirect Permanent / https://[VPS FQDN]/
So that the above changes take effect, you will now need to restart the Apache server on your VPS. This can be done by running the following command:
service apache2 restart
Th installation is now complete and you can now access your Ubuntu ZPanel installation via secure SSL (HTTPS) connections!