Aug 23 2013

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 [email protected] --password1 12345678 \
--host2 lemon.phurix.com --authmech2 PLAIN --user2 [email protected] --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 :

Install imapsync :

Install aditional perl modules :

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


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