Installing Alfresco 2.1 on Ubuntu 7.10

Showing results for 
Search instead for 
Did you mean: 

Installing Alfresco 2.1 on Ubuntu 7.10

0 0 1,485

Obsolete Pages{{Obsolete}}

The official documentation is at:

Back to Installing_on_Linux

See also Installing Alfresco on Ubuntu 8.04 which describes a few things that you need to do differently

This document describes the installation of Alfresco 2.1 on Ubuntu 7.10.
This installs Alfresco 'the Linux way':

  • Runs Alfresco as the alfresco user
  • Stores repository files in /var/lib/alfresco
  • Stores logging in /var/log/alfresco
  • Keep a PID file to prevent starting Alfresco twice
  • Run headless OpenOffice using the xvfb dummy X server

sudo actions

By default, Ubuntu uses the sudo command, meaning 'super user do', for actions that require root access.
If you are not root remember to prepend all actions that require root access with 'sudo'.
Like so:

 sudo apt-get install mysql-server

You may want to enable the root user for ease of installation:

 sudo su

Install required packages

The MySQL database server:

 apt-get install mysql-server 

The dummy X server required for

 apt-get install xvfb

OpenOffice for document transformations:

 apt-get install

The iptables package required for using the CIFS, FTP, NFS or FTP while running as non-root user:

 apt-get install iptables

The Sun Java Development Kit(jdk)required for Tomcat to function. The sun-java6-jre and sun-java6-bin packages will be installed automatically with the jdk:

 apt-get install sun-java6-jdk

Imagemagick for image transformation:

 apt-get install imagemagick

Portmapper for required for NFS server:

 apt-get install portmap

NFS common package required for NFS server:

 apt-get install nfs-common


Add this line to /etc/environment to set JAVA_HOME:


Create the alfresco user and group

 groupadd alfresco
useradd -m -g alfresco alfresco

The alfresco user needs a home directory for OpenOffice, hence the '-m'.
The alfresco user never needs to log in, there should be a '!' for the password in the /etc/shadow entry. If not, put it there.

Install Alfresco Tomcat bundle

Unpack the tarball:

 mkdir /opt/alfresco
cd /opt/alfresco
tar -xzf alfresco-enterprise-tomcat-2.1.1.tar.gz

Important!!! Make sure that /opt/alfresco/tomcat/ and below is owned by alfresco:

 chown -R alfresco:alfresco /opt/alfresco/tomcat/

Create the database

Using the mysql command line client:

 create database alfresco;
grant all privileges on alfresco.* to alfresco@localhost identified by 'alfresco';

(Choose your own password, just make sure it matches what you configure in later on)

Create directories for variable data

Create space for the repository, the cache and make the user and group alfresco its owner:

 mkdir -p /var/lib/alfresco/alf_data
mkdir /var/lib/alfresco/tmp

 chown -R alfresco:alfresco /var/lib/alfresco

Create a directory for the logs and make the user and group alfresco its owner:

 mkdir -p /var/log/alfresco/tomcat/logs

 chown -R alfresco:alfresco /var/log/alfresco

The Alfresco log will be in /var/log/alfresco/alfresco.log.

Configure the repository

Create custom-repository-context.xml in the extensions directory (/opt/alfresco/tomcat/shared/classes/alfresco/extension), if it is not already there:

  <?xml version='1.0' encoding='UTF-8'?>
    <!-- overriding to point to custom properties -->
    <bean id='repository-properties' class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer'>
        <property name='ignoreUnresolvablePlaceholders'>
        <property name='locations'>

                <!-- Override basic repository properties -->
    <bean id='hibernateConfigProperties' class='org.springframework.beans.factory.config.PropertiesFactoryBean'>
        <property name='locations'>

                <!-- Override hibernate dialect -->

Change configuration files in extension/ directory.

Change repository configuration (uncomment/comment corresponding lines and add values where missing):


Change the hibernate configuration (uncomment/comment corresponding lines):


To configure the CIFS server to use non-privileged ports use the following in either file-servers.xml or file-servers-custom.xml configuration file (whichever is present), in the section <config evaluator='string-compare' condition='CIFS Server'>:

     <tcpipSMB port='1445' platforms='linux,solaris,macosx'/>
     <netBIOSSMB sessionPort='1139' namePort='1137' datagramPort='1138' platforms='linux,solaris,macosx'/>

If this section is missing (it is not in file-servers-custom.xml in my install), add it, so that you have:

 <alfresco-config area='file-servers'>
   <config evaluator='string-compare' condition='CIFS Server'>
      <serverEnable enabled='true'/>
      <host name='${localname}_A'/>
      <comment>Alfresco CIFS Server</comment>
      <tcpipSMB platforms='linux,solaris,macosx'/>
      <netBIOSSMB platforms='linux,solaris,macosx'/>
      <tcpipSMB port='1445' platforms='linux,solaris,macosx'/>
      <netBIOSSMB sessionPort='1139' namePort='1137' datagramPort='1138' platforms='linux,solaris,macosx'/>
      <hostAnnounce interval='5'/>
      <sessionDebug flags='Negotiate,Socket'/>

at the start of the file-servers-custom.xml file.

Configure Tomcat logging

Tomcat logging is hard to change because some of the tomcat scripts write to the log directory directly.
To move the logs away from the program files we use a symbolic link.
Remove the logging directory and create a symlink instead:

 rm -r /opt/alfresco/tomcat/logs
ln -s /var/log/alfresco/tomcat/logs /opt/alfresco/tomcat/logs

Configure Alfresco logging

First create a symlink - this will make sure the logfile is correct in the right location from the start.

 rm /opt/alfresco/alfresco.log
ln -s /var/log/alfresco/alfresco.log /opt/alfresco/alfresco.log

The next step needs to be done after Alfresco was started once, as tomcat/webapps/alfresco/ subtree only appears after alfresco.war in tomcat/webapps/ is deployed.
So skip this step for now, start Alfresco once, verify that tomcat/webapps/alfresco/WEB-INF/classes/ was unpacked, stop Alfresco, do the change, then start Alfresco again):

In tomcat/webapps/alfresco/WEB-INF/classes/ modify line


to read


After this step the original symlink can be removed at leisure.

Init script

Store the following script as /etc/init.d/alfresco:

# Alfresco init script for Ubuntu
# 2 nov 2007 Joost Horward

export ALFRESCO_HOME=/opt/alfresco
export CATALINA_BASE=/opt/alfresco/tomcat
export CATALINA_HOME=/opt/alfresco/tomcat
export PIDFILE=/var/run/alfresco
export LOGFILE=/var/log/alfresco/alfresco.log

# Set any default JVM values
export JAVA_OPTS='-Xms128m -Xmx512m -server'


# setup port redirect using iptables
redirect() {
echo 'Redirecting port $1 to $2 ($3)'
iptables -t nat -A OUTPUT -d localhost -p $3 --dport $1 -j REDIRECT --to-ports $2
iptables -t nat -A PREROUTING -d $HOSTNAME -p $3 --dport $1 -j REDIRECT --to-ports $2
iptables -t nat -A OUTPUT -d $HOSTNAME -p $3 --dport $1 -j REDIRECT --to-ports $2

# setup_iptables
# setup iptables for redirection of CIFS and FTP
setup_iptables () {

echo '1' >/proc/sys/net/ipv4/ip_forward
# Clear NATing tables
iptables -t nat -F
# FTP NATing
redirect 21 2021 tcp

redirect 445 1445 tcp
redirect 139 1139 tcp
redirect 137 1137 udp
redirect 138 1138 udp

# start_openoffice
sudo -H -u alfresco xvfb-run /usr/lib/openoffice/program/soffice '-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager' -nologo -headless -nofirststartwizard &

case $1 in
if [ -f $PIDFILE ] ; then
  echo 'Alfresco is already running!'
  exit 1
touch $PIDFILE
echo 'Starting OpenOffice service ...'

echo 'Setting up iptables ...'

echo 'Starting Alfresco ...'
  echo  -e '\n\n\n\n\n\n\n\n\n\n`date` Starting Alfresco ...' >>$LOGFILE
  sudo chown alfresco:alfresco $LOGFILE

sudo -H -u alfresco sh $CATALINA_HOME/bin/
sudo -H -u alfresco sh $CATALINA_HOME/bin/
killall -w -u alfresco
        echo  -e '`date` Stopping Alfresco ...' >>$LOGFILE
sudo -H -u alfresco sh $CATALINA_HOME/bin/
killall -w -u alfresco
   echo  -e '\n\n\n\n\n\n\n\n\n`date` Restarting Alfresco ...' >>$LOGFILE
sudo -H -u alfresco sh $CATALINA_HOME/bin/
touch $PIDFILE
echo 'Zapping $PIDFILE ...'
echo 'Usage: alfresco [start|stop|restart|zap] [tail]'
exit 1


case $2 in
tail -f $LOGFILE

exit 0

Make sure that you set the script to be executable:

chmod +x /etc/init.d/alfresco

Run Alfresco

 /etc/init.d/alfresco start|stop|restart|zap [tail]

(Don't forget that you need be a root, or use

 sudo /etc/init.d/alfresco start|stop|restart|zap [tail]

command, e.g.

 sudo /etc/init.d/alfresco start

to start Alfresco).
The tail option just starts a new tail -f on the alfresco log.
Alfresco will populate the repository (Database and filesystem) on first start.

After starting alfresco, point your browser at to http://localhost:8080/alfresco.