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 http://shoved.it.here/jdk-7u5-linux-x64.tar.gz
$ 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 http://your.server.here:8080/ 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 alfresco.zip -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/alfresco-global.properties.sample /var/lib/tomcat7/shared/classes/alfresco-global.properties
$ 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';
ALTER ROLE
postgres=# grant all privileges on database alfresco to alfresco;
GRANT
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/catalina.properties
    • 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/catalina.properties
    • 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 -Dcom.sun.management.jmxremote"
    • JAVA_OPTS="${JAVA_OPTS} -XX:+CMSIncrementalMode"
  • /var/lib/tomcat7/shared/classes/alfresco-global.properties
    • 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 http://your.server.here:8080/alfresco or http://your.server.here:8080/share 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 catalina.properties
    shared.loader=${catalina.home}/shared/classes,${catalina.home}/shared/*.jar,/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/lib/*.jar
    shared.loader=/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/*.jar
    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 -Dcom.sun.management.jmxremote”
    JAVA_OPTS=”${JAVA_OPTS} -XX:+CMSIncrementalMode”

    here is my alfresco-global.properties

    db.name=alfresco
    db.username=alfresco
    db.password=alfresco
    db.host=localhost
    db.port=5432
    db.driver=org.postgresql.Driver
    db.url=jdbc:postgresql://${db.host}:${db.port}/${db.name}

    dir.root=/opt/alfresco
    dir.keystore=${dir.root}/keystore

    db.driver=org.postgresql.Driver
    db.url=jdbc:postgresql://localhost:5432/alfresco

    here is my pg_hba.conf
    host all all 127.0.0.1/32 password
    host all all 192.168.1.0/24 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)
    /var/lib/tomcat7/conf/catalina.properties
    /var/lib/tomcat7/shared/classes/alfresco-global.properties
    /etc/postgresql/9.1/main/pg_hba.conf

    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?

    Regards

  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: http://pastebin.com/NxWG3D26

    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.
    See: http://blog.xrmplatform.org/solution-for-add-apt-repository-command-not-found-ubuntu-12-10-server/

  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/catalina.properties twice. The second file for JAVA path and options should be /etc/default/tomcat7

  20. Hello,

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

    Bye

  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 comment