CentOS 7.x migrate CentOS 6.x postfix, dovecot, squirrelmail server

From Notes_Wiki
Revision as of 14:57, 17 December 2017 by Saurabh (talk | contribs)

<yambe:breadcrumb>CentOS_7.x_email_configuration|CentOS 7.x email configuration</yambe:breadcrumb>

CentOS 7.x migrate CentOS 6.x postfix, dovecot, squirrelmail server

Following steps can be used for migrating a running mail server setup from CentOS 6.8 created using Configuring basic SMTP, IMAP, POP and HTTP access for complete email on a single server to CentOS 7.4:

  1. Create a new VM with necessary resources (Eg t2.micro)
  2. Add elastic IP to instance if not done already
  3. yum -y install vim
  4. Mount partition to /home as desired
  5. Copy keys from old server to new server as authorized
  6. Add /etc/hosts entry in old server for pointing to new server with name (eg newserver)
  7. yum -y install httpd mod_ssl
  8. systemctl stop firewalld
  9. TODO - Copy firewalld configuration from old server to new server
  10. Edit /etc/httpd/conf.d/ssl.conf with
    SSLCertificateFile /etc/httpd/conf/ssl.crt
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key
    SSLCACertificateFile /etc/httpd/conf/ca-bundle.pem
    and copy corresponding files from old server to new server
  11. systemctl start httpd
  12. systemctl status httpd
  13. systemctl enable httpd
  14. Copy home ( rsync -aHz --delete /home/ root@newserver:/home/ )
  15. Repeat rsync again after it finishes for a second sync
  16. cat /etc/passwd on old server. Copy all lines for UID >=500 and append corresponding lines to /etc/passwd on new server. The number of lines should match ls -1 /home | grep -v lost | wc -l Be watchful for IDs <500 which might appear in between (eg nscd)
  17. Copy /etc/shadow lines of corresponding users from old server to new server
  18. Copy /etc/group lines of corresponding users from old server to new server
  19. Do "ls -l /home" on new server and all user and group names should appear properly
  20. copy custom aliases from /etc/aliases to new server and update root alias appropriately
  21. newaliases
  22. yum -y install logwatch
  23. yum -y install postfix
  24. Edit /etc/postfix/main.cf on new server and correct values of following variables by looking at old server
    • myhostname
    • mydomain
    • myorigin
    • inet_interfaces
    • mydestination
    • home_mailbox
  25. Set hostname in /etc/hostname file on new server
  26. Use "hostname <fqdn>" command to set current hostname on new server
  27. systemctl enable postfix
  28. Add hostname against 127.0.0.1 in /etc/hosts
  29. systemctl start postfix
  30. systemctl status postfix
  31. yum -y install dovecot
  32. Edit etc/dovecot/conf.d/10-mail.conf and set
    mail_location = maildir:~/mail
    first_valid_uid = 500
    same as old server
  33. systemctl enable dovecot
  34. systemctl start dovecot
  35. systemctl status dovecot
  36. Refer Postfix_SMTP_authentication_using_dovecot and if authentication is enabled on old server then enable it appropriately on new server also
  37. yum -y install wget
  38. yum -y install epel-release
  39. yum -y install squirrelmail
  40. Disable selinux (setenforce 0, edit /etc/sysconfig/selinux and set SELINUX=disabled)
  41. cd /usr/share/squirrelmail/config; ./conf.pl
    • Set Organization Preferences -> Organization name
    • Set Server Settings -> Domain
    • Set Server Settings -> IMAP Settings. Use values mail.sbarjatiya.com, 993, Secure (IMAP): true, Server software: dovecot
    • Setup mail sending using sendmail and not through SMTP
  42. rsync /var/www/html from old server to new server
  43. systemctl restart httpd
  44. Add /etc/hosts entry for new server in laptop and try to open the new server with name and IP.
  45. On old server stop httpd, dovecot and postfix
  46. Again sync /home ( rsync -aHz --delete /home/ root@newserver:/home/ )
  47. Change DNS entries to point to new server. If organization has local private DNS, then perhaps that may also require changes.
  48. Check updated entries via public DNS servers after waiting for a minute or two
  49. Copy /root/.ssh/authorized_keys from old server to new server
  50. Comment /etc/host entry in laptop after DNS entry has been changed
  51. Apply security group settings from old server to new server (HTTP, HTTPS, POP3, POP3S, SMTP, SMTPS, IMAP, IMAPS, SSH, Ping)
  52. Do TLS_configuration_for_postfix if configured on previous server
  53. Send test email from gmail to server and wait for receiving email on new server
  54. Send test email from new server to gmail and wait for receiving email on Gmail account
  55. stop and possibly terminate old server after few days. Elastic IP of old server can be released immediately after stopping.
  56. If elastic IP is locked make a request for release
  57. Fill AWS reverse entry form for email servers
  58. CentOS 7.x Configure change password plugin for squirrelmail using poppassd

Refer: - https://serverfault.com/questions/291667/dovecot-getting-error-mail-access-for-users-with-uid-222-not-permitted



<yambe:breadcrumb>CentOS_7.x_email_configuration|CentOS 7.x email configuration</yambe:breadcrumb>