Migrate: Difference between revisions

From QmailToaster
Jump to navigation Jump to search
No edit summary
No edit summary
(37 intermediate revisions by the same user not shown)
Line 1: Line 1:
  On destination host
  '''On destination host'''
  Install Rocky [Rocky,_Alma,_Springdale_9_QT_Install Scanners] or [Rocky,_Alma,_Springdale_9_QT_Install 9]
  Install Rocky [[Rocky,_Alma,_Springdale_8_QT_Install|8]] or [[Rocky,_Alma,_Springdale_9_QT_Install|9]]
toaststat (make sure all services are running)
  qmailctl stop && systemctl stop dovecot
  qmailctl stop && systemctl stop dovecot


  On source host
  '''On source host''' <span style="color:red">Source host most likely EL7</span>
  dhost=192.168.1.3 (change to suit)
  # dhost=192.168.1.3 <span style="color:red">Change IP address for your needs</span>
  ssh-keygen
  # ssh-keygen
  ssh-copy-id $dhost
  # ssh-copy-id $dhost
  ssh $dhost (test, no password should be required)
  # ssh $dhost<br>
 
  '''''First rsync email db'''''
  # The first rsync migrates the bulk of the email database except those queued during sync
  # rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains<br>
  rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
'''''Stop services for 2nd rsync'''''
 
  # qmailctl stop && systemctl stop dovecot<br>
  qmailctl stop && systemctl stop dovecot
  '''''Second rsync subsequent changes to email db'''''
 
  # rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains<br>
mysqldump -u root -p vpopmail > vpopmail.sql
'''''Bring over the rest of the data'''''
scp vpopmail.sql root@$dhost:/root
  # rsync --progress -zv -are ssh /var/qmail/control/ root@$dhost:/var/qmail/control
 
  # rsync --progress -zv -are ssh /var/qmail/users/ root@$dhost:/var/qmail/users
  # The second rsync, services stopped, migrates the balance of the email database
  # rsync --progress -zv -are ssh /etc/tcprules.d/ root@$dhost:/etc/tcprules.d
  # and control files
  # rsync --progress -zv -are ssh /usr/share/toaster/include/admin.pass  root@$dhost:/usr/share/toaster/include
rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
  # rsync --progress -zv -are ssh /usr/share/toaster/include/admin.htpasswd  root@$dhost:/usr/share/toaster/include
  rsync --progress -zv -are ssh /var/qmail/control/ root@$dhost:/var/qmail/control
  # [ ! -d /etc/mail/spamassassin ] && sqadj= || sqadj=mail/
  rsync --progress -zv -are ssh /var/qmail/users/ root@$dhost:/var/qmail/users
  # rsync --progress -zv -are ssh /etc/${sqadj}spamassassin/.spamassassin/ root@$dhost:/etc/mail/spamassassin/.spamassassin
  rsync --progress -zv -are ssh /etc/tcprules.d/ root@$dhost:/etc/tcprules.d
  # rsync --progress -zv -are ssh /etc/${sqadj}spamassassin/*.cf root@$dhost:/etc/mail/spamassassin
  rsync --progress -zv -are ssh /etc/dovecot/toaster.conf root@$dhost:/etc/dovecot
  # rsync --progress -zv -are ssh /usr/share/squirrelmail/plugins/ root@$dhost:/usr/share/squirrelmail/plugins
  rsync --progress -zv -are ssh /etc/dovecot/local.conf root@$dhost:/etc/dovecot
  # rsync --progress -zv -are ssh /var/lib/squirrelmail/prefs/  root@$dhost:/var/lib/squirrelmail/prefs<br>
 
'''''Dovecot files are not necessary for EL 8/9 they are only for reference'''''
  # Not necessary to the migration
  # rsync --progress -zv -are ssh /etc/dovecot/toaster.conf root@$dhost:/etc/dovecot
  rsync --progress -zv -are ssh /usr/share/toaster/include/admin.pass  root@$dhost:/usr/share/toaster/include
  # rsync --progress -zv -are ssh /etc/dovecot/local.conf root@$dhost:/etc/dovecot<br>
  rsync --progress -zv -are ssh /usr/share/toaster/include/admin.htpasswd  root@$dhost:/usr/share/toaster/include
'''''Bring over MySQL DBs'''''
  rsync --progress -zv -are ssh /usr/share/squirrelmail/plugins/ root@$dhost:/usr/share/squirrelmail/plugins
# mysqldump -u root -p dspam > dspam.sql
  rsync --progress -zv -are ssh /etc/spamassassin/.spamassassin/  root@$dhost:/etc/spamassassin/.spamassassin
# mysqldump -u root -p spamassassin > spamassassin.sql
  rsync --progress -zv -are ssh /etc/spamassassin/local.cf  root@$dhost:/etc/spamassassin
  # mysqldump -u root -p roundcube > roundcube.sql
  rsync --progress -zv -are ssh /var/lib/squirrelmail/prefs/  root@$dhost:/var/lib/squirrelmail/prefs
# mysqldump -u root -p vpopmail > vpopmail.sql
 
# scp *.sql root@$dhost:/root<br>
  On destination host
  '''''On destination host'''''
  mysql -u root -p vpopmail < vpopmail.sql
  [[Simscan|DSpam & Spamassassin DB creation]]
  qmailctl cdb && qmailctl start && sleep 2s && systemctl start dovecot && toaststat
# mysql -u root -p vpopmail < vpopmail.sql
 
  # qmailctl cdb && qmailctl start && sleep 2s && systemctl start dovecot && toaststat


  Questions, comments, suggestions, corrections...contact Eric on the QMT list
  Questions, comments, suggestions, corrections...contact Eric on the QMT list

Revision as of 20:31, 29 March 2024

On destination host
Install Rocky 8 or 9
qmailctl stop && systemctl stop dovecot
On source host Source host most likely EL7
# dhost=192.168.1.3 Change IP address for your needs
# ssh-keygen
# ssh-copy-id $dhost
# ssh $dhost
First rsync email db # rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
Stop services for 2nd rsync # qmailctl stop && systemctl stop dovecot
Second rsync subsequent changes to email db # rsync --progress -zv -are ssh /home/vpopmail/domains/ root@$dhost:/home/vpopmail/domains
Bring over the rest of the data # rsync --progress -zv -are ssh /var/qmail/control/ root@$dhost:/var/qmail/control # rsync --progress -zv -are ssh /var/qmail/users/ root@$dhost:/var/qmail/users # rsync --progress -zv -are ssh /etc/tcprules.d/ root@$dhost:/etc/tcprules.d # rsync --progress -zv -are ssh /usr/share/toaster/include/admin.pass root@$dhost:/usr/share/toaster/include # rsync --progress -zv -are ssh /usr/share/toaster/include/admin.htpasswd root@$dhost:/usr/share/toaster/include # [ ! -d /etc/mail/spamassassin ] && sqadj= || sqadj=mail/ # rsync --progress -zv -are ssh /etc/${sqadj}spamassassin/.spamassassin/ root@$dhost:/etc/mail/spamassassin/.spamassassin # rsync --progress -zv -are ssh /etc/${sqadj}spamassassin/*.cf root@$dhost:/etc/mail/spamassassin # rsync --progress -zv -are ssh /usr/share/squirrelmail/plugins/ root@$dhost:/usr/share/squirrelmail/plugins # rsync --progress -zv -are ssh /var/lib/squirrelmail/prefs/ root@$dhost:/var/lib/squirrelmail/prefs
Dovecot files are not necessary for EL 8/9 they are only for reference # rsync --progress -zv -are ssh /etc/dovecot/toaster.conf root@$dhost:/etc/dovecot # rsync --progress -zv -are ssh /etc/dovecot/local.conf root@$dhost:/etc/dovecot
Bring over MySQL DBs # mysqldump -u root -p dspam > dspam.sql # mysqldump -u root -p spamassassin > spamassassin.sql # mysqldump -u root -p roundcube > roundcube.sql # mysqldump -u root -p vpopmail > vpopmail.sql # scp *.sql root@$dhost:/root
On destination host DSpam & Spamassassin DB creation # mysql -u root -p vpopmail < vpopmail.sql # qmailctl cdb && qmailctl start && sleep 2s && systemctl start dovecot && toaststat
Questions, comments, suggestions, corrections...contact Eric on the QMT list