Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 14th April 2010, 03:09
dexjul dexjul is offline
Member
 
Join Date: May 2007
Posts: 53
Thanks: 0
Thanked 3 Times in 2 Posts
Default postfix migration from old box to new box

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
Reply With Quote
Sponsored Links
  #2  
Old 19th April 2010, 08:48
dexjul dexjul is offline
Member
 
Join Date: May 2007
Posts: 53
Thanks: 0
Thanked 3 Times in 2 Posts
Default

Anybody can answer my question.


Thanks,

Dexter
Reply With Quote
  #3  
Old 20th April 2010, 14:48
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

What tutorial (URL) did you use to set up the mail server?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #4  
Old 20th April 2010, 17:10
punk0mi punk0mi is offline
Junior Member
 
Join Date: Jun 2006
Posts: 17
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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...

Last edited by punk0mi; 20th April 2010 at 18:02. Reason: updated response
Reply With Quote
  #5  
Old 20th April 2010, 17:11
punk0mi punk0mi is offline
Junior Member
 
Join Date: Jun 2006
Posts: 17
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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.
Reply With Quote
  #6  
Old 23rd April 2010, 00:56
philefluxx philefluxx is offline
Junior Member
 
Join Date: Oct 2009
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
Default

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!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix not responding to telnet CarbonCopy Server Operation 6 8th May 2009 05:39
Undelivered Mail Returned to Sender Error202 General 5 7th May 2009 11:14
localhost postfix/master: fatal: bind 127.0.0.1 port 125: Permission denied g18c Installation/Configuration 4 24th March 2009 17:39
Centos 4.4 32bit Hangs, High Server load 3cwired_com Server Operation 11 16th November 2006 15:47
Verify email setup meekish Installation/Configuration 28 27th October 2006 15:36


All times are GMT +2. The time now is 20:27.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.