Sunday, December 12, 2004

How to install OPEN-XCHANGE™ with Webmin, APACHE2, OpenLDAP and PostgreSQL on Mandrake 9.2

How to install OPEN-XCHANGE™ with Webmin, APACHE2, OpenLDAP and PostgreSQL on Mandrake 9.2?





By Frank Neugebauer


http://www.linux-tip.net

linux-tip@web.de


Last Modified: 28/09/2004 8:11 PM




0. Introduction





OPEN-XCHANGE™ is a collaboration and integration server environment with a continuous right management for modules and objects.
OPEN-XCHANGE™ ("OX") is a GPL Groupware solution provided by Netline.
It's the "community" version of Novell/SUSE LINUX OPEN-XCHANGE™ Server ("SLOX").
The product is based on existing components like a web server, mail server, directory server and a database.
OPEN-XCHANGE™ is JAVA™ based with some pieces of C for security components.


OPEN-XCHANGE™ provides the following modules:

- Portal
- Calendar
- Contacts
- Addresses
- Tasks
- Projects
- Documents
- Knowledge
- Bookmarks
- Pinbord
- Forums
- Webmailer

This guide contains all the necessary information for installing and understanding the architectural layout of the implementation. It was written with the assumption that you understand how to install programs and have a basic understanding of Linux Mandrake. This includes installing Linux Mandrake and RPM packages, editing files, making directories, compiling software and understanding general UNIX commands. This guide doesn’t explain how to use or configure OPEN-XCHANGE™, Apache, Postfix, Cyrus and all the other server but information on where to obtain this information can be found in the “Additional information” section.

Please note, the way the software is installed here is good enough for testing purposes, but certainly not for a production environment. I am also not responsible of possible data losses caused by the use of this guide.

The guide is divided in three parts. In the first part we will perform a basic Mandrake 9.2 installation and the basic configuration of the needed servers. The second part continues with Java installation and compiling. This guide ends with the Post-Installation process and the basic OPEN-XCHANGE™ configuration.









1.0 Basic Mandrake 9.2 Installation


I’m using Mandrake Linux PowerPack 9.2 (9 CDs) for this installation. You can already find this distribution (DVD) in some computer magazines or please purchase the software here:

http://store.mandrakesoft.com


I don’t want to explain how to install Mandrake. It is very easy theses days. If you need help, please use the following link:




http://www.mandrakelinux.com/en/fdoc.php3

It is now time to specify which programs you wish to install on your system. There are thousands of packages available for Mandrake Linux, and to make it simpler to manage the packages have been placed into groups of similar applications. We just need a basis system. For that reason you should select the following groups:



· Console Tools

· Development

· KDE Workstation (or Gnome)



Additionally you need the following packages:



· Webmin

· Apache2

· PostgreSQL

· Open-LDAP
(urpmi openldap-servers openldap-migration)

· Postfix

· Cyrus


PostgreSQL server is not setup on Mandrake by default (Client is, but not server), used control centre install to dowload server and jdbc.

login as root

/etc/rc.d/init.d/postgresql restart

# su - postgres
$ createuser youruser

Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
$ createdb youruser
CREATE DATABASE

$ exit
# exit
# su youruser
$ psql
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.
youruser=> create table states (state_code varchar(2) primary key, state_name varchar(30) not null);

CREATE TABLE
youruser=> insert into states(state_code, state_name) values ('VA','Virgina');
INSERT 16981 1
youruser=> insert into states(state_code, state_name) values ('MD','Maryland');
INSERT 16982 1

youruser=> select * from states;
state_code | state_name
------------+----------
VA | Virgina
MD | Maryland

(2 rows)

youruser=> \q




Please use the Mandrake Control Center to perform an update of your software. By clicking on “Mandrake Update” the system will be connected to the nearest FTP server and will get security updates, bugfixes and normal updates.




1.1 Get Webmin running



It is time to get Webmin running. Webmin is a web-based interface for system administration for UNIX. Using any browser that supports tables and forms (and Java for the File Manager module), you can setup user accounts, Apache, DNS, MySQL, file sharing and so on. Webmin consists of a simple web server, and a number of CGI programs which directly update system files like /etc/inetd.conf and /etc/passwd. The web server and all CGI programs are written in Perl version 5, and use no non-standard Perl modules. Please get more information about Webmin here:



http://www.webmin.com/



Honestly, we really do not need Webmin to get everything running, but it is a wonderful tool for a LINUX system administrator and it will help us to configure Apache, PostgresSQL, Open-LDAP and all other servers. After the installation please check if Webmin is already running:



/etc/init.d/webmin status



If not, please start it like this:



/etc/init.d/webmin start



You can now use the Webmin interface with your favorite browser via the following URLs:



https://localhost:10000 or https://IP-address:10000






1.2 Create users and databases



OPEN-XCHANGE™ needs few users and groups on Mandrake and PostgresSQL to make the installation go without an error message.



useradd ox
su postgres
createuser -A -D -P openexchange
createdb openexchange exit



Note: Please remember the passwords.





1.3 Configure PostgreSQL

Please edit the following configuration file:

/var/lib/pgsql/data/postgresql.conf

and make sure that the this line is anabled:

tcpip_socket = true

In the file /var/lib/pgsql/data/pg_hba.conf we need this the following:

local all all trust
host all all 127.0.0.1 255.255.255.255 trust




Please use Webmin to open PostgreSQL Database Server by clicking on Servers - PostgreSQL Database Server. You will find the database openexchange (just empty) and the openexchange user already installed. In this phase just make sure that PostgresSQL starts and stops without an error.



Note: You need the perl-DBD-Pg package installed to avoid error messages.



1.4 Configuring Apache2



To configure Apache2 use Webmin – Servers – Apache Webserver and click on Module Config.



Please change the following entries:



Path to httpd executable to: /usr/sbin/httpd2

Path to httpd.conf to: /etc/httpd/2.0/conf/httpd2.conf


Configure the necessary modules (just leave it like it is) and you will find the global configuration overview. In this phase just make sure that Apache starts and stops without an error message. We will configure it later.




1.5 Configuring Open-LDAP



To configure Open-LDAP use Webmin – Servers – OpenLDAP Server. Leave everything like it is. Just make sure that the daemon starts and stops without error.







2.0 Installing Java and compiling OPEN-XCHANGE™



This part is not so easy like the first part. We need to download a lot more rpm packages and other files from different locations. It is not always uncomplicated to find the correct file on the 9 Mandrake 9.2 CDs. I downloaded some software from Sun as well.





2.1 Java stuff



Lets go to Sun first. Download the following files and store them in your favourite installation directory: (i.e. /installations)

http://java.sun.com/j2se/1.4.2/download.html
download j2sdk-1_4_2_05-linux-i586.bin

http://java.sun.com/products/javamail/downloads/index.html
download javamail-1_3_1-upd.zip

http://java.sun.com/products/javabeans/glasgow/jaf.html
download jaf-1_0_2-upd.zip

http://java.sun.com/products/jta/
download the class files and javadocs.

http://java.sun.com/products/servlet/archive.html
download Java Servlet Development Kit 2.0 for Solaris (jsdk20-solaris2-sparc.tar.Z).



Install j2sdk like this:



cd /installations

chmod 700 j2sdk-1_4_2_05-linux-i586.bin

./j2sdk-1_4_2_05-linux-i586.bin

(need to add create java_home and add to path

create /etc/profile.d/java.sh

JAVA_HOME=/download/j2sdk1.4.2_05
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
)




Install javamail like this:



cd /installations

unzip javamail-1_3_1-upd.zip

cd javamail-1.3.1/

cp mail.jar /usr/share/java





Install jaf like this:



cd /installations

unzip jaf-1_0_2-upd.zip

cd jaf-1.0.2

cp –R * /usr/share/java





Install Jta like this:



Unzip the following files and copy the content to /usr/share/java:

jta-1_0_1B-classes.zip

jta-1_0_1B-doc.zip


Install jsdk20



cd /installations

tar xzf jsdk20-solaris2-sparc.tar.Z

chown –R root:root JSDK2.0/

cp -R JSDK2.0 /usr/local/





2.2 Install additional RPM packages from Installation CD



Please use RPMDrake in Mandrake Control Center to install the following files:



jdom-1.0.0.b8.2jpp
ant-1.5.4-2jpp
postgresql-jdbc-7.3.4-2mdk
apache2-devel-2.0.47-6.6.92mdk advx-build,libgdbm2-devel


We also need some perl libraries:



perl-Concert-ASN1-0.16-4mdk
perl-ldap-0.29-1mdk
perl-IO-Socket-SSL-0.95-1mdk
perl-Authen-SASL-2.04-2mdk
perl-Net_SSLeay-1.25-1mdk


Note: If RPMDrake asks to install depended files, please do it.





2.3 Compiling OPEN-XCHANGE™ and first check



Please download the OPEN-XCHANGE™ from the following website and store it in your installation directory:



http://mirror.open-xchange.org/ox/EN/community/



cd /installations

tar xzf open-xchange-0.7.1.tar.gz

cd open-xchange.0.7.1/

./configure --prefix=/usr/local/ox --with-mailjar=/usr/share/java/mail.jar --with-activationjar=/usr/share/java/activation.jar --with-jdomjar=/usr/share/java/jdom.jar --with-xercesjar=/usr/share/java/xerces-j2.jar --with-jsdkjar=/usr/local/JSDK2.0/lib/jsdk.jar --with-jdbcjar=/usr/share/pgsql/pg73jdbc3.jar --with-runuid=ox --with-rungid=ox

make

make install
chown –R ox:ox /usr/local/ox/var


Note: To avoid the following error message, you should start PostgrSQL sever first:



configure: WARNING: it seems that the database can not be reached ... maybe the application will not work as expected



Next we need to copy the following files to Apache’s cgi-bin directory: login.pl and login.pm



cd /usr/local/ox/share/perl

cp login.* /var/www/cgi-bin



Please try to enter the login screen using your favourite browser:



http://servername/cgi-bin/login.pl or http://IPaddress/cgi-bin/login.pl





I had an Internal Server error. Checking the Apache error log file I discovered the following message:



Can't locate auto/Net/SSLeay/randomize.al in @INC (@INC contains:
/usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1


I found out that the RPM package perl-Net_SSLeay-1.25-mdk.i586.rpm doesn't have the file randomize.al.

Here is my workaround:

I regenerated the file SSLeay.pm with the following commands:

cd /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
perl -e 'use AutoSplit; autosplit("Net/SSLeay", "auto", 0, 1, 1)'


2.4 Installing Jakarta Tomcat 5

Please download jakarta-tomcat-5.0.28.tar.gz from here and store it in you installation directory:

http://jakarta.apache.org/site/binindex.cgi


Install Tomcat like this:





cd /installation

tar xzf jakarta-tomcat-5.0.28.tar.gz

cd jakarta-tomcat-5.0.28

mkdir /usr/local/tomcat

cp –R * /usr/local/tomcat

/usr/local/tomcat/bin/startup.sh



Use your favourite browser to check if tomcat is installed properly.



http://yourserver:8080







2.5 Installling Servlets

Copy intranet.class and webmail.class in the tomcat webapps tree :

cd /usr/local/tomcat/webapps
mkdir servlet
mkdir servlet/WEB-INF
mkdir servlet/WEB-INF/classes
cd servlet/WEB-INF/classes
cp /usr/local/ox/share/servlets/*.class .



Now create the file web.xml in
/usr/local/tomcat/webapps/servlet/WEB-INF.

Use this as an example:






Servlet OpenXchange

Servlet OpenXchange 0.7.1




intranet
intranet



webmail
webmail



intranet
/intranet



webmail
/webmail








The servlets won't work until you modify the classpath. So do this:



cd /usr/local/tomcat/webapps/servlet/WEB-INF
mkdir lib
cd lib
cp /usr/local/ox/lib/*.jar .





At the end do not forget to restart Tomcat 5 like this:



/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh



To check if everything is working fine, open you favourite Browser and go to the following URL:



http://myhost:8080/servlet/intranet



You should see a message "No running Server found“: it means that all is OK.




2.6 Install Apache Module Mod_jk

I couldn’t find this Apache Module on the CDs. So I searched for files I can download out of the net. Here is my solution:

I downloaded jakarta-tomcat-connectors-jk2-2.0.4-src.zip
from here:

http://www.apache.de/dist/jakarta/tomcat-connectors/jk2/source/


To compile the source we need to do the following steps:

cd /installation
unzip jakarta-tomcat-connectors-jk2-2.0.4-src.zip

This will create a folder called jakarta-tomcat-connectors-jk2-2.0.4-src. Rename it to jakarta-tomcat-connector.

Move this folder to wherever you store source files on your system. I used /usr/src.

copy –R jakarta-tomcat-connector /usr/src

Then run the buildconf script to create the configuration file.

cd /usr/src/jakarta-tomcat-connector/jk/native2
./buildconf.sh
Run the configure script with the path to the apxs file on your system and the options below:

./configure --with-apxs2=/usr/sbin/apxs2
Note: You need to install rpm package apache2-devel-2.0.47 first!

Build mod_jk2 with the following command:

make

If all went well, the mod_jk2.so file was successfully created. Manually copy it to Apache's shared object files directory:



cp /usr/src/jakarta-tomcat-connector/jk/build/jk2/apache2/mod_jk2.so /etc/httpd/2.0/modules

cp /usr/src/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/server/apache2/mod_jk2.c /etc/httpd/2.0/modules

cp /usr/src/jakarta-tomcat-connector/jk/native2/server/apache2/mod_jk2.c /etc/httpd/2.0/modules

Add the following line to the file /etc/httpd/2.0/conf/httpd2.conf:

LoadModule jk2_module modules/mod_jk2.so

Copy the file workers2.properties to /etc/httpd/conf

Restart Apache like this:

service httpd restart




3.0 Post-Installation and first run

3.1 Postgresql database

In the last part we’ll finally configure Postgresql, LDAP and will start the necessary services.

Lets start to populate the database. Just do the following:

psql -dopenexchange -h localhost -Uopenexchange -W -f /usr/local/ox/share/init_database.sql
psql -dopenexchange -h localhost -Uopenexchange -W
INSERT INTO sys_gen_rights_template values
('now','admin','now','','default_template','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y');
\q



3.2 Configuring LDAP
Edit your /etc/openldap/slapd.conf and add the following lines:

include /usr/local/ox/share/openxchange.schema

suffix "dc=example,dc=org"
rootdn "cn=Manager,dc=example,dc=org"
rootpw secret

index uid,mailEnabled,cn,sn,givenname,lnetMailAccess,alias,loginDestination eq,sub

Now create a password as stated in the INSTALL file:

$perl -e 'print crypt("mypassword",pack("C2",(int(rand 26)+65),(int(rand 26)+65)))."\n";'
CGPbeX4Qyrui2
$

Edit /usr/local/ox/share/init_ldap.ldif and modify the line

userPassword: {CRYPT}newmailadminpass

... to the result of the perl command. In my example it is:

userPassword: {CRYPT}CGPbeX4Qyrui2
Now insert the LDAP data :

slapadd -l /usr/local/ox/share/init_ldap.ldif
If you have an error, check your config and try again until it works ... If you need to reset the LDAP database, here's the solution:

/etc/init.d/lapd stop
rm /var/lib/ldap/*
/etc/init.d/lapd start

(you need to remove any duplicated entries from the indicated files,dont understand why these things are wrong out of the box?)

Note: Please check if all files in /var/lib/ldap are owned by ldap.

Now modify your /etc/openldap/ldap.conf like this:

BASE dc=example,dc=org
HOST localhost

Note: Do not put any space after the comma in dc=example,dc=org !!!

Create a symbolic link like this:

ln -s /etc/openldap/ldap.conf /usr/local/ox/etc/groupware/ldap.conf



3.3 Create a user

Let's try your PostgreSQL / LDAP config by adding a user:

adduser_ox --username="john" --passwd="password" --name="doe" --sname="john" --maildomain="example.org" --ox_timezone="Europe/Paris"



Check carefully the feedback of the command. Even if you have a green "OK" message, you can have an error message ... If this is the case, don't go further until it is corrected!

If we still follow the INSTALL file, we now add a openxchange group:

addgroup_ox --group=developers




3.4 Website files preparation

Copy the following files to wwwroot (Mandrake normally uses /var/www/html)

cd /var/www/html

mkdir cfintranet
mkdir cfintranet/webmail

cd /usr/local/ox/share/groupware/data
cp -R images css javascript /var/www/html/cfintranet

cd /usr/local/ox/share/webmail/data
cp -R images css javascript /var/www/html/cfintranet/webmail





3.5 Creating the filespool

The documentation says this script can "take some time". It's true! If you have a slow server, it is time for a tea or coffee.

cd /usr/local/ox/sbin

sh correctfilespool



Now, all should be OK for starting. First, start the openxchange service :

/usr/local/ox/etc/init.d/openexchange start
Then open the login page http://myhost/cgi-bin/login.pl, and login with the username and password supplied previously to the command adduser_ox :



4.0 Face Lifting

OK, what you now see is not nice. (no icons but ugly squares instead). Fortunately somebody did allady great work.

Please download the file ox_zenith_iconset-0.1.tar.gz from here:

http://ox.cutmasta.org/

Install the new icons like this:

tar xzf ox_zenith_iconset-0.1.tar.gz
cd ox_zenith_iconset/top
cp * /var/www/html/cfintranet/images/top/EN/
cp * /var/www/html/cfintranet/images/top/DE/

No comments:

Post a Comment