XWiki On Debian 4 (Etch) - Tomcat - PostgreSQL (or MySQL)

XWiki is a professional wiki with enterprise features such as blog, strong rights management, LDAP authentication, PDF export, full skining and more. It also includes an advanced form and scripting engine making it a development environment for data-based applications. It has powerful extensibility features such as scripting in pages, plugins and a highly modular architecture. See the full feature list for more.

 

Installation

Prerequisites

  • Debian 4 (etch), non-free repository (see comment from phornung at the bottom, thanks!)
  • PostgreSQL 8.2.7 (or higher) OR MySQL 5
  • Root-Access (sudo/su)
  • After every code line you press the "Enter-Button"

 

Here we go

1. First we install JAVA JDK 5

apt-get install sun-java5-jdk
JAVA_OPTS="-Xmx512M"
export JAVA_HOME
export JAVA_OPTS

The "-Xmx512M" setting means the maximum amount of RAM for JAVA and depends on your server.

 

2. We install Tomcat 5.5

apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps
/etc/init.d/tomcat5.5 stop

 

3. Disable Tomcat security

vi /etc/init.d/tomcat5.5
TOMCAT5_SECURITY=no

 

4. Create the xwiki database

PostgreSQL

CREATE DATABASE xwiki
WITH OWNER = mit_dem_admin-user_ersetzen_bspw_pgsql
ENCODING = ‘UNICODE’
TABLESPACE = pg_default;

CREATE USER xwiki PASSWORD ‘xwiki’ VALID UNTIL ‘infinity’;

CREATE GROUP xwiki;
ALTER GROUP xwiki ADD USER xwiki;
GRANT ALL ON SCHEMA public TO xwiki;

MySQL

mysql -u root -p -e "create database xwiki"
mysql -u root -p -e "grant all privileges on xwiki.* to [email protected] identified by 'xwiki'"

 

5. Now we get the WAR file into our new Tomcat webapps folder and download the WAR file

cd /var/lib/tomcat5.5/webapps/ 
wget http://download.forge.objectweb.org/xwiki/xwiki-enterprise-web-1.3.war

You have to copy the current direct link after "wget".

 

6. Then rename the WAR file and restart Tomcat

mv /var/lib/tomcat5.5/webapps/* /var/lib/tomcat5.5/webapps/xwiki.war
/etc/init.d/tomcat5.5 restart

After "webapps" replace the "star" with the filename from the link you just copied.



7. We have to copy the PostgreSQL OR MySQL JDBC Driver JAR

PostgreSQL Procedure

cd /var/lib/tomcat5.5/webapps/xwiki/WEB-INF/lib/
wget http://jdbc.postgresql.org/download/postgresql-8.3-603.jdbc4.jar

chown tomcat55:nogroup /var/lib/tomcat5.5/webapps/xwiki/WEB-INF/lib/postgresql-8.3-603.jdbc4.jar
/etc/init.d/tomcat5.5 restart

MySQL Procedure
Go to: http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.5.tar.gz/from/pick#mirrors.
Download it to your client, extract it and upload the "mysql-connector-java-5.1.5-bin.jar" file (661KB) into your "/home/user" directory (I hope you've disabled root-logins to your server).

mv /home/user/mysql-connector-java-5.1.5-bin.jar /var/lib/tomcat5.5/webapps/xwiki/WEB-INF/lib/mysql-connector-java-5.1.5-bin.jar 
chown tomcat55:nogroup /var/lib/tomcat5.5/webapps/xwiki/WEB-INF/lib/mysql-connector-java-5.1.5-bin.jar
/etc/init.d/tomcat5.5 restart

 

8. Change hibernate.cfg.xml

vi /var/lib/tomcat5.5/webapps/xwiki/WEB-INF/hibernate.cfg.xml
<!-- PostgreSQL configuration.
Uncomment if you want to use PostgreSQL and comment out other database configurations.
Note that the database will be created automatically if it doesn't already exist.-->
<property name="connection.url">jdbc:postgresql://localhost:5432/xwiki</property>
<property name=”connection.username”>xwiki</property>
<property name=”connection.password”>xwiki</property>
<property name=”connection.driver_class”>org.postgresql.Driver</property>
<property name=”dialect”>org.hibernate.dialect.PostgreSQLDialect</property>
<property name=”connection.provider_class”>com.xpn.xwiki.store.DBCPConnectionProvider</property>
<property name=”connection.pool_size”>2</property>
<property name=”statement_cache.size”>2</property>
<mapping resource=”xwiki.hbm.xml”/>
<mapping resource=”feeds.hbm.xml”/> 

 

<!-- MySQL configuration.
Uncomment if you want to use MySQL and comment out other database configurations.
Note that the database will be created automatically if it doesn't already exist.-->
<property name="connection.url">jdbc:mysql://localhost/xwiki</property>
<property name="connection.username">xwiki</property>
<property name="connection.password">xwiki</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
<property name="connection.pool_size">2</property>
<property name="statement_cache.size">2</property>
<mapping resource="xwiki.hbm.xml"/>
<mapping resource="feeds.hbm.xml"/>

Attention! Be sure you uncommented ("<!--" starts a comment "-->" ends a comment) the right section (PostgreSQL OR MySQL). Further please check the username and the password (!) given in step 4.

 

9. Apache & Domain (optional)

If you want to access your XWiki only with an IP-address, you can skip this step as you should already be able to see your XWiki with http://MyIP:8180/xwiki

Otherwise we have to initiate some settings in our Apache configuration. If you already have a setting for your domain, change it accordingly. Otherwise just copy the highlighted part into the new file, which you create as following:

vi /etc/apache2/sites-enabled/domain.conf
NameVirtualHost MyIP:80

<VirtualHost MyIP:80>

DocumentRoot /var/www/
<Directory "/var/www/">
 Options -Indexes Includes FollowSymLinks
 AllowOverride All
 Allow from all
</Directory>

RedirectMatch permanent ^/$ http://domain/xwiki/

ProxyPass /xwiki http://domain:8082/xwiki/
ProxyPassReverse /xwiki  http://domain:8082/xwiki/

</VirtualHost> 

Replace "domain" with your actual domain-name.

Apache changes to the domain configuration file will require that the mod_alias and mod_proxy modules of Apache be enabled (Thanks to Aurora who pointed that out!). 'mod_alias' is required to use the RedirectMatch directive, and 'mod_proxy' is required to use the ProxyPass and ProxyPassReverse directives.

If alias.conf and proxy.conf do not appear in the /etc/apache2/mods-enabled directory they need to be enabled as follows:

a2enmod alias
a2enmod proxy 
/etc/init.d/apache2 restart

Restarts Apache. Now you should be able to see your XWiki with http://domain/

 

10. Change /var/lib/tomcat5.5/conf/tomcat-users.xml

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="admin"/>
<role rolename="manager"/>
<role rolename="tomcat"/>
<user username="tomcat"
password=”tomcatpassword”
roles="tomcat,admin,manager"/>
</tomcat-users>

Attention! This is may a security risk. I decided to combine every role to one user as I'm the only one who maintains the server. Change the "username" and the "password" accordingly.

 

11. Import initial content & settings

Go to: http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation#HInstallingtheDefaultWikiXAR and follow the instructions there.

That's it!

 Last minute update => I had to change a part in my proxy.conf in '/etc/apache2/mods-enabled/

        <Proxy *>
                AddDefaultCharset off
                Order deny,allow
                Allow from all
                #Allow from .example.com

                # Define the character set for proxied FTP directory listings
                ProxyFtpDirCharset UTF-8
        </Proxy>
 

Share this page:

7 Comment(s)