Difference between revisions of "Building the software yourself"

(Redirected page to Building Zimbra using Git)
(21 intermediate revisions by 12 users not shown)
Line 1: Line 1:
== Ubuntu Breezy Source Build ==
#REDIRECT [[Building_Zimbra_using_Git]]
== 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 [http://sourceforge.net/project/showfiles.php?group_id=153217&package_id=172045].
I successfully installed it using the Ubuntu Breezy Hack po[[Link title]]sted in the forums ([http://www.zimbra.com/forums/showthread.php?p=16134#post16134]).  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
== The Process ==
1. Download the Debian Developer build from [http://sourceforge.net/project/showfiles.php?group_id=153217&package_id=172045].
2. Unpack the tarball
3. We'll build a new zimbra_core package for Ubuntu
$ 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
Now apply Ubuntu patches
$ cat ubuntu1.patch
--- 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'
-              PREREQ_PACKAGES="sudo libidn11 curl fetchmail libgmp3 libxml2 libstdc++6 openssl"
+              PREREQ_PACKAGES="sudo libidn11 curl fetchmail libgmp3c2 libgmp3-dev libxml2 libstdc++6 openssl"
                PACKAGEINST='rpm -iv'
                PACKAGERM='rpm -ev --noscripts --allmatches'
$ patch -p0 <ubuntu1.patch
patching file util/utilfunc.sh
$ cat ubuntu2.patch
$ diff -u ./DEBIAN/control ../zimbra_core_new/./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
$ cd packages/zimbra_core
$ patch -p0 < ../../ubuntu2.patch patching file ./DEBIAN/control
$ 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.  This is what the coerce.sh script in forums did.
$ cat /etc/debian_version
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 Zimbra works
Browse to the Zimbra Administration console
and login with
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.
Download the source tarball from ... and unpack it.  Mine is 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
cat ~peter/zimbra/tomcatManager.patch
--- 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">
  <!-- Link to the user database we will get roles from -->
  <ResourceLink name="users" global="UserDatabase"
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 lines
zimbra@parker:~$ logout
peter@parker:~$ sudo su - zimbra
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
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
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/javapeter@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
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.
Now to get the code into Eclipse was easy.  I created separate projects for ZimbraWebClient, ZimbraServer and Ajax

Latest revision as of 18:32, 2 February 2016

Jump to: navigation, search