Manually Installing Alfresco on Ubuntu Server

I had to install Alfresco recently on a 32 bit server. Since Alfresco does not provide a 32 bit installer any more, I had to put everything together manually, and thought I would document the process here in case I need to reference it in the future.

The steps outlined here assume you have a fresh install of Ubuntu 10.04 server, and should pertain to both the 32 and 64 bit versions. <INSTALL_DIR> will be /opt/alfresco.

Installing Java

sudo apt-get install openjdk-6-jre

Setting up MySQL

1. Install MySQL server. During installation, you will have to choose the password for the root user.

sudo apt-get install mysql-server
mysql -u root -p

2. Create a database named alfresco. Also create a user named alfresco and grant the user permissions to the alfresco database. You can replace the value for the password with your own value.

create database alfresco;
select password ('alfresco');
grant all privileges on `alfresco`.* to 'alfresco'@'localhost' identified by password '*F9F457310EF9364D42AABE6D8C24A21712C000B5';
exit

3. Download the Java connector for MySQL from here. Extract the jar file from the download. It is needed when configuring Alfresco.

Installing Alfresco

1. Create a directory named alfresco under /opt/.

2. Create a user named tomcat and assign <INSTALL_DIR> to this user.

sudo mkdir /opt/alfresco
sudo useradd tomcat -M -U -d /opt/alfresco
sudo chown -R tomcat:tomcat /opt/alfresco

3. Download the latest version of Alfresco manual installation package here (version 4.0.d at the time of writing, check if a newer version is available) and Tomcat 7 from here to <INSTALL_DIR> using wget.

4. Install unzip to extract the downloaded files. Unzip the alfresco files to a folder named temp and the tomcat binaries to a folder named tomcat. Move everything under temp/web-server/webapps to tomcat/webapps and move temp/web-server/shared to tomcat/. Also move the MySQL java connector which was downloaded earlier into tomcat’s lib folder. You may find the files under temp/bin useful for installing additional Alfresco modules. If you don’t need these, you can safely remove the temp directory.

sudo -s
apt-get install unzip
su tomcat
cd ~
mkdir temp
mv alfresco.zip temp/
cd temp
unzip alfresco.zip
cd ..
tar -xf apache-tomcat-7-0-23.tar
mv apache-tomcat-7-0-23 tomcat
mv temp/web-server/webapps/* tomcat/webapps
mv temp/web-server/shared tomcat/
mv temp/mysql-connector.jar tomcat/lib
rm -r temp

5. Create a folder named alf_data under <INSTALL_DIR>. This is the main data directory for Alfresco.

6. Install openoffice, pdf2swf and imagemagick

sudo apt-get install imagemagick swftools openoffice.org-common

7. Customize the alfresco-global.properties file found in tomcat/shared/classes. The file below configures Alfresco for the MySQL database, configures open office, imagemagick and swftools, disables ftp and email, and uses the default authentication chain.


###############################
## Common Alfresco Properties #
###############################

#
# Sample custom content and index data location
#
dir.root=/opt/www/alf_data

#
# Sample database connection properties
#
db.name=alfresco
db.username=alfresco
db.password=alfresco
db.host=localhost
db.port=3306

#
# External locations
#-------------
ooo.exe=/usr/bin/soffice
ooo.enabled=true 
img.root=/usr
swf.exe=/usr/bin/pdf2swf

#
# Property to control whether schema updates are performed automatically.
# Updates must be enabled during upgrades as, apart from the static upgrade scripts,
# there are also auto-generated update scripts that will need to be executed.  After
# upgrading to a new version, this can be disabled.
#
db.schema.update=true

#
# MySQL connection
#
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost/alfresco?useUnicode=yes&amp;characterEncoding=UTF-8

#
# Index Recovery Mode
#-------------
index.recovery.mode=FULL

#
# Alfresco Email Service and Email Server
#-------------

# Enable/Disable the inbound email service.  The service could be used by processes other than
# the Email Server (e.g. direct RMI access) so this flag is independent of the Email Service.
#-------------
email.inbound.enabled=false

# Email Server properties 
#-------------
email.server.enabled=false
#email.server.port=25
#email.server.domain=alfresco.com
#email.inbound.unknownUser=anonymous

#
# The default authentication chain
# To configure external authentication subsystems see:
# http://wiki.alfresco.com/wiki/Alfresco_Authentication_Subsystems
#-------------
authentication.chain=alfrescoNtlm1:alfrescoNtlm

#
# URL Generation Parameters (The ${localname} token is replaced by the local server name)
#-------------
alfresco.context=alfresco
alfresco.host=${localname}
alfresco.port=8080
alfresco.protocol=http
#
share.context=share
share.host=${localname}
share.port=8080
share.protocol=http

imap.server.enabled=false
#imap.server.port=143
#imap.server.host=localhost

# Default value of alfresco.rmi.services.host is 0.0.0.0 which means 'listen on all adapters'.
# This allows connections to JMX both remotely and locally.
#
alfresco.rmi.services.host=0.0.0.0

#
# RMI service ports for the individual services.
# These seven services are available remotely.
#
# Assign individual ports for each service for best performance 
# or run several services on the same port. You can even run everything on 50500 if needed.
#
# Select 0 to use a random unused port.
# 
avm.rmi.service.port=50501
avmsync.rmi.service.port=50502
attribute.rmi.service.port=50503
authentication.rmi.service.port=50504
repo.rmi.service.port=50505
action.rmi.service.port=50506
wcm-deployment-receiver.rmi.service.port=50507
monitor.rmi.service.port=50508

# FTP server
ftp.enabled=false

# CIFS
cifs.enabled=true
cifs.Server.Name=rocksolid
cifs.domain=WORKGROUP
cifs.hostanounce=true

cifs.broadcast=0.0.0.0
cifs.tcpipSMB.port=1445
cifs.ipv6.enabled=false
cifs.netBIOSSMB.namePort=1137
cifs.netBIOSSMB.datagramPort=1138
cifs.netBIOSSMB.sessionPort=1139

Configuring Tomcat

1. Edit tomcat/conf/catalina.properties and modify the value for shared.loader.

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar

2. Create a file named server.sh under /opt/alfresco and make the file executable. This file will be used to start and shutdown the server.

#!/bin/sh
# Start or stop Tomcat server

# Set the following to where Tomcat is installed
ALF_HOME=/opt/alfresco
cd "$ALF_HOME"
APPSERVER="${ALF_HOME}/tomcat"

# When using Sun's jvm, set JAVA_HOME to /usr/lib/jvm/java-6-sun
export JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
# Set any default JVM values
# This is the maximum I could go with a 32 bit CPU.
# You can set these numbers to much higher values on a 64 bit machine
export JAVA_OPTS='-server -Xms512m -Xmx1470m -XX:MaxPermSize=1G -XX:NewSize=256m'
export JAVA_OPTS="${JAVA_OPTS} -Dalfresco.home=${ALF_HOME} -Dcom.sun.management.jmxremote"
export JAVA_OPTS="${JAVA_OPTS} -Djava.rmi.server.hostname=localhost"
export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"

#
if [ "$1" = "start" ]; then
  "${APPSERVER}/bin/startup.sh"
elif [ "$1" = "stop" ]; then
  "${APPSERVER}/bin/shutdown.sh"
fi

chmod +x server.sh

3. Modify permissions to allow the tomcat user ownership of /opt/alfresco

chown -R tomcat:tomcat /opt/alfresco

4. Create an init script to start/stop tomcat when the server reboots. Create a file called alfresco.sh under /etc/init.d. Make this file executable and save it with the following contents.

#!/bin/sh
#
# chkconfig: 2345 80 30 
# description: Alfresco Community Startup Script
# adapted by JD
#

RETVAL=0

start () {
    sudo -u tomcat soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;"
    sudo -u tomcat /opt/www/server.sh start "$2"
    iptables -I INPUT -p tcp --dport 80 -j ACCEPT
    iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
    iptables -I INPUT -p tcp --dport 445 -j ACCEPT
    iptables -I INPUT -p tcp --dport 139 -j ACCEPT
    iptables -I INPUT -p udp --dport 137 -j ACCEPT
    iptables -I INPUT -p udp --dport 138 -j ACCEPT
    iptables -I INPUT -p tcp --dport 1445 -j ACCEPT
    iptables -I INPUT -p tcp --dport 1139 -j ACCEPT
    iptables -I INPUT -p udp --dport 1137 -j ACCEPT
    iptables -I INPUT -p udp --dport 1138 -j ACCEPT
    iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
    iptables -t nat -A PREROUTING -p tcp --dport 445 -j REDIRECT --to-ports 1445
    iptables -t nat -A PREROUTING -p tcp --dport 139 -j REDIRECT --to-ports 1139
    iptables -t nat -A PREROUTING -p udp --dport 137 -j REDIRECT --to-ports 1137
    iptables -t nat -A PREROUTING -p udp --dport 138 -j REDIRECT --to-ports 1138
    iptables-save
    RETVAL=$?
}

stop () {
    sudo -u tomcat /opt/alfresco/server.sh stop &quot;$2&quot;
    RETVAL=$?
}
case &quot;$1&quot; in
    start)
        start &quot;$@&quot;
        ;;
    stop)
        stop &quot;$@&quot;
        ;;
    restart)
        stop &quot;$@&quot;
        start &quot;$@&quot;
        ;;
    *)
        sudo -u tomcat /opt/alfresco/server.sh &quot;$@&quot;
        RETVAL=$?
esac
exit $RETVAL

5. Finally su as tomcat and start the server

su tomcat
cd ~
./server.sh start

6. You may also want to setup so iptable rules to allow access on port 80.

sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables-save

 

You might also like
I had to learn the hard way today about the nasty issue surrounding Java's TreeSet / TreeMap implementations. The problem is that the removeAll method doesn't always do what it ...
READ MORE
Tapestry 5 DateField as 3 Select Dropdowns
Tapestry 5 has an excellent javascript-based date picker component called DateField, which greatly simplifies the task of entering a properly formatted date for the user. The component gets the job ...
READ MORE
Nexus 7
I have had the pleasure of using a Nexus 7 for the past few days, and while it is a fantastic tablet all around, there is one minor roadblock I ...
READ MORE
I recently had to evaluate CXF to expose existing services in a Spring project. I thought I would jot down my thoughts and conclusions from my experiments with the technology, ...
READ MORE
Getting your iPhone to play nice with Ubuntu
It has been well over a year since I last used an 'i device', but had an opportunity to do so today after buying a cheap iPhone with a broken ...
READ MORE
Block entire countries on Ubuntu server with Xtables and GeoIP
Anyone who has administered even a moderately high traffic server will have noticed that certain unwelcome traffic such as port scans and probes tend to come from IP addresses belonging ...
READ MORE
Modifying a JasperReports chart at run time
To modify a report at run time, it is imperative to understand the overall process of how a jrxml ends up in its final form as an image / pdf ...
READ MORE
Not too long ago I had to interface with Zimbra's admin API for one of my projects, and quickly realized that it is er.. a little weird. You see, Zimbra ...
READ MORE
Alfresco on Ubuntu – Complete Installation Guide
In an earlier post, I had outlined the process of installing Alfresco on a 32-bit Ubuntu server. This walkthrough documents the steps required to get Alfresco going on a 64-bit ...
READ MORE
Bitten by the Java TreeMap removeAll bug
Tapestry 5 DateField as 3 Select Dropdowns
Connecting the Google Nexus 7 to Ubuntu /
JAX-WS Web Services with Spring and Apache CXF
Getting your iPhone to play nice with Ubuntu
Block entire countries on Ubuntu server with Xtables
Modifying a JasperReports chart at run time
A Java compliant WSDL file for Zimbra Admin’s
Alfresco on Ubuntu – Complete Installation Guide

Leave a Reply

Your email address will not be published. Required fields are marked *


+ eight = 10

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>