Saturday, February 25, 2012

ISPConfig 3 With Xeround Cloud Database Service


This tutorial is a companion to any of the Perfect Server tutorials. ISPConfig 3 will not work with the Xeround Cloud database service by default. With minor modifications from this tutorial you will be able to run your Perfect Server without having to manage a database server.
The specific examples below were done on a Debian server with ISPConfig 3 and nginx. The steps should be similar to other distros. As well the instance is hosted in the Rackspace ORD1 datacenter. Instances within an Amazon datacenter may require different configuration. This tutorial comes without warranty of any kind.

Preliminary Note

I created a Xeround instance:
DNS Name:
instanceABCD.db.xeround.com.:7126
Internal DNS Name:
int.instanceABCD.db.xeround.com.:7126
Clicking DNS Name will take you to phpMyAdmin.
I will use the Internal DNS Name as my server is located within Rackspace ORD1, but if your server is located elsewhere use the DNS Name. This tutorial starts in a Perfect Server tutorial immediately before:
php -q install.php

1 Port Forwarding - Source

Xeround does not use the default port of 3306. The simplest way around this is to use port forwarding. This example used rinetd.
To install rinetd, just run
apt-get install rinetd
We will forward HTTP traffic from 127.0.0.1 to int.instanceABCD.db.xeround.com.. The default MySQL port is 3306 and our example port is 7126. Localhost will not work in place of 127.0.0.1.
nano /etc/rinetd.conf
127.0.0.1 3306 int.instanceABCD.db.xeround.com. 7126
Now restart rinetd.
/etc/init.d/rinetd restart
Then run:
netstat -tap
rinetd should now be running on port 3306 (mysql).
Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:ftp                   *:*                     LISTEN      9086/pure-ftpd (SER
tcp        0      0 *:ssh                   *:*                     LISTEN      1578/sshd
tcp        0      0 localhost.localdom:smtp *:*                     LISTEN      1207/exim4
tcp        0      0 *:https                 *:*                     LISTEN      1192/nginx
tcp        0      0 localhost.localdom:9000 *:*                     LISTEN      1289/php-fpm: pool
tcp        0      0 localhost.localdo:mysql *:*                     LISTEN      8700/rinetd
tcp        0      0 *:http-alt              *:*                     LISTEN      1192/nginx
tcp        0      0 *:www                   *:*                     LISTEN      1192/nginx
tcp        0      0 *:tproxy                *:*                     LISTEN      1192/nginx
tcp        0      0 localhost.localdom:9010 *:*                     LISTEN      1291/php-fpm: pool
tcp        1      0 localhost.localdo:38196 localhost.localdo:mysql CLOSE_WAIT  9086/pure-ftpd (SER
tcp6       0      0 [::]:ftp                [::]:*                  LISTEN      9086/pure-ftpd (SER
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      1578/sshd
tcp6       0      0 ip6-localhost:smtp      [::]:*                  LISTEN      1207/exim4

2 Configure ISPConfig 3

ISPConfig 3 needs a few adjustments to allow itself access to the database server. Using server1.example.com did not work. The remote MySQL host required % for any host.
nano /tmp/ispconfig3_install/install/lib/installer_base.lib.php
...Line 184
  if($conf['mysql']['host'] == 'localhost') {
   $from_host = '%';
  } else {
   $from_host = '%';
  }
...Line 1946 (Add second line)
  $content = rf('tpl/mysql_clientdb.conf.master');
  $content = str_replace('localhost',$conf['mysql']['host'],$content);
To allow application access for created databases in ISPConfig 3 run
sed -i 's/localhost/%/g' /tmp/ispconfig3_install/server/plugins-available/mysql_clientdb_plugin.inc.php
We will use expert install for ISPConfig 3.
php -q install.php
root@neonpx:/tmp/ispconfig3_install/install# php -q install.php
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ps.ini on line 1 in Unknown on line 0
--------------------------------------------------------------------------------
 _____ ___________   _____              __ _         ____
|_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
  | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |  |_ |
 _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| | ___\ \
 \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                              __/ |
                                             |___/
--------------------------------------------------------------------------------
>> Initial configuration
Operating System: Debian 6.0 (Squeeze/Sid) or compatible
    Following will be a few questions for primary configuration so be careful.
    Default values are in [brackets] and can be accepted with .
    Tap in "quit" (without the quotes) to stop the installer.
Select language (en,de) [en]: <-- ENTER
Installation mode (standard,expert) [standard]: <-- expert
Full qualified hostname (FQDN) of the server, eg server1.domain.tld  [server1.example.com]: <-- ENTER
MySQL server hostname [localhost]: <-- 127.0.0.1
MySQL root username [root]: <-- yourxeroundadmin
MySQL root password []: <-- yourxeroundadminpassword
MySQL database to create [dbispconfig]: <-- ENTER
MySQL charset [utf8]: <-- ENTER
The next two questions are about the internal ISPConfig database user and password.
It is recommended to accept the defaults which are 'ispconfig' as username and a random password.
If you use a different password, use only numbers and chars for the password.
ISPConfig mysql database username [ispconfig]: <-- ENTER
ISPConfig mysql database password [MbSrzVTpPLRMjes9210ec5f0f1160a65]: <--ENTER
Shall this server join an existing ISPConfig multiserver setup (y,n) [n]: <-- ENTER
Configure Mail (y,n) [y]: <-- ENTER
Configuring Mail
Configure Jailkit (y,n) [y]: <-- ENTER
Configuring Jailkit
Configure FTP Server (y,n) [y]: <-- ENTER
Configuring Pureftpd
Restarting ftp server: Running: /usr/sbin/pure-ftpd-mysql-virtualchroot -l mysql:/etc/pure-ftpd/db/mysql.conf -l pam -Y 1 -p 20000:20100 -b -u 1000 -O clf:/var/log/pure-ftpd/transfer.log -A -E -8 UTF-8 -D -H -B
Configure DNS Server (y,n) [y]: <-- ENTER
Hint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure nginx Server' option.
Configure nginx Server (y,n) [y]: <-- ENTER
Configuring nginx
Configuring Apps vhost
Configure Firewall Server (y,n) [y]: <-- ENTER
Configuring Bastille Firewall
Install ISPConfig Web Interface (y,n) [y]: <-- ENTER
Installing ISPConfig
ISPConfig Port [8080]: <-- ENTER
Enable SSL for the ISPConfig web interface (y,n) [y]: <-- ENTER
Generating RSA private key, 4096 bit long modulus
...++
....++
e is 65537 (0x10001)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: <-- ENTER
State or Province Name (full name) [Some-State]: <-- ENTER
Locality Name (eg, city) []: <-- ENTER
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- ENTER
Organizational Unit Name (eg, section) []: <-- ENTER
Common Name (eg, YOUR name) []: <-- ENTER
Email Address []: <-- ENTER
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: <-- ENTER
An optional company name []: <-- ENTER
writing RSA key
Configuring DBServer
Installing ISPConfig crontab
Reloading PHP5 FastCGI Process Manager: php5-fpm.
Reloading nginx configuration: nginx.
Installation completed.
Now allow the database links in ISPConfig to link to your Xeround instance. Replace the address below with the one from your Xeround DNS Name.
nano /usr/local/ispconfig/interface/web/phpmyadmin/index.php
If using nginx instead of Apache comment out the two lines in the below file. These settings are doubled and will cause a redirect loop.
nano /usr/local/ispconfig/server/conf/nginx_vhost.conf.master
#               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#               fastcgi_param PATH_INFO $fastcgi_script_name;
Finally, return to your Perfect Server tutorial to configure ISPConfig 3.

No comments:

Post a Comment