Building the software yourself

Ubuntu Breezy Source Build

Introduction

After trying to build the source myself using readme_source.txt and and build_cvs_howto.txt, I decided there must be a better way. It was quite apparent that the processes for building the Third Party components in those HOWTOs hadn't been followed for quite some time. There were issues with Makefiles and the process was generally unwieldy.

Here is what I did on an Ubuntu 5.10 (Breezy) system. This process was performed on a laptop without DNS and then confirmed on a VMWare Ubuntu instance.

Since Ubuntu is a Debian based system, I downloaded the Debian Developer build from [1].

I successfully installed it using the Ubuntu Breezy Hack posted in the forums ([2]). I managed to get to the Zimbra login and use the system.

Then I went through a couple instances of trying to install the source using readme_source.txt and and build_cvs_howto.txt. As a result of getting that process to work, I ended up with something like the following packages installed. This may or not have a bearing on the process I will describe below.

sudo apt-get install sudo libidn11 curl fetchmail libgmp3c2 libxml2 libstdc++6 openssl
sudo apt-get install libssl-dev
sudo apt-get install ssl-cert
sudo apt-get install zlib1g zlib1g-dev
sudo apt-get install autoconf
sudo apt-get install libpcre3  libpcre3-dev expat libpopt0 libpopt-dev
sudo apt-get install bison flex
sudo apt-get install libtool libltdl3-dev
sudo apt-get install automake1.7 
sudo apt-get install libbz2-dev bzip2 libbz2-1.0
sudo apt-get install libgmp3-dev
sudo apt-get install curl libwww-dev libcurl3-dev
sudo apt-get install libsasl2 libgssapi1-heimdal
sudo apt-get install libsasl2-modules-gssapi-heimdal
sudo apt-get install libxml-dev

(or in one line:)

sudo aptitude install libidn11 curl fetchmail libgmp3c2 libxml2 libstdc++6 openssl libssl-dev ssl-cert zlib1g zlib1g-dev autoconf libpcre3  libpcre3-dev expat libpopt0 libpopt-dev bison flex libtool libltdl3-dev automake1.7 libbz2-dev bzip2 libbz2-1.0 libgmp3-dev curl libwww-dev libcurl3-dev libsasl2 libgssapi1-heimdal libsasl2-modules-gssapi-heimdal libxml-dev

For dapper drake, you need libdb3 if it is not already installed:

sudo apt-get install libdb3

The Process

  1. Download the Debian Developer build from [3].
  2. Unpack the tarball
  3. We'll build a new zimbra_core package for Ubuntu

The developer tarball (in this case zcs-3.1.0_GA_332.DEBIAN3.1.tgz) unpacks into the following tree:

 zcs
 |-- bin
 |-- data
 |-- docs
 |-- packages
 `-- util
     `-- modules

Assuming you unpack it into the directory ~/repack, you can:

$ mkdir ~/repack
$ tar xfz zcs-3.1.0_GA_332.DEBIAN3.1.tgz
$ cd zcs
$ cd packages
$ mkdir zimbra_core
$ dpkg -x zimbra-core_3.1.0_GA_332.DEBIAN3.1_i386.deb zimbra_core
$ cd zimbra_core
$ dpkg -e ../zimbra-core_3.1.0_GA_332.DEBIAN3.1_i386.deb
$ cd ../..
$ pwd
~/repack/zcs

Now apply Ubuntu patches as described below (I couldn't work out how to up load non-media files, would prefer to host the patches at zimbra.com).

The first patch changes the list of prerequisite packages in util/utilfunc.sh to include libgmp3c2 and libgmp3-dev instead of libgmp3:

-- util/utilfunc.sh.aside  2006-04-15 05:39:38.000000000 +1000
+++ util/utilfunc.sh    2006-04-24 08:55:23.000000000 +1000
@@ -972,7 +972,7 @@
        PACKAGERM='dpkg --purge'
        PACKAGEQUERY='dpkg -s'
        PACKAGEEXT='deb'
-       PREREQ_PACKAGES="sudo libidn11 curl fetchmail libgmp3 libxml2 libstdc++6 openssl"
+       PREREQ_PACKAGES="sudo libidn11 curl fetchmail libgmp3c2 libgmp3-dev libxml2 libstdc++6 openssl"
    else
        PACKAGEINST='rpm -iv'
        PACKAGERM='rpm -ev --noscripts --allmatches'

Apply it with:

$ wget http://www.bluetoad.com.au/zimbra/ubuntu1.patch
$ patch -p0 < ubuntu1.patch
patching file util/utilfunc.sh
$ rm ubuntu1.patch

The second patch does the same to packages/zimbra_core/DEBIAN/control:

--- ./DEBIAN/control    2006-04-15 05:36:24.000000000 +1000
+++ ../zimbra_core_new/./DEBIAN/control 2006-04-24 08:41:30.000000000 +1000
@@ -5,4 +5,4 @@
 Section: Mail
 Priority: optional
 Architecture: i386
-Depends: libidn11,curl,fetchmail,libgmp3
+Depends: libidn11,curl,fetchmail,libgmp3c2,libgmp3-dev

Apply it with:

$ cd packages/zimbra_core
$ wget http://www.bluetoad.com.au/zimbra/ubuntu2.patch
$ patch -p0 < ubuntu2.patch 
patching file ./DEBIAN/control
$ rm ubuntu2.patch

Now repackage the patched zimbra-core deb archive:

$ cd ..
$ mv zimbra-core_3.1.0_GA_332.DEBIAN3.1_i386.deb zimbra-core_3.1.0_GA_332.DEBIAN3.1_i386.deb.aside
$ dpkg -b zimbra_core zimbra-core_3.1.0_GA_332.DEBIAN3.1_i386.deb

Now /etc/debian_version needs to be edited to trick bin/get_plat_tag.sh. Add a blank line and then 3.1. The coerce.sh script in the forums did this as well.

$ cat /etc/debian_version
testing/unstable

3.1
$

cd back up to the top of your zcs tree

$ sudo ./install.sh

Notes on installation questions


I did 2 installations. One on a VMWare Ubuntu Breezy VM with static IP and hostname in my local network DNS.

I also did an install where I used the host as localhost.localdomain with no DNS on my laptop. So either I kept or entered (can't remember) localhost.localdomain as the host when it said the host can not be resolved by DNS. In this case you need to run 'zmprov mcf zimbraMtaDnsLookupsEnabled FALSE' as the zimbra user after the installation has completed.

For the MX question I said no both times.

I set the admin password as directed by the script (option 6 then 4 etc)

Then you'll see stuff like the following for an almost successful installation

*** CONFIGURATION COMPLETE - press 'a' to apply
Select from menu, or press 'a' to apply config (? - help) a
Save configuration data to a file? [Yes]
Save config in file: [/opt/zimbra/config.8962]
Saving config in /opt/zimbra/config.8962...Done
The system will be modified - continue? [No] yes
Operations logged to /tmp/zmsetup.log.8962
Setting local config values...Done
Setting up CA...Done
Creating SSL certificate...Done
Initializing ldap...Done
Saving CA in ldap...Done
Installing SSL certificate...Done
Creating server entry for parker.bluetoad.com.au...Done
Setting spell check URL...Done
Setting service ports on parker.bluetoad.com.au...Done
Adding parker.bluetoad.com.au to zimbraMailHostPool in default COS...Done
Installing zimlets... com_zimbra_phone... com_zimbra_amzn... com_zimbra_wikipedia... com_zimbra_tracking... com_zimbra_url... com_zimbra_ymaps... com_zimbra_xslt... Done
Setting MTA auth host...Done
Creating domain parker.bluetoad.com.au...Done
Creating user xhc3fwsjhh@parker.bluetoad.com.au...Done
Creating user _vwniet5@parker.bluetoad.com.au...Done
Setting spam training accounts...Done
Creating user admin@parker.bluetoad.com.au...Done
Creating postmaster alias...Done
Initializing store sql database...Done
Setting zimbraSmtpHostname for parker.bluetoad.com.au...Done
Initializing logger sql database...Done
Initializing mta config...Done
Configuring SNMP...Done
Setting services on parker.bluetoad.com.au...Done
Setting up zimbra crontab...Done

You have the option of notifying Zimbra of your installation.
This helps us to track the uptake of the Zimbra Collaboration Suite.
The only information that will be transmitted is:

The VERSION of zcs installed (3.1.0_GA_332_DEBIAN3.1)
The ADMIN EMAIL ADDRESS created (admin@parker.bluetoad.com.au)

Notify Zimbra of your installation? [Yes]
Notifying Zimbra of installation via http://www.zimbra.com/cgi-bin/notify.cgi?VER=3.1.0_GA_332_DEBIAN3.1&MAIL=admin@parker.bluetoad.com.au

Notification complete 

Starting servers...Done.

Operations logged to /tmp/zmsetup.log.8962

Configuration complete - press return to exit

Browse to see if the Zimbra client works http://parker/

Browse to the Zimbra Administration console at https://parker:7071 or https://parker:7071/zimbraAdmin/ and login with admin@yourdomain and the password you set during installation.

Using the Admin console, you should create some more accounts for testing or add passwords to the accounts created during the installation.

The next thing is being able to deploy source. The ant scripts expect the Tomcat manager webapp to be listening on port 7070.

Now the Tomcat manager setup seemed broken so I modified that and also installed the developer version of the Tomcat server.xml file. This must be installed over server.xml.in since that file is used to overwrite server.xml.

Check the source out from CVS.

cvs -z6 -d :pserver:anonymous:@cvs.zimbra.com:/usr/local/cvsroot co main

I have placed mine in a directory zcs_src

zimbra@parker:~$ mv /opt/zimbra/tomcat/conf/server.xml.in /opt/zimbra/tomcat/conf/server.xml.in.aside
zimbra@parker:~$ cp ~peter/zimbra/zcs_src/ZimbraServer/conf/tomcat-5.5/server.xml /opt/zimbra/tomcat/conf/server.xml.in
zimbra@parker:~$ cd /opt/zimbra/tomcat/conf/Catalina/localhost/
zimbra@parker:~/tomcat/conf/Catalina/localhost$ cp -p manager.xml manager.xml.aside

Apply the following patch

The patch adds 'debug="0"' and 'path="/manager"' to the <Context> element:

--- manager.xml.broken  2006-04-26 15:08:55.000000000 +1000
+++ manager.xml 2006-04-26 15:10:04.000000000 +1000
@@ -7,8 +7,8 @@
 -->


-<Context docBase="${catalina.home}/server/webapps/manager"
-         privileged="true" antiResourceLocking="false" antiJARLocking="false">
+<Context path="/manager" docBase="${catalina.home}/server/webapps/manager"
+      debug="0"   privileged="true" antiResourceLocking="false" antiJARLocking="false">

   <ResourceLink name="users" global="UserDatabase"

Apply it with:

zimbra@parker:~/tomcat/conf/Catalina/localhost$ patch -p0 < ~peter/zimbra/tomcatManager.patch
patching file manager.xml

Logout out as the zimbra user and log back in to pick up the new environment from the installation as Zimbra edit ~/.bashrc

Add these lines to your shell rc file:

CATALINA_HOME=/opt/zimbra/tomcat
export CATALINA_HOME
zimbra@parker:~$ logout
peter@parker:~$ sudo su - zimbra
Password:
zimbra@parker:~$ tomcat restart
$ netstat -nat 

and you should no longer see port 80 being used and port 7070 has a listener now

browse to zimbra

http://parker:7070/

you don't need the domain to login as one of the users created above

Try sending some mail to an account you created or the one you have logged in as.

You'll need to hit "Get Mail" to refresh your Inbox.

Now, let's see if the tomcat manager is working

browse to

http://parker:7070/manager/html

the html directory was a surprise to me. Took a while to find that. Login as zimbra with password zimbra.

If there is a login issue you should check /opt/zimbra/tomcat/conf/tomcat-users.zml against zcs_src/ZimbraServer/conf/tomcat-5.5/tomcat-users.xml. The Debian developer build at the moment shipped with the zimbra user set up in the manager role.

Modify some permissions

$ sudo chown peter:peter /opt/zimbra/conf/msgs/ZsMsg.properties
$ chmod 644 /opt/zimbra/conf/msgs/ZsMsg.properties
$ sudo chgrp zimbra /opt/zimbra/apache-tomcat-5.5.15/work/Catalina/localhost/zimbraAdmin/tldCache.ser
peter@parker:~/zimbra/zcs_src/ZimbraServer$ sudo chmod g+w $_
peter@parker:~/zimbra/zcs_src$ cd ZimbraWebClient/
peter@parker:~/zimbra/zcs_src/ZimbraWebClient$ ls
bin  build  build.xml  img  jars  src  WebRoot  ZimbraWebClient.iml
peter@parker:~/zimbra/zcs_src/ZimbraWebClient$ export JAVA_HOME=/opt/zimbra/java
peter@parker:~/zimbra/zcs_src/ZimbraWebClient$ export ANT_HOME=/opt/ant
peter@parker:~/zimbra/zcs_src/ZimbraWebClient$ export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

Now see if you can compile

$ ant

OK see if you can deploy

$ ant deploy 

and also check /opt/zimbra/tomcat/logs/catalina.out

Browse to the zimbra app and see if it works.

$ cd ../ZimbraServer/
$ ant
$ ant service-deploy

That does crash Tomcat but you probably managed to deploy the webapp. Tomcat crashes on (see /opt/zimbra/tomcat/log/catalina.out)

Zimbra server reserving server socket port=110 bindaddr=null ssl=false
Fatal error: terminating: PrivilegedServlet init failed
java.net.SocketException: Permission denied
       at sun.nio.ch.Net.bind(Native Method)
       at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
       at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
       at com.zimbra.cs.util.NetUtil.newBoundServerSocket(NetUtil.java:78)
       at com.zimbra.cs.util.NetUtil.reserveServerSocket(NetUtil.java:101)
       at com.zimbra.cs.servlet.PrivilegedServlet.init(PrivilegedServlet.java:79)
       at javax.servlet.GenericServlet.init(GenericServlet.java:211)
       at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
       at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
       at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3915)
       at org.apache.catalina.core.StandardContext.start(StandardContext.java:4176)
       at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
       at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
       at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
       at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:804)
       at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:497)
       at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1195)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
       at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
       at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
       at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
       at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
       at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1377)
       at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:636)
       at org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:423)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:712)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Thread.java:595)

which makes sense since 110 (pop3) is a privileged port and you normally need to be root. I'm going to look at some UML or VServer way of doing this...

So for now I just do

zimbra@parker:~$ tomcat restart

until I work out why that works since I'm zimbra there.

from /etc/sudoers:
%zimbra ALL=NOPASSWD:/opt/zimbra/libexec/zmtomcatstart
ok then.

Now to get the code into Eclipse was easy. I created separate projects for ZimbraWebClient, ZimbraServer and Ajax

CVS Update

I did a CVS update and found that the database schema had changed. (Don't forget to do a CVS update -d for new directories)

After poking around the source tree and looking at the forums and several attempts at , I found I needed to

$ sudo cp -p ./ZimbraBuild/rpmconf/Upgrade/zmupgrade.pm /opt/zimbra/libexec/

Examining zmupgrade.pm, I a saw it called perl scripts. I looked in /ZimbraBuild/rpmconf/Upgrade/upgrade.tgz, the missing one wasn't there... I found it at ./main/ZimbraServer/src/db/migrate20060412-NotebookFolder.pl

$ sudo cp -p ../main/ZimbraServer/src/db/migrate20060412-NotebookFolder.pl /opt/zimbra/libexec/scripts/

Then I needed to edit /opt/zimbra/libexec/zmsetup.pl so that the upgrade would run

Before

if (! $newinstall && ($prevVersion ne $curVersion )) {
       progress ("Upgrading from $prevVersion to $curVersion\n");
       if (zmupgrade::upgrade($prevVersion, $curVersion)){
               progress ("UPGRADE FAILED - exiting\n");
               exit 1;
       } else {
               progress ("Upgrade complete\n");
       }
}

insert the line

$curVersion="3.1.0_GA_333";


or use whatever build will be 1 greater than the build number for your installed version of zimbra-core. E.g. mine was 332.

$ grep zimbra-core /opt/zimbra/.install_history
1146104795: INSTALLED zimbra-core_3.1.0_GA_332.DEBIAN3.1_i386.deb

Then

$ /opt/zimbra/libexec/zmsetup.pl

should work.

Another gotcha was that you needed to run

$ ant compress-js-files

for ZimbraWebClient to generate the zipped javascript files.

Jump to: navigation, search