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 machine running Ubuntu 10.04 LTS server, including installing and successfully establishing a connection with OpenOffice for document conversion and previews.


  • A machine running Ubuntu Server 10.04 LTS (64 bit) installed.

Installation of additional Alfresco components, such as solr, web quick start, web editor and sharepoint integration will not be covered in this walkthrough.

Prepping the system:

  1. Install MySQL server
    sudo apt-get install mysql-server

    During the installation, the installer will prompt you for the root password of the MySQL server.

  2. Login to MySQL, then setup the database and user account that Alfresco will use.

    create database alfresco;

    Next, generate a password for the alfresco user on the server.

    show create password('yourpassword');

    Make a note of the hash value that was generated. Finally, create the alfresco user account in MySQL and flush privileges for the changes to take effect.

    grant all privileges on `alfresco`.* to 'alfresco'@'localhost' identified by password '*YOURGENERATEDHASH';
    flush privileges;
  3. Install either the Sun(Oracle) or OpenJDK6 (1.8+) JVM. Alfresco will run fine on either of them, and performance will be similar, so choosing one over the other is a matter of personal preference.

    To install OpenJDK, if it isn’t already installed for some reason:

    sudo apt-get install openjdk6-jre

    Note that Alfresco 4.2+ only works on OpenJDK version 7 and up.

    If you prefer the Sun (now Oracle) JVM, run the following commands instead.

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
  4. Install OpenOffice and friends

    sudo apt-get install ooo-thumbnailer

    The full open office suite (minus the GUI, dictionaries and language packs) is required for document conversions to work properly.

  5. Install Swftools. Alfresco uses the pdf2swf binary contained therin to generate previews for PDF files in Share.
    sudo apt-get install python-software-properties
    sudo apt-add-repository ppa:guilhem-fr/swftools
    sudo apt-get update
    sudo apt-get install swftools
  6. Install JODConverter.

    sudo apt-get install jodconverter jodconverter-java
  7. Install ImageMagick.

    sudo apt-get install imagemagick
  8. Install Microsoft core fonts, as these may be used by some documents and are required for converted documents to retain formatting.
    sudo apt-get install ttf-mscorefonts-installer
  9. Download the latest version of Apache Tomcat:

  10. Download the Java MySQL drivers (Connector/J) from the MySQL website.

  11. Finally, download the latest version of Alfresco. Visit this page, then click on “Custom Installs & Optional Modules”. Download the “” file with wget.
  12. We will be installing Alfresco in /opt/webapps, but you could choose any directory of your liking, including a user’s home directory. Just make sure you update the path in the scripts below. It is also advisable to create a separate user account on the system with restricted privileges that will under which the tomcat process will be executed, and also possibly fronted by Apache. These configurations are beyond the scope of this discussion. It is however worth mentioning that this user must be granged ownership to the chosen installation folder.

Installing Alfresco

Setting up and testing Tomcat

Extract Tomcat from the downloaded zip file into the target installation folder. Rename this folder to Tomcat. Test that it works by itself by executing bin/ You should be able to access the default page by navigating to :8080 from a web browser in a computer on your network. If all is well, stop Tomcat by executing bin/

Now that we know Tomcat works fine by itself, we will have to tweak it a bit for it to play nice hosting Alfresco.

  1. Create the file tomcat/conf/Catalina/localhost/alfresco.xml with the following contents:
    <?xml version="1.0" encoding="UTF-8"?>
      <Environment override="false" type="java.lang.Boolean" name="properties/startup.enable" description="A flag that globally enables or disables startup of the major Alfresco subsystems." value="true"/>
      <Environment override="false" type="java.lang.String" name="properties/dir.root" description="The filesystem directory below which content and index data is stored. Should be on a shared disk if this is a clustered installation."/>
      <Environment override="false" type="java.lang.String" name="properties/hibernate.dialect" description="The fully qualified name of a org.hibernate.dialect.Dialect subclass that allows Hibernate to generate SQL optimized for a particular relational database. Choose from org.hibernate.dialect.DerbyDialect, org.hibernate.dialect.MySQLInnoDBDialect, org.alfresco.repo.domain.hibernate.dialect.AlfrescoOracle9Dialect, org.alfresco.repo.domain.hibernate.dialect.AlfrescoSybaseAnywhereDialect, org.alfresco.repo.domain.hibernate.dialect.AlfrescoSQLServerDialect, org.hibernate.dialect.PostgreSQLDialect"/>
      <Environment override="false" type="java.lang.String" name="properties/hibernate.query.substitutions" description="Mapping from tokens in Hibernate queries to SQL tokens. For PostgreSQL, set this to &quot;true TRUE, false FALSE&quot;."/>
      <Environment override="false" type="java.lang.Boolean" name="properties/hibernate.jdbc.use_get_generated_keys" description="Enable use of JDBC3 PreparedStatement.getGeneratedKeys() to retrieve natively generated keys after insert. Requires JDBC3+ driver. Set to false if your driver has problems with the Hibernate identifier generators. By default, tries to determine the driver capabilities using connection metadata."/>
      <Environment override="false" type="java.lang.String" name="properties/hibernate.default_schema" description="Qualify unqualified table names with the given schema/tablespace in generated SQL. It may be necessary to set this when the target database has more than one schema."/> 
  2. Edit in Tomcat’s conf folder and locate the line


    and change it to

Deploying Alfresco and Share on Tomcat
  1. Unzip the file that you downloaded previously into a folder in your home directory
  2. Copy the endorsed folder into the Tomcat directory.
  3. Copy the files in the lib folder into the lib folder in the tomcat directory.
  4. Copy the war files in the webapps directory to tomcat’s webapps directory.
  5. Copy the shared folder into the tomcat directory.
  6. Extract the MySQL Connector/J jar you downloaded earlier and copy it into Tomcat’s lib folder.
  7. Create a directory named data in the root install directory, which will be Alfresco’s main data directory. When writing backup scripts, make sure this directory is backed up above all else!
Alfresco Utility Scripts

We will use three scripts,, and to aid in starting and stopping the server. These files are not included in the custom install version of Alfresco that we downloaded, and will have to be created in root install directory. Once created, these files will have to be made executable. This can by done by the chmod command:

chmod +x

# Start or stop Alfresco server
# Set the following to where Tomcat is installed
cd "$ALF_HOME"
export JAVA_HOME="/usr/lib/jvm/java-7-oracle/"
# Set any default JVM values
export JAVA_OPTS='-server -Xms2G -Xmx3G -XX:MaxPermSize=2048M -XX:NewSize=1024m'
export JAVA_OPTS="${JAVA_OPTS} -Dalfresco.home=${ALF_HOME}"
export JAVA_OPTS="${JAVA_OPTS} -Djava.rmi.server.hostname=localhost"
export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"
if [ "$1" = "start" ]; then
elif [ "$1" = "stop" ]; then

You can tweak the VM options passed to better suit your environment. Note that if you installed OpenJDK, you will have to modify the JAVA_HOME variable as well (usually /usr/lib/jvm/java-7-openjdk).


bash /opt/webapps/alfresco/ start


bash /opt/webapps/alfresco/ stop

Configuring the Alfresco Installation

Finally, we edit, which is Alfresco’s primary configuration file, and includes database connection properties, indexer configuration, ftp and cifs configuration and the location of binaries of supporting libraries such as OpenOffice among others. The file is located under tomcat/shared/classes. A sample properties file is also provided for reference.

After a bit of tweaking, my looked like this. The file is self-explanatory with the included comments.

## Common Alfresco Properties #

# custom content and index data location

# we are not using solr yet, and will use lucene for the time being

# Sample database connection properties

# External locations

# Index Recovery Mode

# URL Generation Parameters (The ${localname} token is replaced by the local server name)

# Cifs settings to use non-privileged ports, as tomcat runs as non-root
# @see


# Move the default ftp server port to a port over 1024 to avoid having to run tomcat with elevated privileges.

That pretty much sums up all the configuration that is needed to get Alfresco up and running on an Ubuntu server. To start the server, simply execute and tail Tomcat’s logs to make sure everything starts up smoothly.

Init Scripts To Automatically Start / Stop Alfresco during Server Reboot Cycles

One final piece of configuration is to add some init scripts to the server, to make sure tomcat is properly started / stopped when the server power cycles. This is done by creating an init script (which I have named alfresco) in /etc/init.d, and then using the update-rd.d tool to update the run levels on the server. Note that the example file below also attempts to start / stop the server as a non-privileged user named alfresco

# description: Alfresco Community Startup Script
# adapted by JD


start () {
    sudo -u alfresco /opt/webapps/alfresco/ start "$2"

stop () {
    sudo -u alfresco /opt/webapps/alfresco/ stop "$2"
case "$1" in
        start "$@"
        stop "$@"
        stop "$@"
        start "$@"
        sudo -u alfresco /opt/webapps/alfresco/ "$@"
exit $RETVAL

Finally, run update-rc.d to update the run levels.

update-rc.d alfresco defaults

And thats all there is to manually installing Alfresco on a 64-bit Ubuntu server.

Leave a Reply

Your email address will not be published.

one × 5 =