Install Alfresco 4.0 on Ubuntu with Tomcat 7

Install Alfresco 4.0 on Ubuntu with Tomcat 7 

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

 

 

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

      From every machine you want to have access to this box run (current IP is 192.168.0.100)  

 

>cat ~/.ssh/id_rsa.pub | ssh This e-mail address is being protected from spambots. You need JavaScript enabled to view it. "cat >> /home/username/.ssh/authorized_keys"

 

 

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

 

> ssh This e-mail address is being protected from spambots. You need JavaScript enabled to view it. "cat /home/ username/.ssh/id_rsa.pub” | cat >> authorized_keys

 

 

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
  •  Restart ssh server                   

 

> 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

 

( a lot of this was derived from http://jensontaylor.blogspot.com/2010/09/manually-installing-tomcat-7-on-ubuntu.html )

 

·         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…

 

 

Install Apache Ant

 

(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

http://192.168.0.100:8080/manager/html

 


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

http://192.168.0.100:8080/hudson/

 

 

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

 

 

 Create Alfresco Folder


Make a alfresco folder 

 

Ø       > sudo mkdir /alfresco

 

 

Download Install Alfresco

 

Some of the notes I used for this are at

http://wiki.alfresco.com/wiki/Download_and_install_Alfresco_in_Linux

 

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

http://192.168.0.100:8080/manager/html

 

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.

Some of this was gleamed from http://www.howtoforge.com/how-to-install-alfresco-community-3.3-on-ubuntu-server-10.04-lucid-lynx

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

 

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= This e-mail address is being protected from spambots. You need JavaScript enabled to view it.

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.10x13.com

#alfresco.port=8080

#alfresco.protocol=http

#

#share.context=share

share.host=www.10x13.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 Finish

 

 

 

 

 

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

  

References

[1]  Alfresco community-4.0.b manual install guide for Ubuntu Linux

       http://www.xinotes.org/notes/note/1590/

       Visited 1/2012