Installing Alfresco Community 4 On Ubuntu Server 12

In this article, I’m going to show you how I installed Alfresco Community 4 on a plain Ubuntu 12.04 server. We’ll be installing this entirely from the command line, without the assistance (complication?) of a GUI. I’m assuming you have a server ready, else get an Ubuntu server using this page.

Second, install Java. Now, this part is a little difficult, since Oracle doesn’t have a means of easily downloading the necessary tar file without jumping through GUI hoops. The way I did it was to use a GUI-based workstation to surf over to the download page, select the JDK download page, give away various legal rights, download it, then put it somewhere where I could wget it onto the above, pristine Ubuntu server. Once you have your grubby paws on it, uncompress it and move the resultant folder into /usr/lib/jvm. Now, if you installed from a virginal, minimal Ubuntu server, as we got from the previous guide, you don’t need to do much else. Other tutorials may have you purging OpenJDK before you take the steps below, or set environmental variables afterwards. This should not be necessary.

$ wget
$ tar -xvzf jdk-7u5-linux-x64.tar.gz
$ sudo mkdir /usr/lib/jvm
$ sudo mv jdk1.7.0_05 /usr/lib/jvm/jdk1.7.0
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0/bin/javac 1
update-alternatives: using /usr/lib/jvm/jdk1.7.0/bin/javac to provide /usr/bin/javac (javac) in auto mode.
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
update-alternatives: using /usr/lib/jvm/jdk1.7.0/bin/java to provide /usr/bin/java (java) in auto mode.
$ java -version
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

If installation went as planned, you should see the last message when running the JVM to get its version. Next up is some accessory software. First, for our database, we will use the excellent PostgreSQL database. We will also install ImageMagick (for image manipulation), FFMPEG (for transforming video), LibreOffice (for the embedded document engine) and SWFTools (for the pdf2swf utility and previewing PDF files). Installing the last two are a bit tricky, as we have to setup a couple of PPAs to get this to work, which itself requires installing the ability to add PPAs (thus requiring python-software-properties)!

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:guilhem-fr/swftools
$ sudo add-apt-repository ppa:libreoffice/ppa
$ sudo apt-get update
$ sudo apt-get install postgresql imagemagick ffmpeg swftools libreoffice

Alfresco is a Java-based web application, and needs a Java webserver to run it. The standard is Tomcat. So let’s install and configure that. While you are at it, install the Apache Native Libraries for a little oomph.

$ sudo apt-get install tomcat7
$ sudo service tomcat7 stop
$ sudo apt-get install libtcnative-1
$ sudo service tomcat7 start
 * Starting Tomcat servlet engine tomcat7                    [ OK ]

You can test your Tomcat server by pointing a browser to and you should see the standard Tomcat “It Works!” greeting page.

We are finally ready to install Alfresco. Download the zip file on your budding server, unzip it into a directory (we creatively called ours “alfresco”), and do the following:

$ unzip -d alfresco
$ sudo cp -r ~/alfresco/web-server/shared /var/lib/tomcat7
$ sudo cp -r ~/alfresco/web-server/webapps /var/lib/tomcat7
$ sudo cp -r ~/alfresco/web-server/lib /var/lib/tomcat7/shared/lib
$ sudo cp -r ~/alfresco/bin /var/lib/tomcat7/bin
$ sudo cp -r ~/alfresco/licenses /var/lib/tomcat7/licenses
$ sudo cp -r ~/alfresco/README.txt /var/lib/tomcat7/README.txt
$ sudo mv /var/lib/tomcat7/shared/classes/ /var/lib/tomcat7/shared/classes/
$ sudo mv /var/lib/tomcat7/shared/classes/alfresco/web-extension/share-config-custom.xml.sample /var/lib/tomcat7/shared/classes/alfresco/web-extension/share-config-custom.xml

Now, we create a PostgreSQL database for Alfresco to use. If the last line executes without error, you’re doing fine.

$ sudo mkdir /opt/alfresco
$ sudo chown -R tomcat7:tomcat7 /var/lib/tomcat7 /opt/alfresco
$ sudo -u postgres createuser
Enter name of role to add: alfresco
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
$ sudo -u postgres createdb alfresco
$ sudo -u postgres psql
psql (9.1.4)
Type "help" for help.
postgres=# alter user alfresco with encrypted password '!QAZ1qaz';
postgres=# grant all privileges on database alfresco to alfresco;
postgres=# \q
$ psql -h localhost alfresco alfresco

You’ll have to now get dirty and delve into various settings and configurations. Here’s the list:

  • /var/lib/tomcat7/conf/
    • shared.loader=${catalina.home}/shared/classes,${catalina.home}/shared/*.jar,/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/lib/*.jar
  • /var/lib/tomcat7/conf/
    • JAVA_HOME=/usr/lib/jvm/jdk1.7.0
    • JAVA_OPTS="-Djava.awt.headless=true -Xmx768m -XX:+UseConcMarkSweepGC"
    • JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=512m -Xms128m -Dalfresco.home=/opt/alfresco"
    • JAVA_OPTS="${JAVA_OPTS} -XX:+CMSIncrementalMode"
  • /var/lib/tomcat7/shared/classes/
    • Change all settings to match your setup.
  • /etc/postgresql/9.1/main/pg_hba.conf
    • If you want to allow different access. Check online for more help.

Now, from any browser, you can log in via or and begin managing your content in an enterprisey way.

23 responses to “Installing Alfresco Community 4 On Ubuntu Server 12

  1. Nice write up. Helped me out a lot.

    Also, there is a minor typo 🙂 on the code
    sudo apt-get postgresql imagemagick ffmpeg swftools libreoffice

    Suppose to read
    sudo apt-get install postgresql imagemagick ffmpeg swftools libreoffice

    No biggy. 🙂

  2. I corrected the article. Thanks for helping out.

  3. Hi, i can not get it to work… i tried about 10 times… please help. I m running on a clean server, first on VMW then on a real machine, first on i586, then on amd64, ubuntu 12.04.

    I get the /share/ login page but it doesn’t recognize admin/admin
    the /alfresco/ give me error 404
    description The requested resource (/alfresco/) is not available.

    here is my
    JAVA_OPTS=”-Djava.awt.headless=true -Xmx768m -XX:+UseConcMarkSweepGC”
    JAVA_OPTS=”${JAVA_OPTS} -XX:MaxPermSize=512m -Xms128m -Dalfresco.home=/opt/alfresco”
    JAVA_OPTS=”${JAVA_OPTS} -XX:+CMSIncrementalMode”

    here is my



    here is my pg_hba.conf
    host all all password
    host all all trust

  4. What does your catalina.out file say? Also, what does alfresco.log say?

  5. Hi and thanks for your quick answer,
    here is /var/log/tomcat7/catalina.out

    (log output removed by blog owner)

  6. hi it looks like its been truncated, so let me post only the last part of the alfresco.log

    (log output removed by blog owner)

  7. And the last part of the catalina.out, it looks like your nice slim post just put on some weight 🙂

  8. Hi,

    Could you post your (masking your confidential stuff of course)

    thanks a lot

  9. I’d rather not. (And, I edited your posts for brevity.) So, this is a little late and you may have solved it by now, but I was too busy too help promptly. Looking at your file, I see lots of “Cannot load JDBC driver class ‘org.postgresql.Driver’” errors. Did you install this? Did you edit settings appropriately for the postgresql driver?

  10. Hello,

    thanks for this nice howto.

    but I cannot acces localhost:8080/alfresco. And on localhost:8080/share my login is not accepted. Nor alfresco/alfresco or admin/admin. What did I wrong?

  11. Hi Paul
    I’m just trying out your instructions to install Alfresco on Ubuntu and I have a quick question. When setting the user in Postgress you entered an encrypted password… The last line in the DB setup :
    $ psql -h localhost alfresco alfresco
    This asks for this password…. What is it?


  12. Ignore my last post. I shouldn’t post affter a long day 🙂

  13. @MPW: I suggest you step through it again. Also, as a first step, make sure to check your logs, such as catalina.out and alfresco.log. I had issues similar to yours because I had played too much with the keystore. Errors in the log gave it away. A little googling then made me understand how to go about fixing it.

  14. Hi everyone!

    I’m havin’ troubles with alfresco in general, first I installed via installer wizard after, in a fresh install I followed this great post, but I think my problem is more specific, with the wizard and this method I’m getting this error:

    I been playing with java memory settings without any success, can anyone help me?

  15. I’m having the same problem as MPW and laurent. As best I can tell from my error logs from previous installations, it is a Java issue – and I’ve just noted that after installing libreoffice from the repository, the java -version is now the openjdk version installed with libreoffice. Is that a problem?

  16. @Quique: I’m afraid I cen’t tell anything from the log you posted. Maybe the Alfresco dev forums can help?

    @Tim: Can you verify that the links setup with update-alternatives still point to the JVM installed?

  17. In Ubuntu 12.10 I found that I also had to do:
    apt-get install software-properties-common before add-apt-repository was available.

  18. Use this guide alot, It would be nice to have the port change stuff from Zac’s post included. Also sudo apt-get install python-software-properties
    no londer enables apt-add-repository in Ubuntu 12-10, you now need to use:
    sudo apt-get install software-properties-common

  19. Very good documentation.
    But at the end in part “settings and configurations” you list /var/lib/tomcat7/conf/ twice. The second file for JAVA path and options should be /etc/default/tomcat7

  20. Hello,

    in my case the with JAVA_HOME and JAVA_OPTS are completly ignored. I had to set them in /etc/default/tomcat7. Then it runs!


  21. Why not install java from the repositories?
    sudo apt-get install python-software-properties #to get your add-apt-repository in Ubuntu 12+
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer

  22. Oh yeah, and why adding a ppa for libreoffice when it’s already in the repos?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s