How to move web-hosting with ISPConfig 3 to another server

17:21 13/11/2012

Here, we will have two servers: old-server is old ispconfig3 server and new-server is new ispconfig3 server that need to moved.

Step 1: Backup all sites code, databases and configuration files in old web hosting server

We need backup all site codes and databases that have in web hostingserver.

– Backup code

Compress folder /var/www (default folder that contain webs code ) . Naming compress file is codeweb.tar.gz

#cd /backup

#tar -pczf codeweb.tar.gz /var/www

(with -p parameter to same ownership when extract)

– Backup databases

Make a backup of all the mysql databases

#cd /backup

#mysqldump –opt –user=root –password=XXXXXX –all-databases | gzip >dbispconfig.sql.gz

NOTE: change XXXXXX to whatever your root password is

– Backup configuration files

We need to backup configuration files as php.ini, httpd.conf, passwd, group, shadow, postfix, dovecot, ..

#cd /

#cp -rf /etc/php.ini /etc/httpd.conf/ etc/passwd /etc/group /etc/shadow /etc/postfix/ /etc/dovecot* /backup

Step 2: Installing and configuring on the new ISPConfig3 server (new-server)

  • Installing a new CentOS server( new-server)

  • Moving codeweb.tar.gz and dbispconfig.sql.gz from old-server to new-server

    #scp /backup/webcode.tar.gz root@new-server:/var/download

    #scp /backup/dbispconfig.sql.gz root@new-server:/var/download

  • Moving configuration files from old-server to new-server

    #…

  • Installing services(Apache2, dovecot, ..) the following Installing ISPConfig-3 on Centos-6.x 86_64 (or see detail athttp://www.howtoforge.com/howtos/control-panels/ispconfig )and finish at step 23 (Install Squirrelmail), have not install step 24 (Install ISPConfig3, because we will import database ispconfig.sql that the sameispconfig version on old-server ).

  • And then, download the same ISPConfig version on the old-server (in here, the ispconfig version on the old-server is ispconfig-3.0.4.6, extract and install it

    #cd /var/download

    #wget http://prdownloads.sourceforge.net/ispconfig/ISPConfig-3.0.4.6.tar.gz

    #tar zxvf ISPConfig-3.0.4.6.tar.gz

    #cd ispconfig3_install/install

    #php -q install.php

Step3: Restore sites code and databases in new web hosting server

Log in the new-server, and perform to restore

1. Restore code

Changing to the / directory and extract code for all sites

cd /

#tar xvfz /var/download/codeweb.tar.gz

We will see all the web files start to uncompress into the /var/www/ directory
2. Restore database

#gzip -d dbispconfig.sql.gz

#mysql –host=localhost –user=root –password=XXXXXX < dbispconfig.sql

NOTE: change XXXXXX = to whatever is your root mysql password on the new-server

After we finished to restore, check ispconfig control panel https://new-server:8080 and login with admin account. Accounts will sync with the old-server.

Step 4: Notes

1. If have error occurs “ Username or Password wrong.1” when login with admin account then we do the following:

Get the password again:

#grep -i db_password /usr/local/ispconfig/interface/lib/config.inc.php

$conf[‘db_password’] = ‘d036658a01e0a5022290062523…';

define(‘DB_PASSWORD’,$conf[‘db_password’]);

#mysql -u root -p

Enter password:

mysql>update mysql.user set password=PASSWORD(“d036658a01e0a5022290062523…”) where User=’ispconfig';

mysql>flush privileges;

mysql>quit

2. If occur error when login system then copy and replace as passwd, group, shadow files

3. In ISPconfig interface, edit new-server ServerName and IP address

In the System module in ispconfig interface, edit ServerName to present server name( example new-server.example.com)

4. After restore, we still not see to appear vhost configuration files for sites, when do the following:

– Login admin account from https://new-server:8080

– Using the resyn function in the tool module in ispconfig

– Check to appear the vhost configuration files in /etc/httpd/conf/sites-available/ and /etc/httpd/conf/sites-enabled/

5. if occur errors with php, postfix, dovecot or dns when copy and replace the files as php.ini, main.cf, dovecot.conf, named.conf

Comments

Popular posts from this blog

Web Servers Load balancing with HAProxy

Redirect all unencrypted traffic to HTTPS in Apache

Using nginx as http load balancer