#!/bin/cat 
# $Id: INSTALL.Centos.txt,v 1.25 2021/02/02 17:08:46 gilles Exp gilles $

This documentation is also located online at 
https://imapsync.lamiral.info/INSTALL.d/
https://imapsync.lamiral.info/INSTALL.d/INSTALL.Centos.txt

=======================================================================
               Installing imapsync on CentOS
=======================================================================

There is one section for Centos 8, 
one for Centos 7,
and one for Centos 6.

=======================================================================
               Centos 8
=======================================================================


How to install the latest imapsync on Centos 8

  dnf install wget perl-App-cpanminus gcc
  # then
  cpanm lazy Test::MockObject
  wget https://imapsync.lamiral.info/imapsync
  perl -Mlazy imapsync
  chmod +x imapsync
  ./imapsync --testslive
  ./imapsync --tests


If you encounter the following error during the run of "perl -Mlazy imapsync"
...
Can't locate object method "new" via package "Archive::Tar" at ...
FAIL install IO-String-1.08

fix it with:
  wget http://mirror.centos.org/centos/8/PowerTools/x86_64/os/Packages/perl-IO-String-1.08-31.el8.noarch.rpm 
  yum install perl-IO-String-1.08-31.el8.noarch.rpm -y

See also https://github.com/imapsync/imapsync/issues/211

=======================================================================
               Centos 7
=======================================================================

First install access to the Epel repository via yum:

  yum install epel-release

Then install imapsync and its dependencies:

  yum install imapsync

After installing imapsync, it should be able to work on your system.
A good test that shows also the basic example:

  imapsync

A live test:

  imapsync --testslive --tls1 --ssl2

Unit tests:

  imapsync --tests

=======================================================================
               Centos 7 and latest imapsync
=======================================================================

At the time of this writing (March 2020), the epel7 repository still
contains imapsync release 1.727, which is not the latest available 
imapsync release. (1.727 date is 2016/08/19 while 1.979 is 2020/01/14)

In order to install the latest imapsync I suggest the following process:

Install the epel imapsync 1.727 release via yum like mentioned above.
It will install many needed packages, Perl itself and Perl modules 
for release 1.727. The latest imapsync needs more Perl modules.

Then:

  yum install perl-App-cpanminus \
 perl-Dist-CheckConflicts \
 perl-HTML-Parser \
 perl-libwww-perl \
 perl-Module-Implementation \
 perl-Module-ScanDeps \
 perl-Package-Stash \
 perl-Package-Stash-XS \
 perl-PAR-Packer \
 perl-Regexp-Common \
 perl-Sys-MemInfo \
 perl-Test-Fatal \
 perl-Test-Mock-Guard \
 perl-Test-Requires \
 perl-Test-Deep \
 perl-File-Tail \
 perl-Unicode-String \
 perl-Test-NoWarnings \
 perl-Test-Simple \
 perl-Test-Warn \
 perl-Sub-Uplevel 

Also, run the following commands:

  cpanm Encode::IMAPUTF7 
  wget -N https://imapsync.lamiral.info/imapsync
  chmod +x imapsync
  ./imapsync --testslive

Now you should have the latest imapsync locally working on Centos 7.

If you want to install it and replace the old one:

  mv /usr/bin/imapsync  /usr/bin/imapsync_old
  cp ./imapsync /usr/bin/imapsync

  imapsync --version

should give the latest release number instead of 1.727
(It is 1.979 at the time of this writing)

If you want to install an online imapsync service
like /X then you also need a recent decent CGI.pm,
add it with cpanm:

  cpanm CGI 


=======================================================================
               Centos 6
=======================================================================

This section has been tested with imapsync release 1.670

First, install access to the Epel repository
 
  wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
  rpm -Uvh epel-release-6-8.noarch.rpm

Then install imapsync and its dependencies:

 yum install imapsync

After installing imapsync, it should be able to work on your system.
A good test that shows also the basic example:

  imapsync

A live test:

  imapsync --testslive
  
Unit tests:

  imapsync --tests

=======================================================================
               Centos 6 and latest imapsync
=======================================================================

Install the epel imapsync 1.670 release via yum like mentioned above.

It will install many needed packages, Perl itself and Perl modules 
for release 1.670. The latest imapsync needs more Perl modules.

Then:

  yum install perl-App-cpanminus \
 perl-Dist-CheckConflicts \
 perl-HTML-Parser \
 perl-libwww-perl \
 perl-Module-Implementation \
 perl-Module-ScanDeps \
 perl-Package-Stash \
 perl-Package-Stash-XS \
 perl-PAR-Packer \
 perl-Regexp-Common \
 perl-Sys-MemInfo \
 perl-Test-Fatal \
 perl-Test-Mock-Guard \
 perl-Test-Requires \
 perl-Test-Deep \
 perl-File-Tail \
 perl-Unicode-String

  wget https://imapsync.lamiral.info/imapsync

  chmod +x imapsync
  ./imapsync --testslive

Now you have the latest imapsync on Centos 6, 
do you?

=======================================================================
=======================================================================
