Topic: The easiest way to upgrade Dovecot 1.x to 2.0 on RHEL/CentOS 5.
Just want to show you how easy to upgrade Dovecot-1.x to 2.0 on RHEL/CentOS 5.
We are going to setup a new virtual machine with RHEL/CentOS 6, so that we have a working config file for Dovecot-2.0. Then simply copy it after we upgraded Dovecot packages.
[+] If you don't want to setup a new virtual machine, we have a sample Dovecot-2.0 config file available for your use: https://bitbucket.org/zhb/iredmail/raw/ … ecot2.conf
[+] If you're running Debian, just setup a Debian virtual machine to get sample Dovecot-2 config file. The same to other Linux/BSD distributions.
Important notes before you start
[+] The latest iRedMail forces clients to use secure connection for POP3 and IMAP services, if you don't want to do this, please check this tutorial: How to allow insecure POP3/IMAP connection
*) Download Dovecot-2.0 from below URLs:
[+] Dovecot-2.0.x: http://packages.atrpms.net/dist/el5/dovecot-2.0.x/
[+] dovecot-managesieve and dovecot-pigeonhole: http://packages.atrpms.net/dist/el5/dovecot-pigeonhole/
*) Backup Dovecot config file first.
[+] WARNING: Please copy files with '-p' option to keep file owner and permission.
[+] Note: We backup /etc/dovecot.conf, but we don't use it for upgrading at all. it's useful if you want to downgrade from Dovecot-2.0 to 1.x.
# mkdir /root/dovecot-backup/ # cp -p /etc/dovecot.conf /root/dovecot-backup/old.dovecot.conf # cp -p /etc/dovecot-* /root/dovecot-backup/
*) Setup a virtual machine (VMware/Xen/VirtualBox/KVM/etc), install RHEL/CentOS 6 on it. Then deploy iRedMail. iRedMail will install Dovecot-2.0 for you. Its config files are all placed under /etc/dovecot/. Main config file is /etc/dovecot/dovecot.conf.
Again, If you don't want to setup a new virtual machine, we have a sample Dovecot-2.0 config file available for your use: https://bitbucket.org/zhb/iredmail/raw/ … ecot2.conf
Note: iRedMail doesn't use config files under /etc/dovecot/conf.d/.
[+] Copy /etc/dovecot/dovecot.conf to your iRedMail server which running Dovecot-1.x. assume it's /root/dovecot2.conf.
[+] Now open /root/dovecot2.conf, make sure you have the same values for below parameter as Dovecot-1.x.
# Make sure Dovecot has right owner/permission to store received emails. mail_uid = mail_gid = first_valid_uid = last_valid_uid = # Make sure Dovecot will delivers email to correct mailboxes. mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/ # Append this domain name if client gives empty realm (no '@domain.com' part in login username). auth_default_realm = # Make sure per-user sieve filters can be read/write. sieve_dir = /%Lh/sieve sieve = /%Lh/sieve/dovecot.sieve
After you sync above parameters in new config file, it's ready to upgrade Dovecot-1.x.
*) Stop Dovecot service and remove RPM packages.
# /etc/init.d/dovecot # rpm -e dovecot dovecot-managesieve dovecot-pigeonhole
*) Install Dovecot-2.0 you download. it's mentioned above (step 1).
# rpm -ivh dovecot-2.0.xxx dovecot-pigeonhole-xxx dovecot-managesieve-xxx
*) Copy sample config file to /etc/dovecot/:
# cp /root/dovecot2.conf /etc/dovecot/dovecot.conf # chown root:root /etc/dovecot/dovecot.conf # chmod 0664 /etc/dovecot/dovecot.conf
*) Restore backup files to /etc/dovecot/. Again, copy files with '-p' option to keep file owner and permission.
# cp -p /root/dovecot-backup/dovecot-* /etc/dovecot/
*) It's now ok to restart Dovecot service and testing:
# /etc/init.d/dovecot restart
Dovecot logs to /var/log/dovecot.log by default, so please send some testing emails and make sure no error occur.
[+] You may want to move /etc/dovecot*.conf (used by Dovecot-1.x) to another place to avoid confusion.