Makefile for Scalix-Installation on Debian and Ubuntu

From Scalix Wiki
Revision as of 13:40, 3 October 2006 by Rnick (Talk | contribs) (Scalix 11pre)

Jump to: navigation, search

What is this?

This is a Makefile to install Scalix CE Raw on a clean Base-Installation of Ubuntu. I testet it on different Systems, but it's 'very alpha'. So it's better to make a Backup (It's always nice to have a Backup, isn't it? ;).

Prepare

Activate univers and universe-security in /etc/apt/sources-list and run apt-get update. Without this, you can run into Dependency-Problems with the Package krb5-user

Packages

To use this Makefile, we need the Packages make, sed and wget. Sed and wget should be included in the Base-Installation.

apt-get install make wget sed

You can download this Makefile from http://linux.in-no-sense.de. Chmod to 0400, because it contains the Cleartext-Password for the Admin-Users

[ -d /opt/scalix_install ] || ( mkdir /opt/scalix_install && cd /opt/scalix_install/ && \
wget http://linux.in-no-sense.de/download/scalix/Makefile && \
chown root:root Makefile && chmod 0400 Makefile)

Scalix 11pre

There's another Makefile for the 11pre. If you want to give it a try, get the Makefile.11pre.

[ -d /opt/scalix_install_11pre ] || ( mkdir /opt/scalix_install_11pre && cd /opt/scalix_install_11pre/ && \
wget http://linux.in-no-sense.de/download/scalix/Makefile.11pre && \
chown root:root Makefile && chmod 0400 Makefile.11pre && ln -fs Makefile.11pre Makefile)

Java

Get the Java JDK 5.0 Update 6 from http://java.sun.com and save the jdk-1_5_0_06-linux-i586.bin in /opt/scalix_install/pkg

Be sure to make jdk-1_5xxx executable.

chmod +x jdk-1_5_0_06-linux-i586.bin

Info: The Makefile deletes existing alternatives of java and javc!

Edit the Makefile

You have to set some Variables to fit it to your needs.

The Admin-Password

ADMIN_PASSWD := verysecret

Domain- and Hostname of your Host. Check it by typing hostname -f

DOMAINNAME := localdomain
HOSTNAME := scalix

Mailnode and Standard-Maildomain

MAILNODE := testfirma
MAILDOMAIN := testfirma.org

Optional Settings

See Wiki for Details

CN_RULE := 'S, G'
AUTHID_RULE := 'gs'

Java and Tomcat-Versions

JAVAPKG_DIR := pkg/jdk-1_5_0_06-linux-i586.bin
JAVAPKG_DOTDIR := jdk1.5.0_06
TOMCAT_VER := jakarta-tomcat-5.0.28

Scalix 11pre

In the 11pre Version of the Makefile you need to set further Settings

LANGUAGE := ENGLISH
PLATFORM := scalix.mydomain.com
# PostgreSQL
DB_PASSWD := <geheim>
DBHOST := localhost
# Mailserver
IMAPHOST := scalix.mydomain.com
SMTPHOST := scalix.mydomain.com

Installation

To install, type

make with_java

If you allready have java installed (I just need this for reinstalling Scalix), type

make without_java

To remove the installation

make very_clean

this does not remove Java

Testing

Try http://localhost:8080/sac and login with User: sxadmin and your Password

Try http://localhost:8080/webmail and do the same

Bugs

Sometimes the files res.properties or swa.properties are empty after running the Makefile.

Appendix

Makefile

## Makefile for Scalix Community Edition Raw 10 on Ubuntu - v0.3
##
## (c) 2006 - Ralf Nickel, ralf.nickel@itrn.de - http://www.itrn.de
## based on http://www.scalix.com/wiki/index.php?title=Scalix_CE_Raw/Installation
## 
## only tested on a Base-Installation on Ubuntu Dapper Drake beta, Hoary and Breezy

## Changes
## 07/27/06 - checking existing Directories in 'prepare'
##          - Changed libapache2-mod-jk2 to libapache2-mod-jk in 'dubidu_depends' - Djdicbob
##          - /opt/scalix_install replaced everywhere by $(INST_PREFIX)
##          - forcing creation of Symlinks - Reinier
##          - forcing removal of Files and Symlinks - Reinier

## Directory of this Makefile
INST_PREFIX := /opt/scalix_install
# Where is the Scalix-Installation
SCALIX_PREFIX := /opt/scalix

JAVAPKG_DIR := pkg/jdk-1_5_0_06-linux-i586.bin
JAVAPKG_DOTDIR := jdk1.5.0_06

# Tomcat-Package
TOMCAT_VER := jakarta-tomcat-5.0.28
TOMCAT_PKG := pkg/$(TOMCAT_VER).tar.gz
TOMCAT_INSTDIR := /opt
TOMCAT_LINK := /opt/scalix-tomcat
TOMCAT_PORT := 8080

# Admins
ADMIN_USER := sxadmin
# LDAP-Admin
QUERYADMIN_USER := sxqueryadmin
# I simply use same Password for both Admins. 
ADMIN_PASSWD := geheim

# Domain- and Hostname for this Host
# check with 'hostname -f'
DOMAINNAME := localdomain
HOSTNAME := scalix

# CE Raw - just one Mailnode
MAILNODE := testfirma
# Default Maildomain
MAILDOMAIN := testfirma.org

# see http://www.scalix.com/wiki for details
CN_RULE := 'S, G'
AUTHID_RULE := 'gs'

all:
	@echo -e "Download Java JDK1.5 from \nhttp://java.sun.com\nsave it to $(INST_PREFIX)/pkg and run \n# make with_java or \n# make without_java"

with_java: dubidu_depends java_sdk prepare scalix-tomcat scalix_inst scalix_setup add_sxgroups \
	add_tweaks start_allom tomscal_conf conf_swa.properties conf_ubermanager \
	conf_res.properties restart_tomcat config_apache2
     
without_java: dubidu_depends prepare scalix-tomcat scalix_inst scalix_setup add_sxgroups \
	add_tweaks start_allom tomscal_conf conf_swa.properties conf_ubermanager \
	conf_res.properties restart_tomcat config_apache2

very_clean:
	/etc/init.d/scalix stop
	/etc/init.d/scalix-tomcat stop
	apt-get --yes remove --purge scalix-res* scalix-sac* scalix-server* scalix-swa*
	rm -drf /etc/opt/scalix
	rm -drf /var/opt/scalix
	rm -drf $(TOMCAT_LINK)
	rm -drf $(TOMCAT_INSTDIR)/$(TOMCAT_VER)
	rm -drf $(SCALIX_PREFIX)
	rm -f /etc/init.d/scalix-tomcat
	rm -f /etc/apache2/conf.d/scalix-web-client.conf
	update-rc.d scalix-tomcat remove

## Packages for Ubuntu

dubidu_depends:
	apt-get install apache2 libapache2-mod-jk gawk krb5-config krb5-doc krb5-user libkadm55 libkrb53 libglib2.0-0 \
	libstdc++2.10-glibc2.2 libxml2 sgml-base xml-core libsasl2-modules libsasl2-gssapi-mit sendmail elinks

## Get Packages
prepare:
	cd $(INST_PREFIX)/pkg && \
	wget http://www.scalix.com/ceraw/download/pub/libical/libical_0.24.RC4.20050413_i386.deb \
	http://www.scalix.com/ceraw/download/pub/server/scalix-res_10.0.1.21_all.deb \
	http://www.scalix.com/ceraw/download/pub/server/scalix-sac_10.0.1.21_all.deb \
	http://www.scalix.com/ceraw/download/pub/server/scalix-server_10.0.1.4_i386.deb \
	http://www.scalix.com/ceraw/download/pub/server/scalix-swa_10.0.1.6_all.deb \
	http://apache.sunsite.ualberta.ca/tomcat/tomcat-5/v5.0.28/bin/jakarta-tomcat-5.0.28.tar.gz
## Get Tomcat Startscript
	[ -d $(INST_PREFIX)/init.d ] || ( mkdir $(INST_PREFIX)/init.d && \
	cd $(INST_PREFIX)/init.d/ && \
	wget http://linux.in-no-sense.de/download/scalix/scalix-tomcat )
## Get Tweaks
	[ -d $(INST_PREFIX)/tweaks ] || ( mkdir $(INST_PREFIX)/tweaks && \
	cd $(INST_PREFIX)/tweaks/ && \
	wget http://linux.in-no-sense.de/download/scalix/general.cfg )

## install JDK in /usr/local/lib/java and set alternatives
# !! existing alternatives will be deleted !!!
java_sdk:
	cd /usr/local/lib && $(INST_PREFIX)/$(JAVAPKG_DIR) && ln -sf $(JAVAPKG_DOTDIR) java
	update-alternatives --remove-all java
	update-alternatives --remove-all javac
	update-alternatives --install /usr/bin/java java /usr/local/lib/java/bin/java 120
	update-alternatives --install /usr/bin/javac javac /usr/local/lib/java/bin/javac 120

## install Tomcat in /opt and symlink to $(TOMCAT_LINK)
## you have to set your RAM-Settings
scalix-tomcat:
	cd /opt && tar xpzf $(INST_PREFIX)/$(TOMCAT_PKG) && ln -sf $(TOMCAT_VER) scalix-tomcat
	rm -f $(TOMCAT_LINK)/common/endorsed/xml-apis.jar
	cp $(TOMCAT_LINK)/bin/setclasspath.sh $(TOMCAT_LINK)/bin/setclasspath.bak
	@echo -e "PATH=$(PATH):$(SCALIX_PREFIX)/bin \nJAVA_HOME=/usr/local/lib/java \nJAVA_OPTS='-server -Xms128m -Xmx128m' \nexport JAVA_HOME JAVA_OPTS\n" > $(TOMCAT_LINK)/bin/setclasspath.sh
	cat $(TOMCAT_LINK)/bin/setclasspath.bak >> $(TOMCAT_LINK)/bin/setclasspath.sh
	cp init.d/scalix-tomcat /etc/init.d/
	chown root:root /etc/init.d/scalix-tomcat
	chmod 755 /etc/init.d/scalix-tomcat
	update-rc.d scalix-tomcat defaults 22

## Install Scalix
scalix_inst:
	dpkg -i pkg/*.deb
	$(SCALIX_PREFIX)/bin/ommakeom
	$(SCALIX_PREFIX)/bin/ompatchom

scalix_setup:
## Chapter 5.2 to 5.11 of Wiki
#5.2
	$(SCALIX_PREFIX)/bin/sxconfig --set -t general.usrl_cn_rule=$(CN_RULE)
	$(SCALIX_PREFIX)/bin/sxconfig --set -t general.usrl_authid_rule=$(AUTHID_RULE)
	$(SCALIX_PREFIX)/bin/sxconfig --set -t orniasys.name_part_1='"C" <G.S>' -t orniasys.domain_part_1='$(MAILDOMAIN)'
#5.3
	$(SCALIX_PREFIX)/bin/omaddmn -m $(MAILNODE)
#5.5
	$(SCALIX_PREFIX)/bin/omrc -n
#5.6
	$(SCALIX_PREFIX)/bin/omaddu -n "$(ADMIN_USER)/$(MAILNODE)" --class limited -c admin -p $(ADMIN_PASSWD) $(ADMIN_USER)
#5.7
	$(SCALIX_PREFIX)/bin/omlimit -u "$(ADMIN_USER)/$(MAILNODE)" -o -i 0 -m 0
#5.8
	$(SCALIX_PREFIX)/bin/omaddu -n "$(QUERYADMIN_USER)/$(MAILNODE)" --class limited -c admin -p $(ADMIN_PASSWD) $(QUERYADMIN_USER)@$(HOSTNAME).$(DOMAINNAME)

#5.9
add_sxgroups:
	$(SCALIX_PREFIX)/bin/omaddpdl -l ScalixUserAdmins/$(MAILNODE)
	$(SCALIX_PREFIX)/bin/omaddpdl -l ScalixGroupAdmins/$(MAILNODE)
	$(SCALIX_PREFIX)/bin/omaddpdl -l ScalixUserAttributesAdmins/$(MAILNODE)
	$(SCALIX_PREFIX)/bin/omaddpdl -l ScalixAdmins/$(MAILNODE)

#5.10
add_tweaks:
	cat tweaks/general.cfg >> /var/opt/scalix/sys/general.cfg

#5.11
start_allom:
	$(SCALIX_PREFIX)/bin/omon -s all

tomscal_conf:
	cp $(SCALIX_PREFIX)/web/scalix-res.xml    $(TOMCAT_LINK)/conf/Catalina/localhost
	cp $(SCALIX_PREFIX)/web/scalix-admin.xml  $(TOMCAT_LINK)/conf/Catalina/localhost
	cp $(SCALIX_PREFIX)/web/scalix-caa.xml    $(TOMCAT_LINK)/conf/Catalina/localhost
	cp $(SCALIX_PREFIX)/web/scalix-swa.xml    $(TOMCAT_LINK)/conf/Catalina/localhost
	cp $(SCALIX_PREFIX)/web/scalix-webcal.xml $(TOMCAT_LINK)/conf/Catalina/localhost

## configure Scalix
## Set Domain and Host
conf_swa.properties:
	cat /etc/opt/scalix/webmail/swa.properties \
	    | sed -e 's/%LOCALHOST%/$(HOSTNAME).$(DOMAINNAME)/g' \
	    | sed -s 's/%LOCALDOMAIN%/$(DOMAINNAME)/g' \
	    > /etc/opt/scalix/webmail/swa.properties

conf_ubermanager:
	cat /etc/opt/scalix/caa/scalix.res/config/ubermanager.properties \
	    | sed -e 's/__SECURED_MODE__/false/g' \
	    | sed -e 's/__FQHN_FOR_KDC_HOST__//g' \
	    | sed -e 's="ubermanager/__FQHN_HOST__@__KERBEROS_REALM__"==g' \
	    | sed -e 's/__KERBEROS_REALM__//g' \
	    | sed -e 's/__FQHN_QUERY_SERVER_NAME__/$(HOSTNAME).$(DOMAINNAME)/g' \
	    | sed -e 's/__UBERMGR_USE_EXTERNAL_AUTH__/false/g' \
	    | sed -e 's/__UBERMGR_ALLOW_EXTERNAL_AUTH__/false/g' \
	    | sed -e 's/__UBERMGR_MAXLIST_SIZE__/100/g' \
	    | sed -e 's/__UBERMGR_MAIL_DOMAINS_LIST__/$(MAILDOMAIN)/g' \
	    | sed -e 's/__UBERMGR_EXTERNAL_DOMAIN_AUTH_LIST__//g' \
	    | sed -e 's/__CONFIGURED__/true/g' \
	    > /etc/opt/scalix/caa/scalix.res/config/ubermanager.properties
	    echo $(ADMIN_PASSWD) > /etc/opt/scalix/caa/scalix.res/config/psdata
	    chmod 400 /etc/opt/scalix/caa/scalix.res/config/psdata
	    chown root:root /etc/opt/scalix/caa/scalix.res/config/psdata

conf_res.properties:
	cat /etc/opt/scalix/res/config/res.properties \
	    | sed -e 's/__SECURED_MODE__/false/g' \
	    | sed -e 's/__FQHN_FOR_UBERMANAGER__/$(HOSTNAME).$(DOMAINNAME)/g' \
	    | sed -e 's/__TOMCAT_PORT__/$(TOMCAT_PORT)/g' \
	    | sed -e 's/__KERBEROS_REALM__//g' \
	    | sed -e 's/__FQHN_FOR_KDC_HOST__//g' \
	    | sed -e 's/__CONFIGURED__/true/g' \
	    > /etc/opt/scalix/res/config/res.properties

restart_tomcat:
	/etc/init.d/scalix-tomcat restart

## Configure Apache2
config_apache2:
	ln -sf $(SCALIX_PREFIX)/global/httpd/scalix-web-client.conf /etc/apache2/conf.d
	/etc/init.d/apache2 restart