Centos syncing VPS (Moving between VPS)

So I have one vps on a company not that good so now I want to move my centos server to A new VPS server. But I dont want to install eveything from the start again.
So here is how I move my service between the two hosts.


1. Syncing yum

Copy over you repo files I hade rpm forge and epel on my servers.

scp rpm* root@eu1.elinodrift.se:/etc/yum.repos.d/
scp epel* root@eu1.elinodrift.se:/etc/yum.repos.d/
 scp /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 root@eu1.elinodrift.se:/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6


Old server run this command to get all yum packege installed and the install the same packages on the new server.

rpm -qa --qf '%{name} \n' | sort > MANIFEST
scp MANIFEST root@hos1.elinodrift.se:/tmp

On the new server install the packages from the yum list but first add the epel key

yum -y install `cat MANIFEST`

Ok so now we have synced up the packages lets transfer some configs.

2. Syncing over services

rsync  -avz /etc/postfix/ -e ssh root@eu1.elinodrift.se:/etc/postfix
rsync  -avz /etc/openvpn/ -e ssh root@eu1.elinodrift.se:/etc/openvpn
rsync  -avz /etc/httpd/ -e ssh root@eu1.elinodrift.se:/etc/httpd
rsync  -avz /var/www/ -e ssh root@eu1.elinodrift.se:/var/www
rsync  -avz /etc/dovecot/ -e ssh root@eu1.elinodrift.se:/etc/dovecot
rsync  -avz /etc/ejabberd/ -e ssh root@eu1.elinodrift.se:/etc/ejabberd


Yess I only rsync all the config over includning the mysql server 🙂

Then its only the matter of starting upp all your service on the new host. And some things shoul work. You may want to dubbel check users and folder so they are in sync.