Hi Gurus, We need to migrate postfix mail server from old box to new box with same configuration, what the procedure need to do and what files needed to be copy in old box to new box. Also more than 4000 mail account on the mail server and other application running. Running application: Postfix apache mysql php drbd hearthbeat How can we move all application from old box to new box with same configuration. Thanks, Dexter
There is no real easy way to "migrate" that I know of. The best thing I can think of for you to do would be to go and copy each config file to a thumb drive or a network share. Here are my suggestions... For users and email: I am not a fan of doing this, but people need to do it. (I take no responsibility for loss or damage of data, so you may want to test it first...) Step 1 - Log into old server as root and create a directory called "migrate" or "old-server-data" Step 2 - Set a UID filter limit...if you are using RH, CentOS, or FC the default is 500 and the upper is 65534. If you are using a Deb or Ubuntu system, the default is 1000 and upper is 29999 For RH, FC, CentOS based systems... Code: export UGIDLIMIT=500 For Deb based systems... Code: export UGIDLIMIT=1000 Step 3 - Copy the /etc/password using awk to remove system accounts. REMEMBER TO SET THE UPPER LIMIT APPROPRIATELY!! 65534 for RH, CentOS, FC and 29999 for Deb systems For RH, FC, or CentOS based systems... Code: awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /root/migrate/passwd.mig For Deb based systems... Code: awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=29999)' /etc/passwd > /root/migrate/passwd.mig Step 4 - Copy the /etc/group file using awk to remove system accounts REMEMBER TO SET THE UPPER LIMIT APPROPRIATELY!! 65534 for RH, CentOS, FC and 29999 for Deb systems For RH, FC, CentOS based systems... Code: awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /root/migrate/group.mig For Deb based systems Code: awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=29999)' /etc/group > /root/migrate/group.mig Step 5 - Copy the /etc/shadow file... For RH, FC, and CentOS systems... Code: awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/migrate/shadow.mig For Deb based systems.... Code: awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=29999) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/migrate/shadow.mig Step 6 - Copy the /etc/gshadow file... Code: cp /etc/gshadow /root/migrate/gshadow.mig Step 7 - Backup all /home folders and the /var/spool/mail folder Code: tar -zcvpf /root/migrate/home.tar.gz /home tar -zcvpf /root/migrate/mail.tar.gz /var/spool/mail Next you will want to copy the contents of the /root/migrate folder to your new server using scp or some other method. Once copied over, time to start importing. Log into the new server as root and do the following... Step 8 - Make a backup directory in /root Code: mkdir /root/userbackup Step 9 - Copy the current /etc/passwd, shadow, gshadow, grouo files as a backup... Code: cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/group /root/userbackup Step 10 - Migrate the the old files from old server. Change directories to the location of the files you transferred. Using cat, we will append to the existing files... Code: cat passwd.mig >> /etc/passwd cat group.mig >> /etc/group cat shadow.mig >> /etc/shadow cp gshadow.mig /etc/gshadow Step 11 - Restore /home directories. Change directories to / before starting... Code: tar -zxvf /path/to/transferred/files/home.tar.gz Step 12 - Restor /var/spool/mail directories. Chage directories to / before starting... Code: tar -zxvf /path/to/transferred/files/mail.tar.gz Step 13 - Reboot the system and test. For postfix copy: /etc/postfix/main.cf /etc/postfix/master.cf /etc/postfix/sasl/smtpd.conf (if using SASL) /etc/postfix/ssl/*.pem, .crt, .csr., key (if using SSL) For apache copy: /etc/apache/*.conf (typically apache.conf, httpd.conf, ports.conf) /etc/apache/ssl/*.crt, .csr, .key (if using SSL websites) Additionally, you would need to copy over any site configs if they were setup in individual files. For MySQL: **If you have never tweaked any settings in MySQL other than just creating and using DB's, then don't bother to copy any config files. If you are just looking to migrate the data of a database, simply dump the databases to a .SQL file and load them into the new database. Just make sure you do it for ALL databases on the old server. If you don't know how to do this, run this command: Code: mysqldump -h hostname -u username -p database > mysql_databse_dump_file.sql This has to be run for each database held by MySQL! Copy the file over to the new server, setup MySQL root user credentials and then run Code: mysql -h hostname -u username -p database < mysql_database_dump_file.sql Lastly, if you are using an interface like phpmyadmin, it has export tools... For PHP: Find the your php.ini in the /etc/php folder. I have always typically installed the newest version of PHP, installed required modules, and just cross checked my php.ini with the new php.ini from the new install. If you need to use an older version of PHP due to software compatibility, then it would be a good idea to identify which build you need on the new server. As far as drbd and hearthbeat goes...never really used them and can be of no help. More than likley, these have config in the /etc folder...
Also, you didn't mention any sort of DNS server...just making sure you don't screw yourself over by forgetting that important piece of the puzzle.
I just performed a similar migration. I used the Ubuntu Postfix/Courier guide by Falko with the original box. So for the new machine I followed that same guide and copied my conf files to a note pad so I could compare any specific changes I made. Once the server was up and running I used the admin.php front end by Volksman to create my users. Once they were all created I used rsync to copy the entire domain directory under /home/vmail/ to the new server. Worked like a charm!