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

Want to support HowtoForge? Become a subscriber!
 
Submitted by Thunderbirdsei (Contact Author) (Forums) on Fri, 2008-03-21 17:19. :: Debian

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 xwiki@127.0.0.1 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>
 


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by AronP (not registered) on Thu, 2011-01-06 11:18.

 The line stating

> mv /var/lib/tomcat5.5/webapps/* /var/lib/tomcat5.5/webapps/xwiki.war

 seems a little dangerous to me, particularly as the bit about changing star comes after this.  Wouldn't it be safer to change to xwiki-enterprise-web-xxx.war or something.

Submitted by mikiowoko (registered user) on Sat, 2008-08-09 20:35.

You had:

mysql -u root -e "create database xwiki"


that wouldn't work for me.

 

$ mysql -u root -p -e "create database xwiki"

worked, without the -p  MYSQL responded "access denied. with it, mysql responded with a password challenge and accepted it.

Submitted by Thunderbirdsei (registered user) on Mon, 2008-08-25 18:40.
Thanks, I've changed it.
Submitted by Aurora (registered user) on Wed, 2008-03-26 17:12.

Step 9 - Apache changes to the domain configuration file will require that the mod_alias and mod_proxy modules of Apache be enabled.

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
Submitted by phornung (registered user) on Sun, 2008-03-23 00:10.

I'm not sure if it was the contrib or non-free repository (most likely non-free), but I wasn't able to

apt-get install sun-java5-jdk

until after adding the additional repository.  Make sure you modify your /etc/apt/sources.list before step 1.  Something like:

deb http://mirrors.kernel.org/debian/ etch main contrib non-free

deb-src http://mirrors.kernel.org/debian/ etch main contrib non-free

works just fine.

Submitted by Anonymous (not registered) on Wed, 2010-04-21 19:32.
ap-get update is required before install java