Install Alfresco Community 4.2 on Ubuntu 12.04 (Fixed)

Posted on Thursday, January 31, 2013



This document shows how to install Alfresco 4.2 on an Ubuntu 12.10 system.  (This is an update to my prior document that had a few issues that prevented some parts of alfresco from working correctly...  Mainly renditions and thumbnails)

I am creating a virtual server for this that has 3.75 GiB of Memory



Installing Java 7


Here are the commands to install Java 7 from Ubuntu 12.04 server.


>  sudo apt-get purge openjdk*
>  sudo apt-get install python-software-properties
>  sudo add-apt-repository ppa:webupd8team/java
>  sudo apt-get update
>  sudo apt-get install oracle-java7-installer
>  java -version


.




Install Tomcat 7



·         Download tomcat 7 to the local directory  (this address could change see http://tomcat.apache.org/download-70.cgi [2])


>  wget http://apache.osuosl.org/tomcat/tomcat-7/v7.0.35/bin/apache-tomcat-7.0.35.tar.gz

Extract the file


>  tar xvzf apache-tomcat-7.0.35.tar.gz


Move the tomcat over


>  sudo mv apache-tomcat-7.0.35 /opt/tomcat



Now set up the tomcat users.


>  sudo vi /opt/tomcat/conf/tomcat-users.xml



Add the following lines within the <tomcat-users> element  (of course change the password to your own password)


  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <user name="admin"   password="password"
                              roles="admin-gui, manager-gui,
                              manager-script, admin-script" />




Fix the connector,


 >  sudo vi +70 /opt/tomcat/conf/server.xml


And add this to the connector
URIEncoding="UTF-8"





Set up start up script


>  sudo vi /etc/init.d/tomcat


Then place the following in it.  (adjust the jvm to the directory you have it in)


# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid


export JAVA_HOME=/usr/lib/jvm/java-7-oracle

case $1 in
start)
sh /opt/tomcat/bin/startup.sh
;;
stop)
sh /opt/tomcat/bin/shutdown.sh
;;
restart)
sh /opt/tomcat/bin/shutdown.sh
sh /opt/tomcat/bin/startup.sh
;;
esac
exit 0


Make it executable


>  sudo chmod 755 /etc/init.d/tomcat



Add it to autostart


>  sudo update-rc.d tomcat defaults


Reboot to test auto start of tomcat


>  sudo reboot now



Now open up a web browser  (of course use your IP address, domain name)

http://192.168.0.231:8080


You Should see…




Change memory settings for tomcat



>  sudo vi /opt/tomcat/bin/catalina.sh


Add the following line

This gives it 2GiB to use, you may need to change it to your system


JAVA_OPTS="-XX:MaxPermSize=160m -XX:NewSize=256m -Xms512m "
JAVA_OPTS="$JAVA_OPTS -Xmx2048m -Xss512K  "




Restart tomcat


> sudo /etc/init.d/tomcat restart



Open up http://192.168.0.231:8080/manager/status to check the memory settings




Here you can see here that it does have 2GiB of max memory (roughly)





Install/Setup MySQL


Install mysql on this server


>  sudo apt-get install mysql-server


For the root password set it to “mysqlpassword”



Log into mysql


>  mysql -u root -p -h localhost


Run this command in mysql to create alfresco user and to give it alfresco access


>  CREATE USER 'alfresco'@'localhost' IDENTIFIED BY 'passalfresco';
>  CREATE USER 'alfresco'@'%' IDENTIFIED BY 'passalfresco';
>  grant all on alfresco.* to 'alfresco'@'%' identified by 'passalfresco' with grant option;
create database alfresco default character set utf8 collate utf8_bin;
>  exit



Restart mysql


>  sudo /etc/init.d/mysql restart





Create Alfresco Folder

Make a alfresco folder


>  sudo mkdir /alfresco




Download Install Alfresco


Some of the notes I used for this are at

Download the installer (this address will change over time) but you can probably be safe going to http://wiki.alfresco.com/wiki/Download_and_Install_Alfresco [4]


>  cd
>  mkdir alfresco
>  cd alfresco
>  wget http://dl.alfresco.com/release/community/build-04576/alfresco-community-4.2.c.zip


If you do not have unzip install it.


>  sudo apt-get install unzip


unzip file


>  unzip alfresco-community-4.2.c.zip





Install alfresco.war and share.war on tomcat
Open up the tomcat web page


Then enter
Context Path
/alfresco
War Directory
/home/username/alfresco/web-server/webapps/alfresco.war




Click Deploy
It will deploy but fail to start (which is fine)






Now do the same for share.war
Then enter
Context Path
/share
War Directory
/home/username/alfresco/web-server/webapps/share.war



Click Deploy




Download and install mysql connector, it can be found at http://dev.mysql.com/downloads/connector/j/ [5]


>  cd
>  wget http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.22.zip
>  unzip mysql-connector-java-5.1.22.zip
>  cd mysql-connector-java-5.1.22/
>  cp mysql-connector-java-5.1.22-bin.jar /opt/tomcat/lib/



Set up the shared directory



>  cd
>  cd alfresco/web-server
>  sudo cp -r shared /opt/tomcat/







Set Global Properties


Alfresco requires some additional installs to work.  Alfresco out of the box uses a few other tools like OpenOffice and ImageMagick.


First update your repository information


>  sudo apt-add-repository ppa:guilhem-fr/swftools
>  sudo add-apt-repository ppa:upubuntu-com/office
>  sudo apt-get update



Install these via apt-get


>  sudo apt-get install imagemagick swftools libjodconverter-java ffmpeg ttf-mscorefonts-installer





Copy these sample files to .xml files (it will allow the creation of thumbnails for videos)


>  cd /opt/tomcat/shared/classes/alfresco/extension/
>  sudo cp video-thumbnail-context.xml.sample video-thumbnail-context.xml
>  sudo cp video-transformation-context.xml.sample video-transformation-context.xml



Edit the /opt/tomcat/conf/catalina.properties file


> sudo vi +74 /opt/tomcat/conf/catalina.properties


Updated shared.loader to the following


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





In the /opt/tomcat/shared/classes directory there is an alfresco-global.properties.sample folder.  Rename it


>  cd /opt/tomcat/shared/classes
>   sudo cp alfresco-global.properties.sample alfresco-global.properties




Now edit this file


>  sudo vi alfresco-global.properties


Here is the file I made,  Make sure to edit the mail.* portion to an email account you have.  (new in ubuntu 12.04 open office is now libreoffice)



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

#
# Sample custom content and index data location
#
dir.root=/alfresco/alf_data
#dir.keystore=${dir.root}/keystore

#
# Sample database connection properties
#
db.username=alfresco
db.password=passalfresco

#Disabled the guest login
alfresco.authentication.allowGuestLogin=false 

#
# External locations
#-------------
ooo.exe=/usr/bin/libreoffice
ooo.enabled=true
ooo.port=8100
jodconverter.officeHome=/usr/lib/libreoffice/program/soffice
jodconverter.portNumbers=8100
jodconverter.enabled=true
img.root=/usr
img.dyn=${img.root}/lib
img.exe=${img.root}/bin/convert
swf.exe=/usr/bin/pdf2swf
ffmpeg.exe=/usr/bin/ffmpeg

#
# 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.name=alfresco
db.url=jdbc:mysql://localhost/alfresco?useUnicode=yes&characterEncoding=UTF-8


#
# Oracle connection
#
#db.driver=oracle.jdbc.OracleDriver
#db.url=jdbc:oracle:thin:@localhost:1521:alfresco

#
# PostgreSQL connection (requires postgresql-8.2-504.jdbc3.jar or equivalent)
#
#db.driver=org.postgresql.Driver
#db.url=jdbc:postgresql://localhost:5432/alfresco

#
# DB2 connection
#
#db.driver=com.ibm.db2.jcc.DB2Driver
#db.url=jdbc:db2://localhost:50000/alfresco:retrieveMessagesFromServerOnGetMessage=true;
#
# Index Recovery Mode
#-------------
#index.recovery.mode=AUTO

#
# Outbound Email Configuration
#-------------
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=yourname@example.com
mail.password=yourpassword
mail.smtp.timeout=30000
# New Properties
mail.smtps.starttls.enable=true
mail.smtps.auth=true

#
# 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=true

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

# A comma separated list of email REGEX patterns of allowed senders.
# If there are any values in the list then all sender email addresses
# must match. For example:
#   .*\@alfresco\.com, .*\@alfresco\.org
# Allow anyone:
#-------------
#email.server.allowed.senders=.*

#
# 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=true
#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



Reboot the server


>  sudo reboot now


It may take a while for alfresco to come up and set up the database the first time.  What I do is log back into the system them tail the tomcat log to see if alfresco is starting correctly, and for when it is done  (in my case it took 2 ½ minutes)


>  sudo tail -f /opt/tomcat/logs/catalina.out




See the server startup message.



Logged in as admin and added new users


Open up



The default login is

User               = admin
Password     = admin





I always first change the admin password from the default just to make sure. To do this…

Click on User Profile







Click on Change password










Enter new password and click Finish














Click on  Manage System Users




Click Create New User







In my case I created a user called patman



Click next




Enter a password and Click Finish








Now add the user to the admin group.


Click on Administration Console





Click on manage User Groups




Click on Show all then click add user in the Alfresco_Adminstrators





Search for user, select user then click add.




Finally click on OK

Now this user is an admin.



Log out and log back in as the user you just made and gave admin rights to.







Make sure this user can log into the Share site as well. 
Open up






There you have it.   An installed 4.2 Alfresco/Share site on Ubuntu 12.04.






References
[1]  Installing Tomcat 7 on Ubuntu 9.10
       Visited 1/2013
[2]  Tomcat download page
       Visited 1/2013
[3]  Download and install Alfresco in Linux
       Visited 1/2013
[4]  Download and Install Alfresco
       Visited 1/2013
[5]  Download Connector/J
       Visited 1/2013
[6]  How To Install Alfresco Community 3.3 On Ubuntu Server 10.04 (Lucid Lynx)
       Visited 1/2013

32 comments:

  1. went flawlessly! Thanks for this awesome tut

    ReplyDelete
  2. is the sharepoint module present in that installation?

    ReplyDelete
    Replies
    1. This guide does not cover sharepoint. I have not had an opportunity to use alfresco with sharepoint, maybe someday I will.

      Delete
  3. Thank you for this detailed and flawless tutorial! I have saved a lot of time and headaches.
    1000 Thank's

    ReplyDelete
    Replies
    1. Not a problem glad I could help. I recently have been stuck doing alot of .Net programming but I plan to get back to some Alfresco stuff this summer and start writing up some more guides then. I hope to get a guide up on integrating Alfresco with Google Docs before summer gets into full swing

      Delete
  4. Thank you for the tutorial. For some reason when I go to deploy the war files I get "FAIL - Failed to deploy application at context path /alfresco" instead of the fail that is expected. I cut and copied the 2 lines of code, BUT I changed username to my username on the system. Is there something I am missing?

    ReplyDelete
    Replies
    1. Sorry for the late reply. It's been a busy week.

      My first guess is maybe the war file is not located where you think it is. Make sure the path you entered in for the war file is the exact location on the system. My other guess may be permissions, though I do not think that would be a problem.

      If you can't get it to work you can always look at the log files at /opt/tomcat/logs/catalina.out to see what the exact errors are occuring.

      Delete
  5. Patrick, i see on the top of the post (which looks great btw) you mentioned you were thinking about creating a virtual appliance or vm, i was wondering if you ever did create that vm so i could possibly download? Just thought i would check since i am feeling lazy at the moment.

    Cheers
    Jared

    ReplyDelete
    Replies
    1. I would make a generic one to give away but VMs can get kind of big and I do not have a good place to put it where I could afford the bandwidth :) I imagined it would a few GBytes in size and that is a little prohibitive. But maybe I will change my mind. I will put it on my backburner list as a possible in the future.

      Delete
  6. I'm getting a 404 when I try to open http://(local_ip):8080/alfresco. I've changed the alfresco-global.properties, rebooted the server, and run sudo tail -f /opt/tomcat/logs/catalina.out and got the same basic info. But when I go to view alfresco, I get a 404. I've gone through the tutorial twice from scratch now and it's happened both times. Any ideas? Also, I can see all the other tomcat web ages.

    One potential clue: after the first time I tried to open alfresco, the catalina.out log added this:

    NFO: Server startup in 85776 ms
    Jun 06, 2013 12:55:00 AM org.apache.catalina.loader.WebappClassLoader loadClass
    INFO: Illegal access: this web application instance has been stopped already. C
    ould not load org.quartz.StatefulJob. The eventual following stack trace is cau
    sed by an error thrown for debugging purposes as well as to attempt to terminate
    the thread which caused the illegal access, and has no functional impact.
    java.lang.IllegalStateException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
    der.java:1600)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
    der.java:1559)
    at org.quartz.JobDetail.isStateful(JobDetail.java:436)
    at org.quartz.simpl.RAMJobStore.triggerFired(RAMJobStore.java:1335)
    at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:
    320)

    Exception in thread "SolrWatcherScheduler_QuartzSchedulerThread" java.lang.NoCla
    ssDefFoundError: org/quartz/StatefulJob
    at org.quartz.JobDetail.isStateful(JobDetail.java:436)
    at org.quartz.simpl.RAMJobStore.triggerFired(RAMJobStore.java:1335)
    at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:
    320)
    Caused by: java.lang.ClassNotFoundException: org.quartz.StatefulJob
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
    der.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
    der.java:1559)

    ReplyDelete
    Replies
    1. I am not exactly sure why you are getting this error. Poking around It sounds like an issue in your environment. I found this post that has a few suggestions on how to possibly fix it https://forums.alfresco.com/forum/installation-upgrades-configuration-integration/installation-upgrades/error-during-startup

      Delete
    2. Patrick:

      You are a gentleman and a scholar. The link you gave me was just what I needed. Turns out I had previously screwed up my hostname setting, and it was affecting Tomcat. I apologize for taking up your time.



      Drew

      Delete
    3. Not a problem. Taking a little time to help someone out only pays it forward. I have had plenty of questions answered by other folks so I owe the internet a few answered questions every so often :)

      Delete
  7. This comment has been removed by the author.

    ReplyDelete
  8. HI
    any experience with SSO between alfresco and a windows domain (windows server 2003) so that users dont have to remember another password?
    Thanks

    ReplyDelete
    Replies
    1. By the way great blog!
      1. I want to give my smb users versioning in the file share so i am thinking about installing an ubuntu server with alfresco and they will use it with CIFS,
      So in the beginning they do not even know they are using alfresco (just explain check in/check out)..
      We use winXP/win 7, users have windows accounts and also google mail accounts. is there a way to sync the alfresco accounts with google accounts or windows accounts so they dont need to remember another set of passwords?
      Cheers

      Delete
    2. Lots of good questions...

      First I have not set up an SSO with alfresco. I did find this page looking around real quickly http://wiki.alfresco.com/wiki/Alfresco_With_mod_auth_cas

      Alfresco is meant for enterprise so there should be an easy SSO solution... I just never had need of one so far

      I have plans to do a write up at some point on how to sync alfresco with your google docs. I just have not had the time watch this video for this feature http://youtu.be/LbTuCekDHI8. But your question is about passwords not docs...

      I am not aware of a way to do what you are asking off the top of my head.

      Delete
  9. Hi Sir,

    Your articel very helpful. Could you help me to config alfresco authentication with zimbra ldap. My zimbra version is 7.2.2.

    Thank you

    ReplyDelete
    Replies
    1. Setting up Alfresco to talk to an LDAP system has been something I have wanted to do, but have not yet done.

      I have added it to my TODO list, not promising anything but if I am lucky I will have an article in the next month or so on the Subject.

      Delete
  10. Hi Patrick,

    your article is far best than any other i found online. I just installed alfresco with postgresql, it works, but im getting catalina.out full of these exceptions:
    Authentication failed for Web Script org/alfresco/repository/admin/restrictions.get

    do you have any idea how to fix this?

    ReplyDelete
  11. Simply awesome.
    Thank you so much for this post.

    The only thing i did different is that a moved the jars directly to /opt/tomcat/webapps instead of deploying it via tomcat manager app

    ReplyDelete
  12. Thank you so much ! Worked like a charm, better than anything else I found in the web !

    ReplyDelete
  13. Great post, which leads a question: why doing it all manually, as Alfresco provides some kind of all-in-one setup script ?

    Is there real benefit over the alfresco bundle ?
    thank you very much

    ReplyDelete
    Replies
    1. They do provide an all-in-one install. However its meant for testing. It could be used for day to day usage, but it would need a few tweaks. Such as removing the guest login and updating the admin users default password.

      This installation guide, although a valid install, is really just a good starting point for configuring your own set up. As an example you may want to use a postgres database on a different server, this guide does not do that but it does give you a leg up on how to do that (I hope).

      So why would you want to use this vs the provided all-in-one setup.
      1. This is a more production ready set up
      2. Easily allows you to connect to databases running on another server
      3. Because we are geeks and like to tinker!

      Delete
  14. Hi Patrick
    I successfully installed and configured tomcat7, mysql, and alfresco 4.2.c using your great tutorial. Now I wanted to install an add-on (auditShare: http://labs.atolcd.com/projects/auditshare/wiki/Installation_en) and found that some dirs mentioned in the installation guide for audit are missing. Also, the paths in apply_amps.sh (or apply_amps.bat), which I'm asked to run, are not right set. alfresco.sh is completely missing, but I assume that starting and stopping alfresco via the tomcat manager does the same job. My question now: is there a standard way of installing add-ons after manual install with your tutorial ? Or do I just have to adjust scripts and dirs manually and hope everything runs fine ?
    Thank you very much!

    ReplyDelete
    Replies
    1. I have the same issue. Have you found any solution for this case?

      Thx!

      Delete
  15. Thanks for the excellent manual¡¡¡¡
    Can you help me with a script to stop and start services alfresco?
    Please help in this issue¡¡¡
    Thank you¡¡¡

    ReplyDelete
  16. What a great How to....

    I did exactly as you put it but I get the following error. Is t something I missed? I checked the alfresco-global.properties settings and it's identical because I copied and pasted the "# External locations" parameters

    Errors below:
    2014-05-29 09:15:39,216 WARN [alfresco.util.OpenOfficeConnectionTester] [localhost-startStop-1] An initial OpenOffice connection could not be established.

    2014-05-29 09:15:47,676 WARN [org.alfresco.fileserver] [localhost-startStop-1] CIFS, Unable to get local domain/workgroup name, using default of WORKGROUP. This may be due to firewall settings or incorrect setting)

    2014-05-29 09:16:00,221 WARN [alfresco.util.OpenOfficeConnectionTester] [DefaultScheduler_Worker-3] Error trying to query Open Office version information. OpenOffice.org's ConfigurationRegistry not implemented in this version of OOo. Thi
    s should not affect the operation of OOo.

    2014-05-29 09:16:36,626 ERROR [content.transform.TransformerConfigDynamicTransformers] [SearchScheduler_Worker-6] Cannot create dynamic transformer transformer.complex.JodConverter.Image as sub transformers could not be found or created (
    "JodConverter.2Pdf|pdf|complex.PDF.Image").

    2014-05-29 09:16:36,626 ERROR [content.transform.TransformerConfigDynamicTransformers] [SearchScheduler_Worker-6] Cannot create dynamic transformer transformer.complex.JodConverter.Pdf2swf as sub transformers could not be found or created
    ("JodConverter.2Pdf|pdf|Pdf2swf").

    2014-05-29 09:16:36,626 ERROR [content.transform.TransformerConfigDynamicTransformers] [SearchScheduler_Worker-6] Cannot create dynamic transformer transformer.JodConverter.Html2Pdf as sub transformers could not be found or created ("JodC
    onverter|odt|JodConverter").

    2014-05-29 09:16:36,626 ERROR [content.transform.TransformerConfigDynamicTransformers] [SearchScheduler_Worker-6] Cannot create dynamic transformer transformer.JodConverter.2Pdf as sub transformers could not be found or created ("JodConve
    rter|JodConverter.Html2Pdf").

    2014-05-29 09:16:36,631 ERROR [content.transform.TransformerConfigDynamicTransformers] [SearchScheduler_Worker-6] Cannot create dynamic transformer transformer.complex.JodConverter.PdfBox as sub transformers could not be found or created
    ("JodConverter.2Pdf|pdf|PdfBox").

    ReplyDelete
  17. very nice and helpfull article.The translation service is really very helpful to me.
    access Mp3Raid in UK

    ReplyDelete
  18. Hi,

    I can login in the affresco website, but not in the share website ...

    Could you share your share-config-custom.xml file ?

    thanks

    Alphonse

    ReplyDelete