install zpanel on chicagovps

Click here to find the best cheap VPS.

After giving up webmin/virtualmin, I resort to zpanel. But as chicagovps preloaded CentOS is lack of many important software, I get some trouble to install ZPanel.

First the official instructions for installing ZPanel on CentOS 6 failed.

bash <(curl -Ss https://raw.github.com/zpanel/installers/master/install/CentOS-6_4/10_1_1.sh)

I have to download the script and execute it manually:

yum install wget

wget https://raw.github.com/zpanel/installers/master/install/CentOS-6_4/10_1_1.sh

chmod +x 10_1_1.sh

The script was then running. After selecting the time zone, the sub domain name to access zpanel, the script repeatedly asked you for mysql root password:

enter your root mysql password

. After checking the code in the script, I found the mysql package had not been installed successfully and the script could not communicate with mysqld. The first error message before asking you for mysql password was:

GPG key retrieval failed: [Errno 14] Could not open/read file: ….

After researching, I found it was caused by the lack of epel-release package on the system. And the following command also failed:

yum install epel-release

I tried to intall the rpm package directly.

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

Please pay attention to the architecture which should be consistent with your OS.

Then I re-executed the script and this time the script went smoothly. After the script finished and a restart of VPS, I could access the zpanel login page http://panel.domainhostseotool.com in the browser.  But the https version did not not work. This is because the ssl not work properly. To find how to enable https(ssl) for zpanel, I searched google for a while and got the following method(from http://www.vpstuts.com/control-panel/zpanel/install-zpanel-centos/)

1) install openssl (yum install openssl) which is used to generate certifications.

2) yum install mod_ssl which will add a file mod_ssl.so in /etc/httpd/modules/

2) generate a certification file and a key file.

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out /etc/pki/tls/certs/zpanel.crt -keyout /etc/pki/tls/certs/zpanel.key

3) create a file ssl.conf in /etc/httpd/conf.d with the following content:

LoadModule ssl_module modules/mod_ssl.so
SSLCertificateFile /etc/pki/tls/certs/zpanel.crt
SSLCertificateKeyFile /etc/pki/tls/certs/zpanel.key

4) restart httpd: service httpd restart

But httpd failed to start with the following error message:

Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/ssl.conf:
Invalid command ‘SSLCertificateFile’, perhaps misspelled or defined by a module not included in the server configuration

Should I turn SSL Engine on?

Adding a line: SSLEngine On before the SSLCertificateFile command in the ssl.conf file I got the following error:

Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/ssl.conf:
Invalid command ‘SSLEngine’, perhaps misspelled or defined by a module not included in the server configuration

I realized that I should load the ssl module before using the ssl related commands, so I added a line at the beginning of ssl.conf

LoadModule ssl_module modules/mod_ssl.so
However, httpd still failed to start but the error message changed to:

Starting httpd: httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName

This message is very confusing because it made me think the httpd failure is due to the dns resolve failure of the server name(panel.domainhostseotool.com). And I went to /etc/hosts to see there was some error in it. However, the file is just ok with 127.0.0.1 associated with panel.domainhostseotool.com. So why httpd did not work? To debug httpd(apache) problems, you should remember the names of some files and directories:
/var/log/httpd/error_log, this is where error messages of httpd are put.
/etc/httpd/conf/httpd.conf, which is the main configuration file of apache.
/etc/httpd/conf.d/*, which will be included in the httpd main configuration file.
/etc/zpanel/configs/apache/*, which are zpanel configuration files for apache and also included in the main configuration file.

I opened the error log file and saw the following error:

[error] Illegal attempt to re-initialise SSL for server (theoretically shouldn’t happen!)

Googling this error message brought me to the post http://noone.org/blog/English/Computer/Web/Apache/Illegal%20attempt%20to%20re-initialise%20SSL.html, which is the first website in SERP. The post tells me that the error occurs if a virtual hosts at port 443 has “SSLEngine On” statement missing. But I looked through all the conf files and could not see a single virtual host at 443 port. Further researching revealed a fact that “SSLEngine On” cannot be used globally as what I did in ssl.conf. The researching also gave me another method(http://www.sahilsaid.com/blog/installing-ssl-certificate-centos-6-zpanel-mod_ssl/) to enable ssl for zpanel by adding a new virtual host in zpanel’s apache configuration file. So I decided to delete the “SSLEngine On” line in ssl.conf and moved towards adding a new virtual host for zpanel, which resulted in the following code:

NameVirtualHost *:443

ServerAdmin zadmin@localhost
DocumentRoot “/etc/zpanel/panel/”
ServerName panel.domainhostseotool.com:443
ServerAlias *.panel.domainhostseotool.com
AddType application/x-httpd-php .php
<Directory “/etc/zpanel/panel/”>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

# Custom settings are loaded below this line (if any exist)

This time httpd started successfully and there was no error messages in the log file. But I still could not access the zpanel login page via https. Using netstat command I found httpd listened on port 80,not 443 which is used by https. So I added a line Listen 443 before the newly created virtual host. After restarting httpd, the same error occured:

[error] Illegal attempt to re-initialise SSL for server (theoretically shouldn’t happen!)

Now it is time to add “SSLEngine On” to the custom settings of the newly created virtual host. The reason why this error did not occur before adding the “Listen 443″ statement is probably that apache only initialises SSL when it is configured to listen on port 443.

Finally! I can access the zpanel using https now.

zpanel

Posted in tips of hosting

Leave a Reply