Installing Alfresco 4.0 Community on Ubuntu 10.04 LTS and Tomcat 7

Posted on Friday, January 13, 2012





Here is my simple install guide, it may not be perfect but it works.  Some of the installs are not necessary but part of my typical setup like  Hudson, Subversion, Ant a few bash settings.

Of course you want to change the usernames and passwords for your own.





First of all I did reference this site for a few things http://www.xinotes.org/notes/note/1590/ [1].  But most of this is derived from various notes I have on installs.

This was installed on a 32-bit Ubuntu 10.04 LTS,  It is recommended to install Alfresco on a 64-bit system for improved performance.


Remove apparmor


OK, Apparmor drives me nuts so I just remove it.



      > sudo apt-get remove apparmor






Change the timezone


To change the default time to mountain run this command


      >  sudo dpkg-reconfigure tzdata 





Choose US
Then choose mountain





Static IP setup

I am running this from a home vmware server so I set a static IP address so I could port forward to it later.

1.      Open up /etc/network/interfaces

> sudo pico /etc/network/interfaces

2.      And update it to this

auto lo
iface lo inet loopback
#
#
auto eth0
iface eth0 inet static
         address 192.168.0.100
         netmask 255.255.255.0
         broadcast 192.168.1.255
         gateway 192.168.0.1

3.      Restart the network with this command

> sudo /etc/init.d/networking restart

4.      Check if it got the right IP address with ifconfig  (it should be 192.168.0.100

> ifconfig eth0





Setup SSH

·         From the command line run this to install openssh


> sudo apt-get install openssh-server


·         Create SSH Key
o   Open up terminal and execute           
·          

> ssh-keygen –t rsa –b 2048

·         Update Authorized keys
o   From every machine you want to have access to this box run (current IP is 192.168.0.100)
o    

> cat ~/.ssh/id_rsa.pub | ssh username@192.168.0.100 "cat >> /home/username/.ssh/authorized_keys"


And if you need to have the server have SSH access to that machine run.
o    

> ssh username @192.168.0.132 "cat /home/ username/.ssh/id_rsa.pub” | cat >> authorized_keys

o    
o   Now fix the SSH server so that it no longer uses passwords or protocol 1.





> sudo pico /etc/ssh/sshd_config

§  Protocol 2
§  PermitRootLogin no
§  PasswordAuthentication no
§  PrintLastLog no
o   Restart ssh server
o                          

> sudo /etc/init.d/ssh restart






Change the login motd (etc)

In Ubuntu 10.04 they handle the message of the day a little funny.

·         Go to the motd script folder

> sudo rm –r /etc/update-motd.d/*
> sudo pico /etc/update-motd.d/99-footer


·         Open up every script in this folder and comment out any commands.
·         Add this to the 99-footer script.
·          

#!/bin/bash

echo
echo “Welcome to the Alfresco Demo Server!”
echo



Chmod the file

> sudo chmod u+x /etc/update-motd.d/99-footer




Update /etc/bash.bashrc

·         Add the following line to the end of /etc/bash.bashrc


#Ouputs local Hard drive capacity
df –hl





Install Java6


Edit /etc/apt/sources.list.


      >    sudo pico /etc/apt/sources.list


Add the following at the bottom


deb http://archive.canonical.com/ lucid partner


Run this from the command line


      >    sudo apt-get update


·         Run this from the command line to install Java


      >    sudo apt-get install sun-java6-jdk


Run through the install process, accept license, etc….

·         Check that it is installed


      >    java -version



Update the .profile settings

·         Open ~/.profile and add this to the end of the file


PS1="\h:\w> "




Install/Update .screenrc


I use screen a lot here is how to install and the settings I use. Install .screen


      >    sudo apt-get install screen





·         Here is my custom .screenrc file (located in the home directory)  Copy it


      >    pico ~/.screenrc





###################################################
#
# Variables
#
###################################################
autodetach            on              # Standard: on
crlf                  off             # Standard: off
deflogin              off             # Standard: on
hardcopy_append       on              # Standard: off
startup_message       off             # Standard: on
vbell                 on
defscrollback         100000            # Standard: 100
silencewait           15              # Standard: 30
shell                 bash
activity              "activity in %n (%t) [%w:%s]~"
bell                  "%C -> %n%f %t activity!"
vbell_msg             " Oops "        #Default error message is Wuff Wuff


###################################################
#
#       CAPTION
#
###################################################

caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"

###################################################
#
#       HARDSTATUS
#
###################################################

hardstatus alwayslastline "%{kw}%t %{+b kr}host: %{kw}%H %{kg} | %C:%s%a | %{kw}%D %m/%d/%Y | %{kr}(load: %l)"

# %H is host
# %l is load
# %C is time 12 hour
# %c is time in 24 hour
# %a is AM/PM
# %m is month
# %d is day
# %Y is year

#Screen color option
# 0 Black             .    leave color unchanged
# 1 Red               b    blue
# 2 Green             c    cyan
# 3 Brown / yellow    d    default color
# 4 Blue              g    green           b    bold
# 5 Purple            k    blacK           B    blinking
# 6 Cyan              m    magenta         d    dim
# 7 White             r    red             r    reverse
# 8 unused/illegal    w    white           s    standout
# 9 transparent       y    yellow          u    underline




Install Tomcat 7



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


      >  wget http://download.nextag.com/apache/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.tar.gz


Extract the file


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


Move the tomcat over


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




Now set up the tomcat users.


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



Add the following lines within the <tomcat-users> element


  <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, This has some issue with Hudson if not fixed.


      >  sudo pico +68 /opt/tomcat/conf/server.xml


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



Set up start up script


      >  sudo pico /etc/init.d/tomcat


Then place the following in it.


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


export JAVA_HOME=/usr/lib/jvm/java-6-sun
export HUDSON_HOME=/opt/hudson


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


http://192.168.0.100:8080

Should see…






(required for Hudson build Deploy)

Download Apache Ant 1.8.2, current download at http://apache.deathculture.net//ant/binaries/apache-ant-1.8.2-bin.tar.gz


      >  wget http://apache.deathculture.net//ant/binaries/apache-ant-1.8.2-bin.tar.gz


Unzip it


      >  tar –xvf apache-ant-1.8.2-bin.tar.gz


Move to opt


      >  sudo mv apache-ant-1.8.2 /opt/ant



Install Apache Subversion

(required for Hudson build Deploy)

Download Apache Subversion 1.6.15.  This can be downloaded from apt-get


      >  sudo apt-get install subversion


Test it


      >  svn  --version


I guess Ubuntu is a little behind as this gives 1.6.6 (which is fine)





Update main bash file

adding ant path etc.


      >  sudo pico /etc/bash.bashrc 


Adding the following to the bottom



JAVA_HOME=/usr/lib/jvm/java-6-sun
ANT_HOME=/opt/ant
ANT_OPTS="-Xms128m -Xmx128m -XX:PermSize=128m -XX:MaxPermSize=256m"
HUDSON_HOME=/opt/hudson

export JAVA_HOME ANT_HOME ANT_OPTS HUDSON_HOME

PATH=$PATH:$ANT_HOME/bin


Then make the /opt/hudson/code directory



      >  sudo mkdir -p /opt/hudson






Install Hudson (Build Deploy Tool)


Download Hudson 1.381 is the latest stable


      >  wget http://hudson-ci.org/downloads/war/1.381/hudson.war


Go to the tomcat manager to install the war file

Go to


For Context path enter /hudson
For the war location enter /home/username/hudson.war
And click deploy


Now Hudson is installed


Confirming installation of Hudson go to
32-bit




Check to make sure the hudson home directory is correct.
Click on Manage Hudson



Then configure system





Home directory should be /opt/hudson



This is where subversion files will be uploaded to.



Set up Hudson security


Now that Hudson is set up we need to set up its security to prevent unwanted users from logging in an running builds.  Out of the box anyone can get into Hudson which is a bit of a security risk.

From the main Hudson screen click on “Manage Hudson”



Then click Configure Hudson



Checkbox “Enable Security”



We are going to use our unix users /groups.  
Checkbox “Unix user/group database”  then click test to test the connection.  If it returns success you are good.



Select the Matrix-based Security and add each user individually



Then give them every permission (but make sure anonymous has no permissions).



Click Save at the bottom.


Now if you go to hudson you will get a login prompt.




Change memory settings for tomcat




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


Add the following line

For 32-bit system (may need to update this one in the future to be more like the 64-bit one)


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


Restart tomcat


      >  sudo /etc/init.d/tomcat restart







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 pico /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 localhost


Then run the following command to create the database



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






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)


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


Install unzip


      >  sudo apt-get install unzip


unzip file


      >  unzip alfresco-community-4.0.c.zip


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

32-bit



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/


      >    cd
      >    wget http://mysql.he.net/Downloads/Connector-J/mysql-connector-java-5.1.18.zip
      >    unzip mysql-connector-java-5.1.18.zip
      >    cd mysql-connector-java-5.1.18/
      >    cp mysql-connector-java-5.1.18-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.


Edit /etc/apt/sources.list.


      >    sudo pico /etc/apt/sources.list


Add the following at the bottom


deb http://archive.canonical.com/ lucid partner


Run this from the command line


      >    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



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


      >    sudo pico +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 pico alfresco-global.properties


Here is the properties that need to be updated, you need to adjust it for the email service you are using this example is for a gmail or googledocs gmail account


dir.root=/alfresco/alf_data

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

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/openoffice
jodconverter.portNumbers=8100

jodconverter.officeHome=/usr/lib/openoffice/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

#
# SQLServer connection
# Requires jTDS driver version 1.2.5 and SNAPSHOT isolation mode
# Enable TCP protocol on fixed port 1433
# Prepare the database with:
# ALTER DATABASE alfresco SET ALLOW_SNAPSHOT_ISOLATION ON;
#
#db.driver=net.sourceforge.jtds.jdbc.Driver
#db.url=jdbc:jtds:sqlserver://localhost:1433/alfresco
#db.txn.isolation=4096

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

#
# Index Recovery Mode
#-------------
#index.recovery.mode=AUTO



#
# Outbound Email Configuration
#-------------
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=myname@example.com
mail.password=emailpassword
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=www.example.com
#alfresco.port=8080
#alfresco.protocol=http
#
#share.context=share
share.host=www.example.com
#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


Log back into the system them tail the tomcat log to see if alfresco is starting correctly


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

Open up
http://192.168.0.100:8080/alfresco just to confirm its running…





Removed Automatic Guest Login

·         Updated /opt/alfresco-3.4.c/tomcat/shared/classes/alfresco-global.properties


      >  sudo pico /opt/tomcat/shared/classes/alfresco-global.properties


Added this to the end of the file


alfresco.authentication.allowGuestLogin=false


·         Reboot


      >    sudo reboot now










Logged in as admin and added new users

·         Opened up http://192.168.0.100:8080/alfresco/ logged in as user = admin
Pass = admin



Now change the password

Click on User Profile





Click on Change password



Enter new password and click Finsih




Click on  Manage System Users



Click Create New User


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

- Patrick Bailey

References
[1]  Alfresco community-4.0.b manual install guide for Ubuntu Linux
       Visited 1/2012


No comments:

Post a Comment