Install Alfresco Community 4.2 on Ubuntu 12.04

Posted on Friday, January 11, 2013



This document has a few errors in it, I have made a new one that fixes the issues I found.  The updated document can be found at...

http://www.whiteboardcoder.com/2013/01/install-alfresco-community-42-on-ubuntu_31.html 

I am leaving this here just for historical reasons




This document shows how to install Alfresco 4.2 on an Ubuntu 12.04 server that has java 7 already installed on its system.

The virtual machine I am using for this test has 3.75GiB of memory.





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.spinellicreations.com/tomcat/tomcat-7/v7.0.34/bin/apache-tomcat-7.0.34.tar.gz

Extract the file


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


Move the tomcat over


       >sudo mv apache-tomcat-7.0.34 /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/jre1.7.0_10


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.111:8080

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.111: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;
       >  exit



Remove localhost restriction edit /etc/mysql/my.cnf


       >  sudo vi /etc/mysql/my.cnf


Comment out
bind-address            = 127.0.0.1

Change it to
#bind-address            = 127.0.0.1

Restart mysql


       >  sudo /etc/init.d/mysql restart

Test the connection from another server


       > mysql -u alfresco -p -h 192.168.0.111


Then run the following command to create the database


       > create database alfresco default character set utf8 collate utf8_bin;
       >  exit






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-get install python-software-properties
       >     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
       >        sudo apt-get install swftools
       >        sudo apt-get install libjodconverter-java
       >        sudo apt-get install openoffice.org-base openoffice.org-calc openoffice.org-common openoffice.org-draw openoffice.org-impress openoffice.org-math openoffice.org-style-galaxy openoffice.org-style-oxygen openoffice.org-style-tango openoffice.org-writer openoffice.org ooo-thumbnailer openoffice.org-java-common
       >        sudo apt-get install ttf-mscorefonts-installer



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/soffice
ooo.enabled=true
ooo.port=8100
img.root=/usr
img.dyn=${img.root}/lib
img.exe=${img.root}/bin/convert
swf.exe=/usr/bin/pdf2swf
jodconverter.enabled=true
jodconverter.officeHome=/usr/lib/libreoffice/
jodconverter.portNumbers=8100

jodconverter.officeHome=/usr/lib/libreoffice/program/soffice
jodconverter.portNumbers=8101
jodconverter.enabled=true

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


6 comments:

  1. It seems you skipped a step on installing hudson. In your tomcat config you stay to fix hudson, but users will get an error if hudson is not installed.

    ReplyDelete
    Replies
    1. Thanks for the catch, This document does not go over installing hudson, a prior alfresco install I wrote up did. I forgot to take out the references to hudson. I took out the hudson references and updated. Thanks for making me aware of it.

      Delete
  2. hi how can i configure CDN(content delivery network) in alfresco.... can you please give us some suggestion..

    thanx
    amit

    ReplyDelete
    Replies
    1. I do not have any specific suggestions on that one. It would depend on what the end goal was. Amazons S3 service may be a better thing to use than Alfresco. You could use Alfresco to manage your content then upload it to a service, like S3.

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

    ReplyDelete