Install Alfresco on Ubuntu 14.04

Install alfresco on Ubuntu 14.04

I am going to write a post about how to install Alfresco on Ubuntu 14.04, I used a blog by so a lot of my information comes from this and I am by no means an Alfresco expert.

I went through the pain of the installation which was worth it.

I am going to try and aim this post at beginners like myself – some of the lower level points in fcorti’s  blog were not explained in huge detail for beginners so I am going to give it down to command level, and some of the software repositories were not available.

Full credit to as that was the only concise explanation I could find on the web how to do this install – for reference the blog is at

You can reference fcorti’s blog for a more detailed explanation my post is just going to be commands and steps.

This guide is based on Alfresco 5.0 a but I have read other posts explaining that it works also for 5.0 d – I will write another post once I upgrade.

To contribute to the community I am going to give the process I went through.

Lets Begin!

Prepare your OS for the install

sudo apt-get update
sudo apt-get upgrade
sudo apt-get purge openjdk-*

Create the alfresco user

adduser alfresco
Enter new UNIX password: ****** (password of your choice)
adduser alfresco sudo

Get the java package to any location

sudo wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie"

Copy the java package to the correct location and extract

copy to /opt/java
sudo chmod a+x jdk-7u67-linux-x64.tar.gz
sudo gunzip jdk-7u67-linux-x64.tar.gz
sudo tar -xvf jdk-7u67-linux-x64.tar.gz

Using the editor of your choice add the below lines to your home .profile and /etc/profile.d/

export JAVA_HOME=/opt/java/jdk1.7.0_67
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

Install ffmpeg

sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install ffmpeg

Install swftools

sudo apt-get install libjpeg62 libgif4 libart-2.0-2
chmod a+x swftools_0.9.0-0ubuntu2_amd64.deb
sudo dpkg -i swftools_0.9.0-0ubuntu2_amd64.deb

Download postgres and create the user

sudo apt-get install postgresql postgresql-contrib
sudo passwd postgres
password ******

Create the Afresco database

sudo -u postgres psql postgres
sudo -u alfresco psql alfresco
ALTER USER alfresco WITH PASSWORD 'alfresco';

Create the alfresco home directory and modify permissions

sudo mkdir -p /opt/alfresco
sudo chown alfresco:alfresco /opt/alfresco

Get the tomcat package, un-compress, extract and rename it

cd /opt/alfresco
gunzip apache-tomcat-7.0.55.tar.gz
tar -xvf apache-tomcat-7.0.55.tar
mv apache-tomcat-7.0.55 tomcat

Change ownership of tomcat, start it, check the java process, check the URL and shutdown if all is OK

sudo chown -R alfresco:alfresco /opt/alfresco/tomcat
ps -ef | grep java
https://{your URL local or cloud}:8080/ (to check tomcat is available)

Now for the Alfresco Install

Backup the tomcat properties file and edit the shared.loader line

cp /opt/alfresco/tomcat/conf/ /opt/alfresco/tomcat/conf/
vi /opt/alfresco/tomcat/conf/ (or any editor you like - I like vi :))

ensure this line is present

Backup the tomcat server file and edit

cp /opt/alfresco/tomcat/conf/server.xml /opt/alfresco/tomcat/conf/server.xml.orig
vi /opt/alfresco/tomcat/conf/server.xml (or any other editor)

Ensure the below connector section is the same as this

    <Connector port="8080" protocol="HTTP/1.1"
                URIEncoding="UTF-8" />

Modify the context.xml

vi /opt/alfresco/tomcat/conf/context.xml
Add the line below before </Context>

<Valve className="org.apache.catalina.authenticator.SSLAuthenticator" securePagesWithPragma="false" />

Create the Alfresco directory structure

mkdir -p /opt/alfresco/tomcat/shared
mkdir -p /opt/alfresco/tomcat/shared/classes
mkdir -p /opt/alfresco/tomcat/shared/lib
mkdir -p /opt/alfresco/tomcat/endorsed
mkdir -p /opt/alfresco/alf_data/keystore
mkdir -p /opt/alfresco/tmp

Download and unzip the Alfresco software

cd /opt/alfresco/tmp

Copy the required extracted files into the relevant software locations

cd alfresco-community-5.0.a
cp -R bin /opt/alfresco
cp -R web-server/endorsed/* /opt/alfresco/tomcat/endorsed
cp -R web-server/shared/* /opt/alfresco/tomcat/shared
cp -R web-server/lib/* /opt/alfresco/tomcat/lib
cp -R web-server/webapps/* /opt/alfresco/tomcat/webapps/

Create a start open office file to be used by the daemon

vi /opt/alfresco/
#!/bin/sh -e

"${SOFFICE_ROOT}/soffice" "--accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" --nologo --headless &
chmod uga+x /opt/alfresco/
ps -ef | grep soffice
killall soffice.bin
vi /opt/alfresco/
#!/bin/sh -e

# Start or stop Alfresco server

# Set the following to where Tomcat is installed
cd "$ALF_HOME"

# Set any default JVM values
export JAVA_OPTS='-Xms512m -Xmx768m -Xss768k -XX:MaxPermSize=256m -XX:NewSize=256m -server'
export JAVA_OPTS="${JAVA_OPTS} -Dalfresco.home=${ALF_HOME}"

if [ "$1" = "start" ]; then
 if [ -r ./ ]; then
elif [ "$1" = "stop" ]; then
 killall -u alfresco java
 killall -u alfresco soffice.bin

Change the permissions of the Alfresco startup script

chmod uga+x /opt/alfresco/

Create an alfresco deamon startup script and modify the permissions and owner

sudo vi /etc/init.d/alfresco
#!/bin/sh -e


if [ "$1" = "start" ]; then
 su - alfresco "${ALFRESCO_SCRIPT}" "start"
elif [ "$1" = "stop" ]; then
 su - alfresco "${ALFRESCO_SCRIPT}" "stop"
elif [ "$1" = "restart" ]; then
 su - alfresco "${ALFRESCO_SCRIPT}" "stop"
 su - alfresco "${ALFRESCO_SCRIPT}" "start"
 echo "Usage: /etc/init.d/alfresco [start|stop|restart]"

sudo chmod uga+x /etc/init.d/alfresco
sudo chown alfresco:alfresco /etc/init.d/alfresco

Create the alfresco data area

mkdir /opt/alfresco/alf_data

Backup the alfresco properties files and edit ensuring all the parameters are as below

cp /opt/alfresco/tomcat/shared/classes/ /opt/alfresco/tomcat/shared/classes/
vi /opt/alfresco/tomcat/shared/classes/
# OpenOffice
# ImageMagick installation
# SWFTools exe

Start the alfresco service and then tail the log and look closely for any errors

service alfresco start
tailf /opt/alfresco/tomcat/logs/catalina.out

If everything is successful then stop the service, modify the parameter that tells alfresco to create the DB and restart

service alfresco stop
vi /opt/alfresco/tomcat/shared/classes/
service alfresco start

Not included in some of the blogs that I have read are gotchas below


When I was installing when I tried to start alfresco after the install, during the Tomcat startup it hung at the deployment at some of the apps – there are many blogs and posts about deleting the unused Tomcat apps – I didn’t delete them I just moved them to a new ‘old’ folder

cd /opt/alfresco/tomcat/webapps
mkdir old
mv ROOT share share.war old

My cloud server started creaking at the heels once I started Tomcat up and started giving me all kinds of memory issues so another good one to limit the memory your Tomcat installation will use is to modify the JAVA_OPTS parameter in the Tomcat conf file.  Also you can adjust the memory settings as per your resources.

vi /opt/alfresco/tomcat/bin/

(Add this line as the first line in the file)

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms512m -Xmx1024m
-XX:NewSize=512m -XX:MaxNewSize=512m -XX:PermSize=512m 
-XX:MaxPermSize=512m -XX:+DisableExplicitGC"

I know a lot of the information here is the same as the original blog I references, and I am not in the plagiarism business 🙂 but hopefully I added a few other points.  I will try and answer any questions I can around the installation in reference to my working installation.

Hope this helps, please share or comment if you found it useful!


IT consultant with 20+ years experience specialising in Oracle Database, Oracle Business Intelligence, Web/Mobile development, Application Express development, cloud technology and more

Leave a Reply

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