Posted by aionman on Jan 8, 2010 in
Zimbra
In this Zimbra Administrator’s PowerTip, we’ll discuss how to move your instance of Zimbra to another machine. It applies to all version of Zimbra.

Administrator’s PowerTip
#4: October 09, 2007
Zimbra Forums –
Zimbra wiki –
Zimbra
Blog
Introduction
Either you, or someone you know has been there. Almost out of Disk space, RAM is topped out, and the CPU is constantly running above 80%. It’s time to upgrade the hardware. But how easy and safe is it to move the Zimbra server instance? Well, it’s easier than you might think.
In this Zimbra Administrator’s PowerTip, we’ll discuss how to migrate your Zimbra server to another Machine or OS. The one big caveat is that both instances of Zimbra MUST be running the same version. So if your old server is running 4.5.5, then you’ll need to install 4.5.5 on your new server. This wouldn’t be the time to upgrade your ZCS version.
Part 1 : Backing Up
Step by Step:
- As zimbra: zmcontrol stop
- As root: ps aux | grep zimbra (make sure everything’s stopped)
- Mount external disc to location of your choice. ex: /mnt/migration
- As root: rsync -avH /opt/zimbra /mnt/migration (this may take a while)
Zimbra Network Edition contains a backup feature, and although it’s useful, we won’t be using it in this tip.
We have an external Hard Disc mounted to /mnt/migration. When rsync’ed, this is now your live copy (although it’s not live), and you should always have a backup of your live data. So, you might want to rsync again to another location to be safe.
Once you’ve rsync’ed all your data, umount the external drive, and put it somewhere safe.
Part 2 : Meet Your New Server
Step by Step:
- Install Newer (supported) Operating System
- Turn off older ZCS Server
- Set up newer ZCS Server’s Network/Hostname is it was on the older server
The only thing that really matters on your new server, is whether or not meets Zimbra’s server Hardware and the Operating System requirements.
It’s also very important that you have resolved any dependency issues. The ZCS installer for your newer OS should check for these.
Setup the newer server with the old server’s networking attributes. Make sure your older server is offline.
If changing the hostname, please see this wiki article: Set zmhostname
Part 3 : Create a “dummy” Install Then Remove It
Step by Step:
- Download the version of ZCS (ie 4.5.5 or 4.0) for the new OS you have
- As Root: Run the installer with the -s option: ./install.sh -s
- As Root: Remove the dummy install: rm -rf /opt/zimbra
The goal of this step is to get the rpm/dpkg databases correct. When you download ZCS, make sure it’s for your newer OS, and the SAME version of ZCS that’s rsync’ed.
Run the installer with the -s option. This tells the installer to only install the software, and not to configure the installation.
Once the installer has completed, delete it by rm -rf /opt/zimbra. This wipes any dummy data you have in that location.
Part 4 : Mount Your Backup HD, rsync, and Install
Step by Step:
- Mount external Hard drive
- As Root: rsync your backup to the new location: rsync -avH /mnt/migration/zimbra /opt/
- Unmount external Hard drive and keep it safe
- As Root: run zmfixperms located in /opt/zimbra/libexec
- As Root: rerun the installer without the -s option
Connect and mount your external hard drive. Then, rsync the backed up data to its new location (rsync -avH /mnt/migration/zimbra /opt).
Connect and mount your external hard drive. Then, rsync the backed up data to its new location (rsync -avH /mnt/migration/zimbra /opt).
Unmount your backed up copy, and keep it in a safe place.
Now that our data is all in place, we need to fix some permissions. Go into the /opt/zimbra/libexec directory and run zmfixperms. This helps insure that all the files are owned correctly.
Once that has completed, re run the installer that you downloaded. It will detect ZCS already installed, and ask if you want to upgrade. Select Yes.
Another useful guide
Network Edition: Moving from 32-bit to 64-bit Server
http://wiki.zimbra.com/index.php?title=Network_Edition:_Moving_from_32-bit_to_64-bit_Server
Posted by aionman on Oct 29, 2009 in
Zimbra
Here is an example, using the “raw_logs” table:
$ logmysql zimbra_logger
mysql> check table raw_logs;
+————————+——-+———-+———-+
| Table | Op | Msg_type | Msg_text |
+————————+——-+———-+———-+
| zimbra_logger.raw_logs | check | status | OK |
+————————+——-+———-+———-+
1 row in set (1.06 sec)
If a table does not show OK status, try repairing:
mysql> repair table raw_logs;
+————————+——–+———-+———-+
| Table | Op | Msg_type | Msg_text |
+————————+——–+———-+———-+
| zimbra_logger.raw_logs | repair | status | OK |
+————————+——–+———-+———-+
1 row in set (2.32 sec)
How to shrink logger database
For first time is good to clean db manually if the database is very big. The commands bellow will delete all data in three tables (mta, amavis, raw_logs). If you need this data don’t execute them!
$zmlogswatchctl stop (don’t execute “zmloggerctl stop” this also stops logger mysqld)
$logmysql -D zimbra_logger
mysql> delete from amavis;
mysql> optimize table amavis;
mysql> delete from mta;
mysql> optimize table mta;
mysql> delete from raw_logs;
mysql> optimize table raw_logs;
mysql> quit
$zmlogswatchctl start
Posted by aionman on Aug 11, 2009 in
Ubuntu,
Zimbra
Ubuntu Backup and Restore
1: Backing-up
To do this, become root with
and go to the root of your filesystem (we use this in our example, but you can go anywhere you want your backup to end up, including remote or removable drives.)
Now, below is the full command I would use to make a backup of my system:
Code:
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
Since I always keep an update copy of my mail server, I’ll exclude that from the backup as well
Code:
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exlucde=/backup --exclude=/opt/zimbra /
Now, lets explain this a little bit.
The ‘tar’ part is, obviously, the program we’re going to use.
‘cvpfz’ are the options we give to tar, like ‘create archive’ (obviously),
‘preserve permissions’(to keep the same permissions on everything the same), and ‘gzip’ to keep the size down.
Next, the name the archive is going to get. backup.tgz in our example.
Next comes the root of the directory we want to backup. Since we want to backup everything; /
Now come the directories we want to exclude. We don’t want to backup everything since some dirs aren’t very useful to include. Also make sure you don’t include the file itself, or else you’ll get weird results.
You might also not want to include the /mnt folder if you have other partitions mounted there or you’ll end up backing those up too. Also make sure you don’t have anything mounted in /media (i.e. don’t have any cd’s or removable media mounted). Either that or exclude /media.
EDIT : kvidell suggests below we also exclude the /dev directory. I have other evidence that says it is very unwise to do so though.
Well, if the command agrees with you, hit enter (or return, whatever) and sit back&relax. This might take a while.
Afterwards you’ll have a file called backup.tgz in the root of your filessytem, which is probably pretty large. Now you can burn it to DVD or move it to another machine, whatever you like!
EDIT2:
At the end of the process you might get a message along the lines of ‘tar: Error exit delayed from previous errors’ or something, but in most cases you can just ignore that.
Alternatively, you can use Bzip2 to compress your backup. This means higher compression but lower speed. If compression is important to you, just substitute
the ‘z’ in the command with ‘j’, and give the backup the right extension.
That would make the command look like this:
Code:
tar cvpjf backup.tar.bz2 --exclude=/proc --exclude=/lost+found --exclude=/backup.tar.bz2 --exclude=/mnt --exclude=/sys /
2: Restoring
Warning: Please, for goodness sake, be careful here. If you don’t understand what you are doing here you might end up overwriting stuff that is important to you, so please take care!
Well, we’ll just continue with our example from the previous chapter; the file backup.tgz in the root of the partition.
Once again, make sure you are root and that you and the backup file are in the root of the filesystem.
One of the beautiful things of Linux is that This’ll work even on a running system; no need to screw around with boot-cd’s or anything. Of course, if you’ve rendered your system unbootable you might have no choice but to use a live-cd, but the results are the same. You can even remove every single file of a Linux system while it is running with one command. I’m not giving you that command though! 
Well, back on-topic.
This is the command that I would use:
Code:
tar xvpfz backup.tgz -C /
Or if you used bz2;
Code:
tar xvpfj backup.tar.bz2 -C /
WARNING: this will overwrite every single file on your partition with the one in the archive!
Just hit enter/return/your brother/whatever and watch the fireworks. Again, this might take a while. When it is done, you have a fully restored Ubuntu system! Just make sure that, before you do anything else, you re-create the directories you excluded:
Code:
mkdir proc
mkdir lost+found
mkdir mnt
mkdir sys
etc...
And when you reboot, everything should be the way it was when you made the backup!
2.1: GRUB restore
Now, if you want to move your system to a new harddisk or if you did something nasty to your GRUB (like, say, install Windows), You’ll also need to reinstall GRUB.
There are several very good howto’s on how to do that here on this forum, so i’m not going to reinvent the wheel. Instead, take a look here:
http://www.ubuntuforums.org/showthre…t=grub+restore
There are a couple of methods proposed. I personally recommend the second one, posted by remmelt, since that has always worked for me.
Re: HOWTO: Restore GRUB (if your MBR is messed up)
Isn’t it easier to do this:
1. Pop in the Live CD, boot from it until you reach the desktop.
2. Open a terminal window or switch to a tty.
3. Type “grub”
4. Type “root (hd0,6)”, or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda7, which translates to hd0,6 for grub).
5. Type “setup (hd0)”, ot whatever your harddisk nr is.
6. Quit grub by typing “quit”.
7. Reboot.
I may be missing your point though, if so, please forgive me 
Quote:
Originally Posted by vnbuddy2002
Restore GRUB quite simple in Ubuntu, instead going through all the “gain root access” and play with shell commands, you can use the Ubuntu installation CD to
restore it without going through all kinds of hassles.Here are the steps:
1. Boot your computer up with Ubunto CD
2. Go through all the process until you reech “[!!!] Disk Partition”
3. Select Manual Partition
4. Mount your appropriate linux partions
/
/boot
swap
…..
5. DO NOT FORMAT THEM.
6. Finish the manual partition
7. Say “Yes” when it asks you to save the changes
8. It will give you errors saying that “the system couldn’t install …..” after that
9. Ignore them, keep select “continue” until you get back to the Ubuntu installation menu
10. Jump to “Install Grub ….”
11. Once it is finished, just restart your computer
Good luck!.
Zimbra Emergency Repairs
Preparing to Back Up
Before we begin, make sure that you are logged in as a user that can perform the tasks outlined here.
It is always good practice to backup your copy of Zimbra in the event of unforeseen circumstances.
To prevent changes to any Zimbra databases during the backup processes you may wish to use:
>su zimbra
>zmcontrol stop
to terminate Zimbra.
If you get some kind of error, you may want to make sure that Zimbra has completly stopped by running:
>ps auxww | grep zimbra
and kill any left over processes such as the log.
Alternatively as root you could run the following command to kill all Zimbra user owned processes instantly (use wisely):
>ps auxww | awk '{print $1" "$2}' | grep zimbra | kill -9 `awk '{print $2}'`
Backing Up
Make sure that the copy location has enough space to support your backup copy (i.e. the /tmp folder probably isn’t the best location).
Since all of the components Zimbra needs are stored in the Zimbra folder itself, you can simply copy the folder to a safe location.
It may be possible to create a cron job to do these tasks automatically.
Copy Command: cp -Rp /opt/zimbra [location path]
Depending on your hardware and the amount of data contained in your Zimbra installation, this process can take a while.
Note: It is a very good idea to tag your installation with the version/build of zimbra that will be backed up (ie 3.0.0_GA_156) and the date of backup. You’ll need this later.
Restoring
Before restoring, you should make sure that all of the processes accociated with the damaged/failed Zimbra installation are terminated. Failure to terminate all of the processes could have dire consquences. See “Preparing to Backup” for additional info.
====Rename your “broken” Zimbra installation.’
You may be able to scavenge data, if needed. If you simply do not want the old data, you can skip this part.
>mv /opt/zimbra [new location i.e. /tmp/zimbra-old]
You may want to move it completly out of the /opt folder just to be safe.
Copy your backup Zimbra installation to the /opt folder and name it “zimbra”.
>cp -rp [location of backup] /opt
>mv /opt/[backup name] /opt/zimbra
Restore to Existing/Backup Zimbra Server
In the event of a failure, you can either restore your /opt/zimbra folder to a server that is not currently running Zimbra and download a dummy copy of Zimbra and run an upgrade in order to clean everything up and make it run correctly again (see next section), or you may restore the backup to an existing Zimbra server. This will only work if the existing server is running the EXACT SAME VERSION of Zimbra as the backup you want to restore. Also, this has been tested and seems to work well with CE 4.5.8, but did not work with 4.5.7. This may be, for example, a backup email server that you want to always keep current with last night’s backup, so it can replace the production server on short notice in the event of a disaster.
Simply set up your backup server identical to your production server (preferably the same OS, but necessarily the exact same version of Zimbra). Any modifications you made or packages you added for your production server with regards to extra anti-spam protection, etc., should also be added to this server. Shut down Zimbra on the backup server. Copy /opt/zimbra from your backup to the backup server.
chown -R zimbra:zimbra /opt/zimbra
/opt/zimbra/libexec/zmfixperms
Start Zimbra. Everything should work. The advantage to this method is that you can retain all your customizations (anti-spam modifications, for example) that would otherwise have been lost in the “upgrade” method. Also, this allows you to use a script to keep a backup server current without having to reinstall Zimbra after each time the backup server is made current, or before putting the backup server into production in the event of a failure.
Downloading a Dummy Copy of Zimbra
Now, we need to know what build/version of zimbra you were running. If you followed the backup instructions above, then the backup folder should be tagged with the version/build you have backed up.
You need to download the full install of the Zimbra version you were running. You may find all Zimbra releases at: Sourceforge.
If you don’t know your version number, you can find it by:
Method 1 - view install_history file.
cat /opt/zimbra/.install_history
Method 2 - dont think this will work unless you did a bunch of chroots.
zmcontrol -v
Both of the above listed methods were from this forum post
Installing the Dummy Copy of Zimbra
Once you have downloaded the tar file, you will need to uncompress it by:
>tar -xvzf [name of file].tgz
This will create a folder in the directory named “zcs”, cd to it and run the install script:
>cd zcs
>./install.sh
WARNING: Do not run the script with the -u option. You will remove all of your backup data & you must run the script as root, NOT ZIMBRA.
The script will remove the existing packages, and install them again. The script will attempt to stop Zimbra Services and “UPGRADE FAILED – exiting”. This is okay, simply rerun the script, and it will install normally.
If you experence error 389, -1, connection refused errors, please search the Forums. These errors are covered extensivly.
Resetting Permissions
If you are up and running now, you may have one more hurdle to overcome: permissions.
You may need to reset the permissions on the message store by running the following:
>/opt/zimbra/libexec/zmfixperms
This is potentially a dangerous suggestion, but if you have trouble getting tomcat to start even after you run zmfixperms, try running (worked for ZCS 4.5.7 CE)
chown -R zimbra:zimbra /opt/zimbra
Of course, you must run
/opt/zimbra/libexec/zmfixperms
again after that. It appears that zmfixperms is supposed to chown zimbra:zimbra on something, but it misses it. This way, you chown EVERYTHING zimbra:zimbra, and zmfixperms puts back things that need to be owned as root, postfix, etc.
Disaster Recovery
In the unfortunate event of losing your complete server or installation, the following will get you up and running.
This has been tested successfully on v5.0.5
- The machine you are recovering to must have the same hostname as the original machine.
- Once you have your OS and all pre-requisites installed. Download and install Zimbra as normal.
- Once Zimbra is installed, stop all Zimbra services and move/rename the /opt/zimbra folder:
sudo -u zimbra /opt/zimbra/bin/zmcontrol shutdown
mv /opt/zimbra /tmp/zimbra-old
- Uncompress the most recent backup file to the /opt/zimbra folder
mkdir /opt/zimbra
tar zxvf [backup file] -C /opt/zimbra
or if you prefer…
tar zxvf [backup file] -C /tmp/zimbra-backup
cp -Rp /tmp/zimbra-backup /opt/zimbra
- Fix the Zimbra permissions
chown -R zimbra:zimbra /opt/zimbra
/opt/zimbra/libexec/zmfixperms
- Restart all Zimbra services
sudo -u zimbra /opt/zimbra/bin/zmcontrol startup
zmcontrol startup
You should now be able to access Zimbra as normal.
Posted by aionman on Aug 10, 2009 in
Zimbra
Account mailbox database structure
Each zimbra account is associated with a mailbox group, which is based on the mailbox id number. (The mailboxId is specific to the store, the zimbraId on the other hand is system wide). You can determine the mailbox id for an account (this example account is named “b@test.test”) like this:
$ zmprov getMailboxInfo b@test.test
mailboxId: 5247
quotaUsed: 1951021
Mailbox users are members of mailbox groups on a rotation up to a maximum of 100 mailbox groups; you can determine the mailbox group by modulo division of the mailbox id by 100 (the remainder of dividing the mailbox id by 100, i.e only the last two digits). Note that if the result is zero, the mailbox group is 100, not 0.
$ expr 5247 % 100
47
Take a look at the mail_item table in the mailbox group database, particularly the date, size, sender, and subject columns.
$ mysql mboxgroup47
mysql> describe mail_item;
+--------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------------------+------+-----+---------+-------+
| mailbox_id | int(10) unsigned | NO | PRI | | |
| id | int(10) unsigned | NO | PRI | | |
| type | tinyint(4) | NO | | | |
| parent_id | int(10) unsigned | YES | | NULL | |
| folder_id | int(10) unsigned | YES | | NULL | |
| index_id | int(10) unsigned | YES | | NULL | |
| imap_id | int(10) unsigned | YES | | NULL | |
| date | int(10) unsigned | NO | | | |
| size | int(10) unsigned | NO | | | |
| volume_id | tinyint(3) unsigned | YES | MUL | NULL | |
| blob_digest | varchar(28) | YES | | NULL | |
| unread | int(10) unsigned | YES | | NULL | |
| flags | int(11) | NO | | 0 | |
| tags | bigint(20) | NO | | 0 | |
| sender | varchar(128) | YES | | NULL | |
| subject | text | YES | | NULL | |
| name | varchar(128) | YES | | NULL | |
| metadata | text | YES | | NULL | |
| mod_metadata | int(10) unsigned | NO | | | |
| change_date | int(10) unsigned | YES | | NULL | |
| mod_content | int(10) unsigned | NO | | | |
+--------------+---------------------+------+-----+---------+-------+
Let’s examine a single mail item.
mysql> select * from mail_item where id>26000 and mailbox_id=5247 limit 1 \G
*************************** 1. row ***************************
mailbox_id: 5247
id: 26001
type: 5
parent_id: NULL
folder_id: 2
index_id: 26001
imap_id: 26001
date: 1182380903
size: 95842
volume_id: 1
blob_digest: rbrw+fj0tvyvTPt2haxssued7,A=
unread: 1
flags: 2
tags: 0
sender: sender@domain.com
subject: Message subject
name: NULL
metadata: d1:f147:This message...1:p8:Re: SF: 1:s21:sender@domain.com1:vi10ee
mod_metadata: 30102
change_date: 1182380905
mod_content: 30102
1 row in set (0.00 sec)
With the volume_id, mailbox_id, id, and mod_content fields, you can determine the location of the message “blob” file. Volume 1 is the default message store:
mysql> select * from zimbra.volume;
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
| id | type | name | path | file_bits | file_group_bits | mailbox_bits | mailbox_group_bits | compress_blobs | compression_threshold |
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
| 1 | 1 | message1 | /opt/zimbra/store | 12 | 8 | 12 | 8 | 0 | 4096 |
| 2 | 10 | index1 | /opt/zimbra/index | 12 | 8 | 12 | 8 | 0 | 4096 |
+----+------+----------+-------------------+-----------+-----------------+--------------+--------------------+----------------+-----------------------+
On the filesystem, the user directories and the message directories within each user directory are split so that there are a maximum of 4096 (that is, 212) files in each directory. To determine the appropriate directory “hash” numbers, bitshift the mailbox_id and the mail item id to the right by 12 bits (i.e. divide by 212, rounding down). It is significant to note that if the id is less than 4096, the hash number will be 0.
$ perl -e 'print 5247 >> 12 ; print "\n"'
1
$ perl -e 'print 26001 >> 12 ; print "\n"'
6
The mod_content field is used to keep track of message blob file revisions. If a blob file is ever updated (for example, if a calendar appointment is modified), the filename and this field are updated. So, if the user with mailbox_id 5427 has a message on volume 1 with id 26001 and mod_content 30102, we’ll see it like this:
$ ls -l /opt/zimbra/store/1/5247/msg/6/26001-30102.msg
-rw-r----- 1 zimbra zimbra 95842 Jun 20 16:08 /opt/zimbra/store/1/5247/msg/6/26001-30102.msg
Assuming only the default message store is in use, the filename for an item may be derived with a query.
mysql> select id,
concat('/opt/zimbra/store/', (mailbox_id >> 12), '/', mailbox_id, '/msg/',
(id >> 12), '/', id, '-', mod_metadata, '.msg') as file
from mail_item where mailbox_id="723" limit 1;
+-----+-------------------------------------------+
| id | file |
+-----+-------------------------------------------+
| 261 | /opt/zimbra/store/0/723/msg/0/261-103.msg |
+-----+-------------------------------------------+
Posted by aionman on Jul 24, 2009 in
Ubuntu,
Zimbra
Ubuntu 8.04 LTS Server (Hardy Heron) Install Guide
The following guide is for installing ZCS on Ubuntu Server 8.04 LTS, and is a revision of my previous Ubuntu Server 6.06 installation guide here. Please verify which version you are using and follow the appropriate guide, as there are material differences between the two. I have tested this guide with the 32-bit version of Ubuntu only; others will need to verify if any tweaks are necessary for a 64-bit installation.
This installation is for a split-DNS setup, where the server resides on a DMZ and so needs to resolve to its own internal (DMZ subnet) IP address rather than the public IP address that is published to the world. This is a setting where a firewall/router supplies the translation from the public IP to the DMZ IP (DNAT–Destination Network Address Translation) so that translation is not known to the server itself. This configuration is desirable for security, but it makes bits of the Zimbra configuration more complex than they might otherwise be.
For simplicity’s sake I’m referring to Zimbra’s DMZ address as the “private ip address” from here on. By that I mean that the Zimbra box has only one IP address, it’s on the DMZ, and can be seen by my LAN but not the public. When I say “public IP address” I’m not talking about another address on the Zimbra box, but rather the address that gets DNATed to my box and which is resolved in the world.
Installing Ubuntu 8.04 LTS
Obtain your installation binary from Ubuntu at http://www.ubuntu.com/getubuntu/download. Be sure you download the LTS (Longterm Support) Server Edition, NOT the Desktop Edition. Burn the iso file to a CD and boot it in your server. There is an excellent, highly-detailed installation guide for this version at http://www.howtoforge.com/perfect-server-ubuntu8.04-lts. I highly recommend this guide, particularly if you are new to Linux or Ubuntu specifically. The following points need to be kept in mind as you install:
1) The installation (and the guide) want to configure your LAN via DHCP. Cancel it before it gets that far, and manually configure it with a static IP address, netmask, and gateway. Don’t put in a public DNS for your nameserver configuration; instead put in the same IP address that you just gave the machine for its own static IP (this won’t let you resolve names on the internet until we do some more configuration below, but it saves headaches later).
2) When the installation asks for a hostname, give it only a one-word hostname (e.g. “mail” or “myserver”) NOT the fully-qualified domain name (mail.mydomain.com). In the next screen where it asks for the domain name, give the “mydomain.com” part without the hostname.
3) Hard disk configuration is easy if you are using a single drive, but for a server, that’s not the most secure way to do things. Ideally you should have either a RAID-1 or a RAID 1+0 configuration for your disks to provide redundancy. Most ideally that would be hardware-RAID, but configuring it in Ubuntu is a challenge. Software RAID (native to Linux) on the other hand, is easy IF you set it up AT THE TIME YOU ARE PARTITIONING YOUR DISKS. See this howto http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1 for setup instructions if you want to use software RAID. As to partitioning your drives, you can find a variety of opinions. I just make a small partition for swap (1.5-2x RAM) and the rest for the whole system. Others will recommend separate partitions for mailstore, system, etc. Use your own judgement here.
4) Once the base system has been installed, the installer will ask you for a username, and then a password for that user. This needs to be a non-root user, and unlike previous Ubuntu versions, the user “admin” is no longer accepted. Whatever you choose, that username and password will be what you use to log in at the command line later, and the same password will be the password for sudo commands. Be sure you remember what you put in here!
5) At the “Software Selection” screen, select the DNS Server and OpenSSH Server options for installation, but nothing else. This will allow remote administration (SSH), and will install bind9 which you will need for split DNS.
6) Run the following command to make sure you have all the necessary packages: sudo apt-get install bind9 dnsutils file libgmp3c2 libexpat1 libstdc++5 libltdl3 libperl5.8 perl curl libpcre3 libc6
With these items, your installation will complete and the system will reboot.
This guide shows how to install the Zimbra Collaboration Suite (ZCS) on Ubuntu 6.10 (Edgy Eft) and 6.06 (Dapper Drake) server systems. Zimbra is a full-featured, open source collaboration suite – email, group calendaring, contacts, and web document management and authoring. It has a feature-rich AJAX web interface and is compatible with clients such as Microsoft Outlook, Apple Mail, and Novell Evolution so that mail, contacts, and calendar items can be synchronised from these to the ZCS server. It can also be synchronized to many mobile devices. ZCS makes use of many existing open source projects such as Postfix, MySQL, and OpenLDAP.
I do not issue any guarantee that this will work for you!
1.1 Enable The root Account
To enable the root account, run
and specify a password for root.
Afterwards, become root by running
All following commands in this tutorial are executed as root (unless something else is written)!
1.2 Install The SSH Daemon
Just run
apt-get install ssh openssh-server
to install the SSH daemon.
1.3 Apply A Static IP Address And Hostname
Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address 192.168.0.110):
vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.110
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
|
Then restart your network:
/etc/init.d/networking restart
Then edit /etc/hosts. Make it look like this:
127.0.0.1 localhost.localdomain localhost
192.168.0.110 mail.example.com mail
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
|
Now run
echo mail.example.com > /etc/hostname
and reboot the system:
Afterwards, run
Both should show mail.example.com.
From now on you can use an SSH client such as PuTTY and connect from your workstation to your Ubuntu server and follow the remaining steps from this tutorial.
DNS
Proper DNS configuration is PARAMOUNT! If you don’t have your DNS working properly, don’t even bother trying to install Zimbra, because trying to fix DNS after the fact may result in an install that can do everything except send mail–even from a Zimbra user to himself! So I’ll say it again:
If you can’t resolve your mailserver’s own private IP address (NOT the public IP) using nslookup, fix it BEFORE you install Zimbra!
If your installation above was successful, when you sign on at the command line you’ll be able to ping public IP addresses if you know them, but you may not be able to resolve any names to ping them.
Now you have to configure the following files, which are in the directory /etc/bind (for brevity I’ve deleted the generic comment lines included by the distro). Note that the query-source address and forwarders lines are already there, they just need to be uncommented, and in the case of the forwarders, the ip addresses of your ISP’s DNS servers need to be added. Note also that the syntax needs to be EXACTLY as shown below–leave out one semicolon or bracket and the whole thing blows up:
/etc/bind/named.conf.options
options {
directory "/var/cache/bind";
query-source address * port 53;
forwarders {
xxx.xxx.xxx.xxx; xxx.xxx.xxx.xxx;
};
auth-nxdomain no; # conform to RFC1035
};
the ip addresses on this file are public ip addresses of the DNS you use in the outside world. The line “query-source address * port 53″ is to allow your machine to hit the DNS if oddball DNS ports are blocked. You can leave it commented if you don’t need it.
Check /etc/resolv.conf and make sure it looks like this:
nameserver xxx.xxx.xxx.xxx
The IP address here should be the Zimbra box’s private ip address.
Once you’ve fixed these two files and restarted bind
/etc/init.d/bind9 restart
you should be able to resolve names in the outside world. Try something like “ping google.com” and if you get an answer, you’re on the way.
Now it’s time to get the internal zone working. Append the following lines to /etc/bind/named.conf.local
zone "mydomain.com" {
type master;
file "/etc/bind/db.mydomain.com";
};
Note that you need to type the full pathname to your db.* file. Also, be sure you don’t miss a semicolon “;” in any of these lines that have them because a missing semicolon breaks the file.
Now create your file /etc/bind/db.mydomain.com
;
; BIND data file for mydomain.com
;
$TTL 604800
@ IN SOA mail.mydomain.com. admin.mydomain.com. (
070725 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS mail
IN MX 10 mail
IN A xxx.xxx.xxx.xxx
mail IN A xxx.xxx.xxx.xxx
The ip address here is again your Zimbra internal ip address; the string “admin.mydomain.com” is replaced with the email address you are using for administration, only with a “.” instead of the “@” in the address. Be careful to increment the serial number one higher every time you modify this file or the changes won’t stick. Many users use the date they edit the file for the serial number, but as long as you start low and only get higher it really doesn’t matter.
Now you may need to reboot the machine (restarting bind9 alone doesn’t always work) and try to resolve your mail server.
nslookup mydomain.com
If it returns your public IP address, your internal DNS is not working. If things are configured correctly it’ll return the internal address.
Hosts Table
Before you get to the install you also need to modify your /etc/hosts file:
127.0.0.1 localhost.localdomain localhost
10.3.2.244 mail.tractor-equip.net mail
ONLY IF this is working, it’s now time to update your packages:
sudo bash (this will ask for your password, enter your administrator's pw, then you'll be at a root prompt)
apt-get upgrade
apt-get update
Now you’re ready to install Zimbra.
Installing ZCS
Several discussion groups have listed the dependencies not installed by the standard Linux install, but the easy thing to do is try to run the install and let Zimbra give you a list of what’s missing. Download the appropriate package for your Ubuntu installation (32 or 64 bit Ubuntu 8.04 LTS), copy it into your choice directory (I prefer /temp because /tmp is volatile and clears out every reboot), change to that directory, and type
tar -xzf zc*
and it’ll create a whole directory /temp/zcs with lots of files inside it. Then:
cd /temp/zcs
./install.sh
It’s not going to work the first time, but it’ll give you a list of missing dependencies. Write down all the package names it says are missing. Your list may be slightly different than mine, but whatever it is, load them. Just separate each package name with a space like this:
apt-get install libpcre3 libgmp3c2 libstdc++5
Now re-run your Zimbra install and accept all the defaults except:
When it asks you for your domain, it’s going to have your fully-qualified domain name (hostname.mydomain.com) rather than just the domain, and probably complain about not having an MX record. Change the hostname to just mydomain.com and it’ll find the names through nslookup, and it’ll be happy. The rest of the install should proceed without errors, except that toward the end it’s going to ask you to “Adress unconfigured items” but, if you’re doing this from the console and not from an SSH connection with a buffer, the actual item that’s unconfigured is off the screen and invisible. It’s the admin password, which is in menu item 3.
Finally, when the install is done and it has given you the last “press Enter to finish” you are almost done. I recommend at this point that you convert your webmail to use https rather than http. This is a security question, but it is also discretionary. If you choose to do this, then at the command prompt, type:
su - zimbra
zmtlsctl https
Now reboot the system, and when it comes back up,give it a couple minutes to start the rest of the Zimbra processes. If your installation is successful, you can go to https://xxx.xxx.xxx.xxx:7071 (your internal ip address again) to get the administrative console, or
https://xxx.xxx.xxx.xxx to log in as a user.
Congratulations–one shiny new Zimbra installation on Ubuntu!