Page tree
Skip to end of metadata
Go to start of metadata

Your Rating: Results: 1 Star2 Star3 Star4 Star5 Star 129 rates

This page will show step by step how we installed and configured our linux server. As the distribution we take CentOS 5.3
The configuration is followed this guide, enhanced, cropped and adapted to our needs.


Download and burn the CentOS 5.3 DVD from

You can get it here

Boot your server from the DVD and press Enter at the boot prompt

As it can take quite long we skip the test of the installation media

On the startup screen click Next

We choose English as our main language

As for the keyboard layout we take German (Swiss German)

Choose to install a new CentOS

Choose "remove linux partitions..." and accept the warning that you will loose all data

Set a manuall IP-Adress for the server as well as the host name and the misceallaneous settings

Subnet Mask:
Primary DNS:
Secondary DNS:

Set the time-zone to your nearest location

Set the root password and confirm it

Select server as the default installation (we don't really need a Desktop Environment) and select "Customize now"

Change and select the default packages which should be installed on the server

Select the following:
- Editors
- Text-based Internet
- Development Libraries
- Development Tools
- MySQL Database
- Server Configuration Tools
- Web Server
- Administration Tools
- Base
- System Tools

You have to switch between the registers to do so. Deselect all the other package groups, and click next, the installation routine will then check the dependencies.

Click next to start the installation

Now the harddisk will be formatted and your packages will be installed. Wait for it to be finished, remove the installation disk and click on Reboot.


Enter the firewall configuration after reboot

You can also at anytime entering the config by using the command


Set the setting above for the moment, depending on your need you may want to make adaptions here.
Also, we disabled SELinux a security extenion comming with CentOS, but it's suggest to be turned off as it may result in more troubles then it helps to prevent.
After your done configuring reboot the server for it's changes to take effect.


Install and update software packages

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum update
yum groupinstall 'Development Tools'
yum groupinstall 'Development Libraries'

Install Apache, MySQL, phpMyAdmin

Actually MySQL and phpMyAdmin are optional steps you can skip if you don't want to use MySQL as your database for magnolia (if so how to configure magnolia for using MySQL can be found here on the wiki).

Import RPMforge repository as some of the packages we need are not part of the official CentOS 5.3 repository

rpm --import
cd /tmp
rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Download and install the needed packages

yum install ntp httpd mysql-server php php-mysql php-mbstring php-mcrypt phpmyadmin rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel

Start MySQL and set the root password

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
mysqladmin -u root password *****

Configure phpMyAdmin

First we comment out some, for phpMyAdmin not only allowing access from localhost.

vi /etc/httpd/conf.d/phpmyadmin.conf
#  Web application to manage MySQL

#<Directory "/usr/share/phpmyadmin">
#  Order Deny,Allow
#  Deny from all
#  Allow from

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Now we change the authentication in phpMyAdmin from cookie to http.

vi /usr/share/phpmyadmin/
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';

Create system startup links for Apache and start it

chkconfig --levels 235 httpd on
/etc/init.d/httpd start

At this point you can earn from your work so far and go check for the CentOS default apache startpage and for the PhpMyAdmin Administration startpage.

Installing JDK (Java Development Kid)

Download the latest JDK (or the one you specifically need)

You can get it here
Copy it to your prefered download directory like /usr/download and execute it.

cd /usr/download
chmod +x jdk-xuyz-linux-i586.bin
mv jdk1.x.0_xy/ /usr/lib/
cd /usr/lib/
ln -s jdk1.x.0_xy jdk

Installing Tomcat

Download the binary of your preferred Tomcat version to your download directory.

You can do so at choose the tar.gz file from the core section.
Change to your download directory and extract the files.

tar xvzf apache-tomcat-6.0.20.tar.gz
mkdir /etc/tomcat
mv apache-tomcat-6.0.20 /etc/tomcat/default

Startup Script for tomcat

We want tomcat to start automatically when booting our server, so we add a corresponding script file.

touch /etc/init.d/tomcat
chmod a+x /etc/init.d/tomcat
vi /etc/init.d/tomcat
# Init file for SixSigns Tomcat server
# chkconfig: 2345 55 25
# description: SixSigns Tomcat server

# Source function library.
. /etc/init.d/functions

RUN_AS_USER=root # Adjust run user here

start() {
        echo "Starting Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/"
        echo "done."
stop() {
        echo "Shutting down Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/"
        echo "done."

case "$1" in
        sleep 10
        #echo "Hard killing any remaining threads.."
        #kill -9 `cat $CATALINA_HOME/work/`
        echo "Usage: $0 {start|stop|restart}"

exit 0

Now we are making a softlink for being able to start/stop/restart tomcat

cd /usr/bin
ln -s /etc/init.d/tomcat tomcat

Finally we add the script to chkconfig for tomcat being automatically started on booting the server.

chkconfig --add tomcat

Customize tomcat

For adding more memory to the instance, and make it a bit more stable (reduced termination signal) we create and add the following to as well as we define the JAVA_HOME Variable and increasing the number of open files allowed by the process (this is especially important during installation, otherwise the process will fail).

touch /etc/tomcat/default/bin/
vi /etc/tomcat/default/bin/
export JAVA_HOME

CATALINA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true -Xrs"

ulimit -n 30000

You can start/stop your tomcat server now

tomcat start/stop/restart

When you started it up you should be able to see the Tomcat default page:

Installing and configuring mod_jk

Install APXS (Apache Extension Tools)

yum install httpd-devel

This will install APXS under /usr/sbin/apxs

Download and compile the source of the tomcat connector

You can download the file here:, save under the /usr/src directory.

cd /usr/src
tar xvzf jakarta-tomcat-connectors-1.2.15-src.tar.gz
cd jakarta-tomcat-connectors-1.2.15-src/jk/native/
./configure --with-apxs=/usr/sbin/apxs

Now that we compiled our we can copy it to our apache/modules folder.

cd apache-2.0/
cp /etc/httpd/modules/

Configuring apache

First we gonna create the file.

mkdir /etc/httpd/logs/mod_jk
touch /etc/httpd/conf/
vi /etc/httpd/conf/

Then we will change the apache configuration for using mod_jk, if defined so in the corresponding virtual hosts.

touch /etc/httpd/conf.d/mod_jk.conf
vi /etc/httpd/conf.d/mod_jk.conf
##### MOD_JK Configuration #####

LoadModule jk_module /etc/httpd/modules/

JkWorkersFile	/etc/httpd/conf/
JkLogFile	logs/mod_jk/mod_jk.log
JkLogLevel	error

Uncomment the following line in /etc/httpd/conf/httpd.conf

NameVirtualHost *:80

And finally we can create a virtual host definition file for redirecting requests to our tomcat application server.

mkdir /etc/httpd/logs/default
touch /etc/httpd/conf.d/1_default.conf
vi /etc/httpd/conf.d/1_default.conf
<VirtualHost *:80>

    CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/default/access.log 86400" combined
    ErrorLog  "logs/default/error.log"

    JkMount /* default

Deploy Magnolia

Download and unpack magnolia

You can download your magnolia copy here: Edition) or here: (Enterprise Edition)

If you are taking the EE you may also want to get a demo license here: or contact us for further evaluation.

Then place your WAR-File in /etc/tomcat/default/webapps and startup tomcat, the file will automatically be extracted into something like magnolia-enterprise-webapp-4.1 (which then also is the path where you can access your instance ->

Alternatively you can also extract the war-file manually into any folder under /etc/tomcat/default/webapps. With out any further cofiguration the context-path of you web-application will be the name of that folder.
If you want to have a plain context path, just place your Web-Application in a folder called ROOT (maybe remove it's content as well as the management applications if you don't really need them.


Start your tomcat and visit your server address defined in the virtual host ( And now depending on your context path of the web application you should be able to see the magnolia's installation screen.


For security reasons you may want to run you romcat using a non priviledged user, remember in that case to edit your script in /etc/inti.d

groupadd tomcat
usedadd -g tomcat tomcat
chown -R tomcat:tomcat /etc/tomcat/default
passwd tomcat

Adding Multiple Tomcat Instances

You can easily run multiple tomcat instances on the same server. The following steps are need for doing so:
* Copying the current tomcat to a second one
* Copying and addapt the init.d script and add the copied one to chkconfig
* If needed creating another softlink with a different name (tomcat2 or something like that) in /usr/bin* Changing the port-numbers of the copied tomcat in /TOMCAT_HOME/conf/server.xml* Extending /etc/httpd/conf/workers.poperties* Creating an aditional virtual host for apache using this extended worker


    • don't add stuff to env variables need to be set in; and even then, I'd recommend using or something similar, to avoid those vars to be set ALSO when calling the shutdown program. (which IS an issue if you have jmx or debug options in there)
    • likewise, I wouldn't recommend to set JAVA_HOME system-wide, but just in (more explicit, less magic, and you can use different java versions for different tomcats)
    • you might want to double-check the scripts, there are lost \ in there.
    1. Thanks for the input Gregory, I moved those specific variables into and reviewed the scripts which got messed while copying them.

    2. Unknown User (jpetersen)

      Regarding "to avoid those vars to be set ALSO when calling the shutdown program":

      It is perfectly valid to place Java runtime options in, but only when using CATALINA_OPTS and not JAVA_OPTS. Here is an excerpt from the documentation inside

      CATALINA_OPTS  [...]
      Include here and not in JAVA_OPTS all options, that should
      only be used by Tomcat itself, not by the stop process,
      the version command etc.

      (I edited the page and replaced JAVA_OPTS with CATALINA_OPTS.)