Update from an old qmailrocks.org installation
Following instructions supposes you want to migrate your data from a server installed with original qmailrocks.org guide into a server freshly installed following this updated guide
This how to 'll refer to OLD_SERVER (server installed with old qmailrocks guide) and NEW_SERVER (server installed with updated qmailrocks guide)
1� Install synchronisation tool on BOTH servers
2� On OLD_SERVER server : stop apache service (needed for administration tools), backup and copy the vpopmail database
mkdir /backups/
/usr/bin/mysqldump -c -C -e -Q --add-drop-table -uroot -pMySQL_root_password vpopmail | gzip>/backups/vpopmail.sql.gz
scp /backups/vpopmail.sql.gz root@NEW_SERVER:
qmailctl stop
If your installation from original qmailrocks.org was done without MySQL support, you should first convert your installation on OLD_SERVER into a MySQL installation. You can do this with the script vconvert-cdb-sql-big.pl
mysql -pMySQL_root_password
CREATE DATABASE vpopmail;
GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopmailuser@localhost IDENTIFIED BY 'VPOPMAIL_PASSWORD';
FLUSH PRIVILEGES;
quit;
chmod +x /downloads/scripts/vconvert-cdb-sql-big (then edit the file and execute it for each of your domains)
2� On OLD_SERVER server : copy config files to NEW_SERVER
scp morercpthosts rcpthosts virtualdomains root@NEW_SERVER:/var/qmail/control
cd /var/qmail/users
scp assign root@NEW_SERVER:/var/qmail/users/
3� On OLD_SERVER server : determine UID/GID for some users
We 'll refer this value as VPOPMAILUID later
grep vpopmail /etc/passwd | cut -d: -f4
We 'll refer this value as VCHKPWGID later
This second value should be the same as the result of the command
grep vchkpw /etc/group | cut -d: -f3
4� On NEW_SERVER server : stop mail services and synchronise e-mails
gunzip /root/vpopmail.sql.gz
mysql -Dvpopmail -pMySQL_root_password < /root/vpopmail.sql
sed "s/VPOPMAILUID:VCHKPWGID/89:89/g" /var/qmail/users/assign > /var/qmail/users/assign.new
mv /var/qmail/users/assign /var/qmail/users/assign.old
mv /var/qmail/users/assign.new /var/qmail/users/assign
/var/qmail/bin/qmail-newu
/var/qmail/bin/qmail-newmrh
rsync -avz --delete root@OLD_SERVER:/home/vpopmail/domains/ /home/vpopmail/domains/
find /home/vpopmail -uid VPOPMAILUID -exec chown vpopmail {} \;
find /home/vpopmail -gid VCHKPWGID -exec chgrp vchkpw {} \;
5� Edit the file /downloads/scripts/migrate-vpopmail-many-domains (View the script migrate-vpopmail-many-domains) on NEW_SERVER:
Adapt database structure
/downloads/scripts/migrate-vpopmail-many-domains
6� Adapt your MX setting in your DNS configuration. Then, execute following command on NEW_SERVER
That's all folks !
If you need more info or if you need to migrate only some domains, take a look to http://qmail.jms1.net/scripts/migrate-domain.shtml
Users comments