AnsweredAssumed Answered

Alfresco 4.0.a Upgrade Guide (Ubuntu 10.04 - Zentyal)

Question asked by citizenkane on Oct 25, 2011
Latest reply on Oct 25, 2012 by sharifu
Here is what worked for me. It does not implement Solr, but works fine with Lucene. (I can't get Solr to work yet)

This guide will preserve lucene indexing in favour of solr and use PostgreSql

It will keep Alfresco along with the PostgreSql, java, openoffice in a "container" as per the default install. This should make it easier to migrate and upgrade in the future.

STOP you old alfresco instance and back up alf_data as well as do a dump of the database.

Download the installation binary and save to <any directory>

sudo su
cd <any directory>./alfresco-community-4.0.a-installer-linux-x64.bin

Select "2" detailed install

Set install location to /var/opt/alfresco-4.0.a

Select all module options

Change all port mappings from default to avoid conflicts with the existing server (generally up by one digit)

Install Alfresco as a service

DO NOT ALLOW IT TO RUN if you are upgrading from previous database; follow these instructions:

Rename directory 'alf_data' to 'alf_data_virgin'

Restore your backed up 'alf_data' as 'alf_data'

copy the following directories from 'alf_data-virgin' to 'alf_data';

    'keystore'
    'postgresql'
    'solr'


Create a new database user (you will understand why when it comes to backing up):

createuser -P -U postgres -s -e -h /var/opt/alfresco-4.0.a/postgresql -p <new psql port as defined in install> <new user - same as your old database owner>

Create a new database:

sudo createdb -U <new user> -O alfresco -h /var/opt/alfresco-4.0.a/postgresql -p 5433 alfresco2

Restore your old database to the new:

psql -U <new user> -h /var/opt/alfresco-4.0.a/postgresql -p 5433 alfresco2 < <your database dump file>

(If the old database owner does not exist in the new database, Postgre will throw errors in the import)

Edit configuration:

/var/opt/alfresco-4.0.a/tomcat/shared/classes/alfresco-global.properties

to suite your environment and add the following to the bottom of the file:

# Index Recovery Mode
#————-
index.recovery.mode=FULL

Edit:

index.subsystem.name=solr

to:

index.subsystem.name=lucene

Initiate first run:

service alfresco start

Repair log file location:

change:

log4j.appender.File.File=/alfresco.log

to:

log4j.appender.File.File=/var/opt/alfresco-4.0.a/alfresco.log

in the following files:

    /var/opt/alfresco-4.0.a/tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties
    /var/opt/alfresco-4.0.a/tomcat/webapps/awe/WEB-INF/classes/log4j.properties
    /var/opt/alfresco-4.0.a/tomcat/webapps/share/WEB-INF/classes/log4j.properties


Complete configuration:

Edit:

/var/opt/alfresco-4.0.a/tomcat/shared/classes/alfresco-global.properties

index.recovery.mode=AUTO

and:

### E-mail site invitation setting ###
notification.email.siteinvite=true
mail.host=localhost
mail.port=25
mail.username=anonymous
mail.password=
mail.encoding=UTF-8
mail.from.default=<admin email>
mail.smtp.auth=false

to suite your server.

Edit:

/var/opt/alfresco-4.0.a/alf_data/postgresql/postgresql.conf

#port = 5432

to:

port = <your new database port> 



Restart Alfresco:

service alfresco restart

Cold backup script:

Establish authentication for postgres:

For pg_dump script authentication to work, the pg username and system username need to match.

su <username>
echo '*:*:*:<pg username>:<pg password>' > ~/.pgpass
chmod 0600 ~/.pgpass

Create a backup script to run from cron:

#!/bin/bash
bdate=`date +%F`
############## Cold Backup for Alfresco on PostgreSql
blocation="<backup location>"
busername="<username>" #This needs to be the same username for system and MySql in order for authentication to work
bdatabasename="<your database name>"
sudo mkdir -p $blocation/$bdate/alfresco
service alfresco stop
wait
sh /var/opt/alfresco-4.0.a/postgresql/scripts/ctl.sh start
wait
alfbackup() {
sudo -u $busername /var/opt/alfresco-4.0.a/postgresql/bin/pg_dump -U $busername -h /var/opt/alfresco-4.0.a/postgresql -p 5433 $bdatabasename > $blocation/$bdate/alfresco/$bdatabasename.dump
tar czf $blocation/$bdate/alfresco/alfresco.tgz /var/opt/alfresco-4.0.a/alf_data
}
alfbackup
wait
sh /var/opt/alfresco-4.0.a/postgresql/scripts/ctl.sh stop
wait
service alfresco start
############## Remove old backups
olddelete=`date –date="7 days ago" +%F`
sudo rm -r $blocation/$olddelete

Outcomes