April 17, 2011

 Using Unison with Atmail

Unison allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other. In other words, it can be used for two-way synchronization between your servers.

For illustrative purposes in this example, the Unison Master hostname will be called "master-foo-01"; the Client hostname will be called "slave-foo-02".

To setup Unison on your machine, do the following for both machines:

1.) Download the dependency, OCaml from: http://caml.inria.fr/download.en.html

atmail@master-foo-01# wget "http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.0.tar.gz"

2.) Install emacs (a dependency):

atmail@master-foo-01# yum install emacs

3.) Unpack, install OCaml:

atmail@master-foo-01# tar xvfz ocaml-3.12.0.tar.gz
atmail@master-foo-01# cd ocaml-3.12.0
atmail@master-foo-01# ./configure && make world
atmail@master-foo-01# make opt
atmail@master-foo-01# make install

4.) Download Unison from: http://www.cis.upenn.edu/~bcpierce/unison/download.html

atmail@master-foo-01# wget "http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/unison-2.40.63.tar.gz"

5.) Untar, install:

atmail@master-foo-01# make world opt
atmail@master-foo-01# sudo make install

6.) Move the Unison binary to your preferred prefix. We suggest /usr/bin/:

atmail@master-foo-01# mv unison /usr/bin/unison
atmail@master-foo-01# chmod 755 /usr/bin/unison

7.) You will then need to set the keys. Create a SSH public key on the Master server:

atmail@master-foo-01# ssh-keygen -t rsa

8.) This will produce a public key in /home/atmail/.ssh/id_rsa.pub. Copy the .pub file to the Slave machine:

atmail@master-foo-01# scp /home/atmail/.ssh/id_rsa.pub root@slave-foo-02:/home/atmail/.ssh/id_rsa.pub

9.) Pipe the public key into a file called authorized_keys, in your .ssh directory.

atmail@slave-foo-02# cat /home/atmail/.ssh/id_rsa.pub >> authorized_keys

10.) Make sure that the authorized_keys file, and all of the contents of the .ssh directory have 600 permissions:

atmail@slave-foo-02# chmod 600 /home/atmail/.ssh/*

11.) Try to login, sans password, from the Master machine to the Client machine.

atmail@master-foo-01# ssh atmail@slave-foo-02

12.) This should allow you to login. Now, you can try to sync the differences between the users/ directory of the master and slave machines. From any of the machines, execute:

atmail@master-foo-01# unison -batch -auto /usr/local/atmail/users ssh://slave-foo-01//usr/local/atmail/users

13.) The output should be similar to:

UNISON 2.40.63 finished propagating changes at 01:25:25.57 on 18 Apr 2011
Saving synchronizer state
Synchronization complete at 01:25:25  (xx items transferred, 0 skipped, 0 failed)

14.) You will need to set this in cron. Create a file called /home/atmail/unison.sh. In the file:

#!/bin/sh
/usr/bin/unison -batch -auto /usr/local/atmail/users ssh://slave-foo-01//usr/local/atmail/users

15.) Set permissions:

% chmod 755 /home/atmail/unison.sh

16.) Add an entry to your /etc/crontab. It will look like:

01,10,20,30,40,50 * * * * atmail /home/atmail/unison.sh

This will synchronize your /usr/local/atmail/users directory for both machines.


Filed under: Uncategorized, Multiserver, OS, Atmail 5, Atmail 6 — John Contad @ 10:13 pm

 

April 3, 2011

 Manually Upgrading Atmail 6.x.x Appliance to Atmail 6.20.7 +

If you wish to upgrade your appliance to the latest version of Atmail (6.20.7+), please do the following.

1. Download latest version

To install the latest Atmail patch download a copy from the client-portal page - http://atmail.com/portal/ or download the latest evaluation version.

In these instructions, replace [version] with your current version of Atmail. These are generic instructions to upgrade any previous release of Atmail 6.X to the latest version. The process is designed to be as straightforward as possible, and uses the WebAdmin interface to help simplify the upgrade.

2. Backup

Note: The upgrade and migration scripts have been used for production systems and considered stable.

Before proceeding it is strongly recommended that you make a backup of your current Atmail installation:

mysqldump -u root -p atmail6 > /usr/local/atmail/atmail6[version]-backup.sql

tar cfvz atmail6[version]-backup.tgz /usr/local/atmail /etc/httpd/conf/httpd.conf /etc/init.d/atmailserver

This is required before you upgrade in case you need to roll-back any changes, do not skip this step.

Any customizations to Atmail (PHP, HTML, MTA-related code changes) must be backed up. The upgrade process will overwrite any modifications, and these must be merged in after the upgrade./

3. Extract the patch out into the directory for Atmail

Extract the files:

tar xfvz atmail6.mailserver.tgz -C /usr/local/

4. Permissions

You will now need to give Atmail correct permissions.

chown -R atmail /usr/local/atmail/webmail/

5. Rename Files

You will now need to rename the following file.
mv /usr/local/atmail/mailserver/bin/atmail-update-version /usr/local/atmail/mailserver/bin/atmail-update-version.off

6. WebAdmin Update

Visit the WebAdmin of Atmail and use the Update software link. This will guide you through the web-based upgrade utility for the database schema updates and config changes:

e.g http://server.com/mail/index.php/admin/

Where server.com/mail/index.php is the URL of the Atmail software on your server.Login to Web Administration using your admin username/password, then click the License tab > Update software.

7. Command Line Update

Depending on the software update, additional packages may need to be re-installed or re-compiled if you are using the Email Server version of Atmail. If prompted during the Web Admin upgrade, run the additional upgrade utility from a command-line:

cd /usr/local/atmail/ php server-update.php [version]

Where [version] is the previous version of Atmail installed.

8. Upgrade Complete

Congratulations, the upgrade is now complete. You can now reload the Webmail interface of Atmail and begin using the latest release and features.If you've made any customizations to the HTML templates, images, or source-code, these changes will need to be copied back in after the upgrade. We recommend using the “diff” command-line utility to compare any local customizations to the latest version.

Troubleshooting

Force Re-Run UpgradeIf you run into any troubles with the upgrade you may need to re-run the upgrade process.

Assuming that your last version was 6.20.1; Login to your Atmail database and execute the following command.

update Config set keyValue = "6.20.1" where keyName = "version";

This will fool the WebAdmin update scripts and enable re-running the sql schema updates via the WebAdmin > License > Update Software.

Following the success of the WebAdmin update, please then execute the server-update.php file as the update page will instruct you.

php server-update.php 6.20.1


Filed under: Installation, Atmail 6 — Stewart Bazley @ 5:49 pm