Open-XChange安裝小記 : 進公司干的第二件事情


 

Open-Xchange安裝日志

 

Pre-install

 

安裝apt

 

wget  http://ftp.freshrpms.net/pub/freshrpms/redhat/9/apt-0.5.5cnc6-frl.i386.rpm

rpm  -ihv  apt- 0.5.5 cnc6-frl.i386.rpm

apt-get  update

 

vi /etc/apt/sources.list

在該文件中添加以下五行:

 

rpm             http://mirrors.sunsite.dk/jpackage 1.5/generic free

rpm-src         http://mirrors.sunsite.dk/jpackage 1.5/generic free non-free

rpm             http://mirrors.sunsite.dk/jpackage 1.5/redhat-9 free

rpm-src         http://mirrors.sunsite.dk/jpackage 1.5/redhat-9 free

rpm             http://apt.sw.be redhat/9/en/i386 dag

 

返回命令行提示符.

 

apt-get  update

apt-get install postgresql postgresql-server postgresql-libs

 

#apt-get install httpd httpd-manual

#:因為在原有linux服務器上已經安裝了Apache http server2.2 故無需執行

 

apt-get install xerces-j2

apt-get install jdom

apt-get install postgresql-jdbc

apt-get install mod_jk-ap20

 

#此命令為下載安裝ApacheTomcat的連接器

#除非linux上的Apache安裝在默認路徑/usr/local/apache2

#否則,在此安裝的連接器是不起作用的.

#后面mod_jk須自行手動下載、編譯、安裝、配置

 

apt-get install perl-Convert-ASN1

apt-get install perl-ldap

 

#perl模塊下載時也自動下載的所需的模塊包括:

# perl-IO-Socket-SSL

# perl-Net-SSLeay

# perl-XML-NamespaceSupport

# perl-XML-SAX

 

apt-get install perl-Authen-SASL

#命令提示找不到相應的模塊,可通過CPAN安裝,如下:

 

perl –MCPAN –e shell

cpan>install Authen::SASL

 

http://sietse.net/exoops/modules/OpenXchange/?distr=rh9下載

openldap-clients-2.0.27-8.i386.rpm

openldap-servers-2.0.27-8.i386.rpm

/home/xkx/ox目錄下。

cd /home/xkx/ox

rpm -Uvh openldap-servers- 2.0.27 -8.i386.rpm openldap-clients-2.0.27-8.i386.rpm

service ldap start

 

Sun官方網站下載

j2sdk-1_4_2_10-linux-i586.bin

jaf-1_0_2-upd2.zip

javamail-1_4-ea.zip

存放到/home/xkx/ox目錄下

 

安裝JDK

cd /home/xkx/ox

chmod 755 j2sdk-1_4_2_10-linux-i586.bin

 

/etc/profile,/etc/profile.d/java.sh,/root/.bashrc下分別加入如下四行:

JAVA_HOME="/home/xkx/ox/j2sdk 1.4.2 _10"

JAVA_BIN="/home/xkx/ox/j2sdk 1.4.2 _10/bin"

PATH=$JAVA_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

#設置了環境變量后,可在命令提示符下檢查:

echo $JAVA_HOME

java  -version

 

解壓jaf-1_0_2-upd2.zipjavamail-1_4-ea.zip,分別把其中的mail.jaractivation.jar拷貝到

/usr/share/java目錄下

 

apt-get install ant

 

Apache官方網站下載

jakarta-tomcat- 5.0.28 .tar.gz

jakarta-tomcat- 5.0.28 -deployer.tar.gz

/home/xkx目錄下

 

tar –xvzf  jakarta-tomcat- 5.0.28 .tar.gz

cd  akarta-tomcat- 5.0.28 /bin

./startup.sh

 

jakarta-tomcat- 5.0.28 -deployer.tar.gz解壓后取出servlet-api.jar,並拷貝到/usr/share/java下。

 

 

Configure

 

1 Postgresql

 

service postgresql start

編輯文件/var/lib/pgsql/data/postgresql.conf,確保有下面這樣一行:

tcpip_socket = true

 

編輯文件/var/lib/pgsql/data/pg_hba.conf,確保有下面這樣的兩行:

local   all         all                                             trust

host    all         all         127.0.0.1         255.255.255.255      trust

 

service postgresql restart

useradd ox

su – postgres

createuser -A -D -P openxchange

鍵入密碼:123456

createdb openxchange

exit

 

2、安裝OX

 

http://mirror.open-xchange.org/ox/EN/community/download.htm下載

open-xchange- 0.8.0 -6.tar.gz

/home/xkx/ox

 

tar –xvzf open-xchange- 0.8.0 -6.tar.gz

cd open-xchange- 0.8.0 -6

export OX_INSTALL=/usr/local/ox

 

./configure \

--prefix=$OX_INSTALL \

--with-mailjar=/usr/share/java/mail.jar \

--with-activationjar=/usr/share/java/activation.jar \

--with-jdomjar=/usr/share/java/jdom-1.0.jar \

--with-xercesjar=/usr/share/java/xerces-j2- 2.6.2 .jar \

--with-jsdkjar=/usr/share/java/servlet-api.jar \

--with-jdbcjar=/usr/share/pgsql/pg73jdbc3.jar \

--enable-webdav \

--with-htdocsdir=/home/htdocs \

--with-cgibindir=/home/cgi-bin \

--with-dbname=openxchange \

--with-dbuser=openxchange \

--with-dbpass=123456 \

--with-dbhost=localhost \

--with-runuid=ox \

--with-rungid=ox

 

make

make install

 

在瀏覽器中輸入http://192.168.0.185/cgi-bin/login.pl看是否能看到登錄的畫面。

 

3、配置Servlet

 

cd  /home/xkx/jakarta-tomcat- 5.0.28 /webapps

mkdir servlet

mkdir servlet/WEB-INF

mkdir servlet/WEB-INF/classes

mkdir servlet/WEB-INF/lib

cd servlet/WEB-INF/

cp $OX_INSTALL/share/servlets/*.class classes/

cp $OX_INSTALL/lib/* lib/

cp lib/umin.war  .

 

http://sietse.net/exoops/modules/OpenXchange/?distr=rh9下載web.xml

並把所有<param-value>中的open-xchange改為ox

之后把文件放在/home/xkx/jakarta-tomcat- 5.0.28 /webapps/servlet/WEB-INF目錄下

 

重新啟動tomcat,即:

cd  /home/xkx/jakarta-tomcat- 5.0.28 /bin

./shutdown.sh

./startup.sh

 

在瀏覽器中輸入:http://192.168.0.185:8080/servlet/intranet 可以看到“The Open-XChange(tm) Server is not running-Groupware  Please inform the Administrator!

 

在文件/home/xkx/jakarta-tomcat- 5.0.28 /conf/tomcat-users.xml中添加一行:

<user username="admin" password="123456" roles="admin"/>

 

 

4、整合ApacheTomcat

 

cp /usr/share/doc/mod_jk-ap20- 1.2.5 /workers.properties.sample /etc/httpd/conf/workers.properties

 

/etc/httpd/conf.d/下創建文件mod_jk.conf,內容如下:

 

<IfModule mod_jk.c>

JkWorkersFile   /home/conf/workers.properties

JkLogFile       /home/logs/mod_jk.log

JkLogLevel      error

JkMount /servlet/* ajp13

JkMount /umin/* ajp13

JkMount /*.jsp ajp13

JkMount /examples/* ajp13

JkMount /servlet/webdav.contacts* ajp13

JkMount /servlet/webdav.ical* ajp13

JkMount /servlet/weddav.documents* ajp13

JkMount /servlet/webdav.calendar* ajp13

JkMount /servlet/webdav.tasks* ajp13

JkMount /servlet/webdav.contacts* ajp13

JkMount /servlets-examples/* ajp13

JkMount /jsp-examples/* ajp13

#JkMount /servlet/intranet/* ajp13

</IfModule>

 

Apache官方網站下載jakarta-tomcat-connectors- 1.2.15 -src.tar.gz

/home/xkx目錄下

 

tar –xvzf jakarta-tomcat-connectors- 1.2.15 -src.tar.gz

cd   /home/xkx/jakarta-tomcat-connectors- 1.2.15 -src/jk/native

./configure \

--with-apxs=/home/bin/apxs

--with-java-home=/home/xkx/ox/j2sdk 1.4.2 _10

make

make install

#之后會發現/home/modules下多了一個文件mod_jk.so

 

/home/conf/httpd.conf中加入:

 

LoadModule jk_module modules/mod_jk.so

Include /etc/httpd/conf.d/mod_jk.conf

 

修改文件/home/conf/workers.properties

 

workers.tomcat_home=/home/xkx/jakarta-tomcat- 5.0.28

workers.java_home=/home/xkx/ox/j2sdk 1.4.2 _10

 

重新啟動Tomcat

 

在瀏覽器中重新輸入http://192.168.0.185/servlet/intranet

如能看到和8080端口一樣的內容則整合成功

 

5、為數據庫Postgresql創建表

 

psql -dopenxchange -h localhost -Uopenxchange -W -f $OX_INSTALL/share/init_database.sql

psql -dopenxchange -h localhost -Uopenxchange -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

 

#總共47y

 

 

6、是Tomcat開機自動運行

/etc/rc.d/init.d下創建文件tomcat,內容如下:

 

RETVAL=$?

CATALINA_HOME="/home/xkx/jakarta-tomcat- 5.0.28 "

 

case "$1" in

start)

if [ -f $CATALINA_HOME/bin/startup.sh ];

then

echo $"Starting Tomcat"

/bin/su - root -c $CATALINA_HOME/bin/startup.sh

fi

;;

stop)

if [ -f $CATALINA_HOME/bin/shutdown.sh ];

then

echo $"Stopping Tomcat"

/bin/su - root -c $CATALINA_HOME/bin/shutdown.sh

fi

;;

*)

echo $"Usage: $0 {start|stop}"

exit 1

;;

Esac

 

 

7、配置LDAP

 

編輯/etc/openldap/slapd.conf文件。使其內容從63行起如下:

 

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

 

#add for ox

loglevel 4

 

access to dn.subtree="ou=Users,ou=OxObjects,dc=example,dc=org"

            by self write

            by users write

            by anonymous auth

 

access to dn.subtree="ou=Groups,ou=OxObjects,dc=example,dc=org"

            by self write

            by users write

            by anonymous auth

 

注:如不給users分配write權限,則在使用中只能把Contact放入postgre不能放入ldap。提示信息為:用戶無寫權限

 

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

#得到一個密碼

 

編輯$OX_INSTALL/share/init_ldap.ldif,把

userPassword: secret

修改為:

userPassword: {CRYPT}CGPbeX4Qyrui2

#填入剛才生成的密碼。

 

service ldap stop

rm -rf /var/lib/ldap/*

slapadd -l $OX_INSTALL/share/init_ldap.ldif

chown -R ldap:ldap /var/lib/ldap

service ldap start

 

ln -s /etc/openldap/ldap.conf $OX_INSTALL/etc/groupware/ldap.conf
ln -s /etc/openldap/ldap.conf $OX_INSTALL/etc/webmail/ldap.conf

 

8、創建用戶

 

cd $OX_INSTALL/sbin

./adduser_ox  \

--username=cuichao \

--passwd= 123456 \

--name=chao \

--sname=cui \

--maildomain=example.org \

--ox_timezone=Asia/Beijing

 

./addusertogroup_ox user=cuichao group=users

 

cp /usr/local/ox/etc/init.d/openexchange /etc/rc.d/init.d/
ln -s /etc/rc.d/init.d/ox /etc/rc.d/rc3.d/S71openexchange
ln -s /etc/rc.d/init.d/ox /etc/rc.d/rc5.d/S71openexchange

 

9、配置WebDav

 

service tomcat stop

cd /home/xkx/jakarta-tomcat- 5.0.28 /webapps/servlet/WEB-INF/classes

cp $OX_INSTALL/lib/webdav.jar .

jar xvf webdav.jar
cd ../lib
ln -s /usr/share/java/jdom.jar .
ln -s /usr/share/pgsql/pg73jdbc3.jar .

touch $OX_INSTALL/var/log/jserv.log

/home/xkx/jakarta-tomcat- 5.0.28 /bin/catalina.sh文件中加入:

JAVA_OPTS="-Dopenexchange.propfile=/usr/local/ox/etc/groupware/system.properties"

 

10、其他安裝后的問題

 

1)  確保/home/conf/httpd.conf文件中DocumentRoot /home/htdocs

2)  確保/usr/local/ox/etc/groupware/system.properties

IMGPATH,SOUNDPATH,CSSPATH,JAVASCRIPTPATH是以/cfintranet開頭的相對於/home/htdocs的相對地址

3)  因為把JDK安裝在了用戶私有目錄下:/home/xkx。其默認權限為rwx------

故在啟動ox的三個后台進程時,因為無執行JDK的權限而無法啟動。解決方法為:

Chmod 755 /home/xkx

 

 

 

11、最后

 

service tomcat start

service openexchange start

service httpd restart

 

 


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2021 ITdaan.com