# HOWTO: Zimbra on Gentoo

## mquinnv

From zimbra.com:

 *Quote:*   

> Zimbra is an open source server and client technology for next-generation messaging and collaboration. Zimbra delivers innovation for both the administrator and the end-user as well as compatibility with existing infrastructure and applications (both open source and proprietary).

 

Zimbra is a very slick AJAX-enabled webmail and calendaring application. Unfortunately, they don't provide build packages for gentoo. In order to get it working we'll install Zimbra in an Ubuntu chroot jail.

To setup the chroot we'll be using the debootstrap program which is capable of installing a working Debian or Ubuntu distribution. The instructions below assume x86 and the latest version of Ubuntu, Dapper Drake:

```

su

mkdir /Zimbra

echo "dev-util/debootstrap ~x86" >> /etc/portage/package.keywords

emerge debootstrap

debootstrap --arch i386 dapper /Zimbra http://archive.ubuntu.com/ubuntu

cp /etc/resolv.conf /Zimbra/etc

cp /etc/passwd /Zimbra/passwd

sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow | sudo tee /Zimbra/etc/shadow

cp /etc/group /Zimbra/etc/

cp /etc/hosts /Zimbra/etc/

cp /etc/sudoers /Zimbra/etc/

chroot /Zimbra (ignore the error) 
```

Now that you are in the chroot, we'll bring it up to date:

```

apt-get update

apt-get install wget debconf devscripts gnupg cron libdb3 libpcre3

apt-get update

dpkg-reconfigure locales

tzconfig

groupadd shadow -g 42

useradd syslog
```

Unfortunately, Zimbra requires an outdated version of libssl, which you'll need to fetch from http://packages.debian.org/stable/libs/libssl0.9.7. Then install it:

```

dpkg -i libssl[whatever].deb

```

Next, we'll exit the chroot and bind the needed filesystems from the host gentoo installation:

```

exit

mount --bind /sys /Zimbra/sys

mount --bind /dev /Zimbra/dev

mount --bind /dev/pts /Zimbra/dev/pts

mount --bind /dev/shm /Zimbra/dev/shm

```

Back into the chroot to setup logging and our hostname:

```

chroot /Zimbra

nano /etc/hostname

/etc/init.d/hostname.sh stop

/etc/init.d/hostname.sh start

/etc/init.d/sysklogd start

```

Zimbra requires that the hosts file be setup a little different than the gentoo default install, so you'll need to edit your /etc/hosts to have:

```
127.0.0.1 localhost.localdomain localhost
```

Next fetch the coerce.tgz script from http://www.zimbra.com/forums/attachment.php?attachmentid=173 and the debian zimbra package that you would like to install. Unpack the zimbra package and then unpack the coerce package into the zcs directory. 

Then install Zimbra normally by running the coerce.sh script:

```

cd zcs

./coerce.sh

```

An init.d script for your gentoo system:

```

#!/sbin/runscript

depend() {

    need net

    after portmap

    after iptables

    after dnsmasq

}

start() {

chroot="/Zimbra"

bind_directories="proc dev dev/pts dev/shm sys"

for directory in $bind_directories ; do

 mount --bind /$directory $chroot/$directory

done

echo "rm -rf /var/run/*.pid" | chroot $chroot

echo "/etc/init.d/cron start" | chroot $chroot

echo "/etc/init.d/sysklogd start" | chroot $chroot

echo 'su - zimbra -c "/opt/zimbra/bin/zmcontrol start"' | chroot $chroot

}

stop() {

chroot="/Zimbra"

echo 'su - zimbra -c "/opt/zimbra/bin/zmcontrol stop"' | chroot $chroot

echo "/etc/init.d/cron stop" | chroot $chroot

echo "/etc/init.d/sysklogd stop" | chroot $chroot

bind_directories="proc dev/pts dev/shm dev sys"

for directory in $bind_directories ; do

  umount $chroot/$directory

done

}

```

Enjoy your new Zimbra installation!

Two documents assisted me greatly in getting this working:

http://www.zimbra.com/forums/showthread.php?t=3069&highlight=gentoo by forum member lxnay

http://www.calivia.com/create-the-ubuntu-breezy-build-chroot

----------

## giulianoz

before debootstrap you have to create a "dapper" script. simply 

```

cp /usr/lib/debootstrap/scripts/breezy /usr/lib/debootstrap/scripts/dapper

```

giuliano

----------

## mquinnv

there was already a dapper script with the latest debootstrap

----------

## barthi

Hi!

I get the following error, when I want to install Zimbra:

```

root@ROCK:/zcs# ./coerce.sh

Reading package lists... Done

Building dependency tree... Done

sudo is already the newest version.

libidn11 is already the newest version.

curl is already the newest version.

fetchmail is already the newest version.

libgmp3c2 is already the newest version.

libxml2 is already the newest version.

libstdc++6 is already the newest version.

openssl is already the newest version.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

cat: modify.debian_version: No such file or directory

cat: modify.dpkg_status: No such file or directory

Operations logged to /tmp/install.log.5541

Checking for existing installation...

    zimbra-ldap...NOT FOUND

    zimbra-logger...NOT FOUND

    zimbra-mta...NOT FOUND

    zimbra-snmp...NOT FOUND

    zimbra-store...NOT FOUND

    zimbra-apache...NOT FOUND

    zimbra-spell...NOT FOUND

    zimbra-core...NOT FOUND

PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THE SOFTWARE.

ZIMBRA, INC. ("ZIMBRA") WILL ONLY LICENSE THIS SOFTWARE TO YOU IF YOU

FIRST ACCEPT THE TERMS OF THIS AGREEMENT. BY DOWNLOADING OR INSTALLING

THE SOFTWARE, OR USING THE PRODUCT, YOU ARE CONSENTING TO BE BOUND BY

THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS

AGREEMENT, THEN DO NOT DOWNLOAD, INSTALL OR USE THE PRODUCT.

License Terms for the Zimbra Collaboration Suite:

        http://www.zimbra.com/license/collaboration_suite_collective_license_1.0.html

Press Return to continue

Checking for prerequisites...

    NPTL...FOUND

    sudo...MISSING

    libidn...MISSING

    curl...MISSING

    fetchmail...MISSING

    gmp...MISSING

###ERROR###

One or more prerequisite packages are missing.

Please install them before running this installer.

Installation cancelled.

```

I followed all the steps and everything worked fine. Any suggestions?

Thanks,

Barthi

----------

## rmh3093

svn co https://svn.sourceforge.net/svnroot/zimbra zimbra

----------

## tedj

barthi, you will see that error if you use debian as the chroot OS instead of Ubuntu.

I had the exact same symptom using sarge and etch - moving to the documented Ubuntu release (and the debian Zimbra packages) worked for me.

----------

## outerring

Hi!

I get the following error, when I want to install Zimbra: 

 *Quote:*   

> *** CONFIGURATION COMPLETE - press 'a' to apply
> 
> Select from menu, or press 'a' to apply config (? - help) a
> 
> Save configuration data to a file? [Yes] y
> ...

 

----------

## lbalan79

Great tutorial. Can someone help however with zimbra 4.5 and an amd64 configuration?

Thank you.

----------

## daniel_brough

I also got the ldap error with the debian chroot.

I ran "apt-get install sed" and that fixed it.

----------

## rmh3093

im working on a e-build for the svn version right now....

i will let yall know how it goes   :Very Happy: 

----------

## rmh3093

Svn Ebuild Here -> https://forums.gentoo.org/viewtopic-t-524342.html

----------

## ar_it

Hallo

When I try start zimbra i chroot i get this

```

/etc/init.d/zimbra start

root@server serwer:/# root@server serwer:/# exit

root@server serwer:/#  * Starting periodic command scheduler...          [ ok ]

root@server serwer:/# exit

root@server serwer:/#  * Starting system log...                          [fail]

root@server serwer:/# exit

root@server serwer:/# java.net.UnknownHostException: server serwer.homenetwork: server serwer.homenetwork

        at java.net.InetAddress.getLocalHost(InetAddress.java:1308)

        at com.zimbra.common.localconfig.LC.<clinit>(LC.java:236)

        at com.zimbra.common.localconfig.KnownKey.<clinit>(KnownKey.java:39)

        at com.zimbra.common.localconfig.LocalConfig.verify(LocalConfig.java:327)

        at com.zimbra.common.localconfig.LocalConfig.<init>(LocalConfig.java:177)

        at com.zimbra.common.localconfig.LocalConfig.readConfig(LocalConfig.java:348)

        at com.zimbra.common.localconfig.LocalConfig.<clinit>(LocalConfig.java:353)

        at com.zimbra.common.localconfig.Main.main(Main.java:116)

Host lookup.failed

root@server serwer:/# 
```

I think that it's something wrong here 

```

cat /etc/hosts

10.0.0.200      serwer serwer homenetwork

127.0.0.1       serwer.homenetwork serwer localhost

```

----------

## ahoogerhuis

 *ar_it wrote:*   

> Hallo
> 
> I think that it's something wrong here 
> 
> ```
> ...

 

Make it like this:

10.0.0.200      serwer.homenetwork serwer

127.0.0.1       serwer.homenetwork serwer localhost

Always the FQDN first, then alises (alii?  :Very Happy:  )

-A

----------

## darf

Getting this error, any ideas?

```

# debootstrap --arch i386 dapper /Zimbra http://archive.ubuntu.com/ubuntu/

I: Retrieving Packages

I: Retrieving Packages

I: Resolving dependencies of required packages...

I: Resolving dependencies of base packages...

W: Failure trying to run: chroot /Zimbra mount -t proc proc /proc

#

```

----------

## monicajae

i personally recommend getting it via svn or layman

----------

## Insanity5902

You've mentioned this in two different threads now.

Some info about the overlay would be nice, a link , the config info, or the name if it is in the default gentoo layman config

----------

## monicajae

I will get back to u on that.  https://forums.gentoo.org/viewtopic-t-524342-highlight-zimbra.html

in the meantime try that.  It Maybe more informative

----------

## drgath

 *darf wrote:*   

> Getting this error, any ideas?
> 
> ```
> 
> # debootstrap --arch i386 dapper /Zimbra http://archive.ubuntu.com/ubuntu/
> ...

 

Same issue here.

```

# debootstrap --arch i386 dapper /Zimbra http://archive.ubuntu.com/ubuntu/

blah blah blah

W: Failure trying to run: chroot /Zimbra mount -t proc proc /proc

# $?

bash: 1: command not found

```

For whatever reason the chroot jail isn't getting the mount command.  Hmm....

Update:

Same issue when I tried with Debian Etch

```

#debootstrap etch /Zimbra http://ftp.debian.org/debian

......

W: Failure trying to run: chroot /Zimbra mount -t proc proc /proc

```

I'm thinking it has something to do with this Gentoo version because it worked fine step by step on another server with a different Gentoo install a couple months back.

grrr....

----------

## hybrid256

Hi !

I followed the howto and got everything installed without errors on my Gentoo 2007.0 box + debian chroot jail for Zimbra (Zimbra 4.5.5).

I might be dumb but what's next ?

How do I access the webui of my server running in its chrooted environnment ?

Do I have to create a vhost ?

I don't know what to do, please, does anyone can help ?

Thanks

----------

## Jokey_

Just access it via web. it starts a webserver so you can point your browser to it

btw I had to symlink libcrypto and libssl from 0.9.8 to 0.9.7 but the packages don't seem to break, so weird case  :Mad: 

----------

## papango

hi,

when running

debootstrap --arch i386 dapper /Zimbra http://archive.ubuntu.com/ubuntu

i get this error:

W: Failure trying to run: chroot /Zimbra mount -t proc proc /proc

i'm a newbie but really would like to run zimbra on my gentoo.

still tried to continue but apt-get update gives me bash: apt-get: command not found

any help would be appreciated

----------

## lolek25

hello!

I've got similar problem and I can't deal with him. HELP!!  :Sad: 

----------

