Install imapsync on CPANEL running on CentOS

I had to migrate an old email server running on a Fedora Core 6 to a cPanel running on a CentOS 5.9

First of all, imapsync isn’t in any of the official CentOS repositories so you need to install the RPMForge repository.

Run command : uname -i

If it’s i386 then you must obtain the rpmforge below.

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

Install DAG’s GPG key

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

Verify the package you have downloaded :

rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm

Install the package :

rpm -i rpmforge-release-0.5.2-2.el5.rf.i386.rpm

However, before you go ahead and do that, you need to realise that because cPanel has it’s own set of perl modules and blocks the OS ones, you need to disable the “exclude” line in the yum configuration file.

nano -w /etc/yum.conf

In this file, you need to comment out the following like:

#exclude=apache* bind-chroot courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*

Now you can install imapsync :

yum install imapsync

CentOS does not use yum to install imapsync as Debian with apt-get.. so that you must follow these steps:

perl -MCPAN -e "install Test::Inter"
perl -MCPAN -e "install Parse::RecDescent"
perl -MCPAN -e "install Getopt::Long"
perl -MCPAN -e "CPAN::Shell->force(qw(install Date::Manip));"
perl -MCPAN -e "CPAN::Shell->force(qw(install Mail::IMAPClient));"
perl -MCPAN -e "CPAN::Shell->force(qw(install Term::ReadKey));"

Example use, where host1 is the source and host2 is the destination :

imapsync \
--host1 mail.example.co.uk --authmech1 PLAIN --user1 joe.blogs@example.co.uk --password1 12345678 \
--host2 lemon.phurix.com --authmech2 PLAIN --user2 joe.blogs@example.co.uk --password2 99999999
\

Error message received during transfer of large attachements :

Out of memory during "large" request for 67112960 bytes, total sbrk() is 469960704 bytes at /usr/local/lib/perl5/site_perl/5.8.8/Mail/IMAPClient.pm line 3006, <$fh> line 3.

Suggested stuff (by searching Google):

  • To raise it, put this in /boot/loader.conf and reboot:
  • kern.maxdsiz="1025M"
  • The memory issue is solved by using Perl module Mail-IMAPClient >= 3.26

In my case i’ve gone past this error by increasing the RAM on the server. It had 2GB, but i bumped it to 4GB.

Credits :

Install rmpforge repository for CentOS 5 :
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge#head-5aabf02717d5b6b12d47edbc5811404998926a1b

Install imapsync :
http://labs.phurix.net/posts/migrating-imap-mailboxes-to-a-cpanel-server

Install aditional perl modules :
http://ittips.pandle.net/2010/10/19/imapsync-installation-on-centos/

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.