Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have installed in a CentOS server all stuffs there I need for my work. Apache, PHP, MySql, Red5 and other stuffs, but now I need migrate to other server with the same CentOS. How can I copy all my system, configurations and stuffs there I installed for my new server? Just copy and paste will work? Thanks.

share|improve this question

3 Answers 3

Marc's solution should work for a one-off, but take a look at Puppet if you need to do this more than once. Puppet is an automated tool for customized deployments.

share|improve this answer

If your hardware is slightly different then a straight clone will not necessarily work (it usually does on Linux but you may have specialist drivers and services installed for the server).

So, I use SystemImager, which was designed to snapshot a machine and deploy it to more machines. Its very straightforward to use, and uses rsync so you can incrementally keep your snapshot image up to date.

Now.. that assumes you want to copy everything on the server. If you just want to copy the items you have changed.. you need to remember what you changed (obviously!). To copy your websites, you generally just need to copy your home directory, and the relevant configuration files from /etc. You'll also want to use mysqldump to export the databases, and import them to the new server.

I can't be more helpful what you need to copy for your work, as you couldn't say what services you used ("and stuffs" doesn't allow me to help you further), but the general concept above should be enough. Copy as much as you think you need, then test that it's all in place before switching the old box off, as you'll no doubt find things you forgot.

share|improve this answer

copy and paste will proably work. But I suggest to do it as follows.

Install the same packages as you installed on your first one. And copy the /etc folder.

Copy /etc/passwd , /etc/groups /etc/shadow and /etc/gshadow. so you'll end up with the same users.

dump your databases. This will work: for i in $(echo 'SHOW DATABASES;' | mysql | grep -v '^Database$' ); do mysqldump -uroot -ppassword --opt $i > $BackupFolder/$(date +%F)mysql$i.sql; done;

then insert the sql files to the new mysql

Option B) I like this one. In case you are in a hurry and 2 liveCd = > try netcat.

This page has instructions to make it : http://alma.ch/blogs/bahut/2005/02/wonders-of-dd-and-netcat-cloning-os.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.