Friday 21 December 2012

Upgrading Alfresco 4.0 to 4.2

Very much like the Advice given to would be  couples wishing to married in the 1890's edition of Punch - don't.

Upgrading Alfresco is one of those things that doesn't get upgraded, instead its a new install. And its a bit of a pain. I have done three upgrades this week and now I think I have just about got it cracked. There is a lack of proper documentation and only advice from users that have done this. I needed to upgrade my OS at the same time, some I backed everything up, did a reinstall of the OS ( in my case SUSE 12.2) and then installed Alfresco from scratch, I put in he old database and then configured all the addins and a day later the machines was up and ready.
I am upgrading from the default installation of 4.0.e to 4.2.c version

Stop Alfresco server:  sh /opt/alfresco-4.0.e/alfresco.sh stop

Make a complete backup of alfresco installation:

root@alftest:~# cp /opt/alfresco-4.0.e /opt/alfresco-4.0.e.backup -R 

and then copy this to another machine

In /opt/alfresco-4.0.e/tomcat/shared/classes/alfresco-global.properties  switch off the solr indexing. This seems to be a vital part in getting the backup of the database to work

### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443
- Start and stop alfresco server
 sh /opt/alfresco-4.0.e/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.0.e/alfresco.sh stop
Start Alfresco postgresql:
sh /opt/alfresco-4.0.e/alfresco.sh start postgresql
- Dump (backup) the entire alfresco postgresql database.

su postgres
$ pg_dump -h localhost alfresco > /home/philip/Downloads/alfrescodbdump

$ exit
- Stop Alfresco postgresql:
sh /opt/alfresco-4.0.e/alfresco.sh stop postgresql
I
Install the new OS and add in the extra files and systems that might be needed
I added Chrome, teamviewer, filezilla, postgresql ( to get the extra commands needed)
I set up Samba, the Firewall and opened the ports, 25, 7070 and 8080
I made sure postfix was not running.
I then copied all the archived files back to /home/philip.Downloads

I then did a clean install of Alfresco, with all the defaults and checked that it was working ok. Having got over this hurdle everything was now much easier.


In /opt/alfresco-4.2.c/tomcat/shared/classes/alfresco-global.properties  switch off the solr indexing. 

### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443
- Start and stop alfresco server
 sh /opt/alfresco-4.2.c/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.0.e/alfresco.sh stop
Start Alfresco postgresql:
sh /opt/alfresco-4.0.e/alfresco.sh start postgresql
- Drop new installation’s database, create the new one and restore the above backed up:
su postgres
$ dropdb alfresco -h localhost -i
Database "alfresco" will be permanently removed.
Are you sure? (y/n) y
Password:
$ createdb -T template0 alfresco -h localhost
Password:
$ psql alfresco -h localhost < /home/philip/Downloads/alfrescodbdump
Password:

Watch as the Database is loaded
$ exit
Stop new Alfresco postgresql:
sh /opt/alfresco-4.2.c/alfresco.sh stop postgresql

Copy over contentstre and contentstore.deleted. I used Dolphin in SU Mode

sh /opt/alfresco-4.2.c/alfresco.sh start && sleep 300 && sh /opt/alfresco-4.2.c/alfresco.sh stop

Revert the indexing back to on (Solr):
In /opt/alfresco-4.2.c/tomcat/shared/classes/alfresco-global.properties turn
### Solr indexing ###
index.subsystem.name=noindex
dir.keystore=${dir.root}/keystore
#solr.port.ssl=8443
into
### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443
Now make any modification (in configuration files, etc) to match your installation scheme. These have to be typed in since there are changes in the config file.
Start the server nd try it out
sh /opt/alfresco-4.2.c/alfresco.sh start