17 Jul

Yet another Alfresco Community upgrade tutorial: from 4.0.d to 4.2.f.

The task to upgrade Alfresco (Community or Enterprise) from a version to another more recent, has to follow a clear and precise path. In every case it is always a critical task and in some cases could be a serious problem for the Organizations (of course this is more critical for Community Editions). In some cases the only possible solution is an Alfresco-to-Alfresco migration instead of an upgrade… but this is another scenario.

In this tutorial is described a step-by-step approach to an upgrade from an Alfresco Community Edition v4.0.d to v4.2.f in one only upgrade step. In every case, even if the involved versions are different, the approach is always the same discussed here.

Needless to say: I am not responsible for any damage that may happen after following the given instructions, which hopefully will not happen.

The (only) correct approach

Before starting I would like to share the (only) correct approach: please remember that the upgrade process for the Alfresco Community Editions is tested (and not guarantee) for the closest versions (for Alfresco Enterprise you can take a look here). This means that the only path you can follow to upgrade a very old version to a recent one is always to develop multiple upgrades.

For example, if you come from the v4.0.d and want to go to the recent v5.0.a, it’s only written in the stars if the direct upgrade will work. The most verified approach is to develop the upgrade process with the steps described below:
– Upgrade from v4.0.d to v4.0.e,
– Upgrade from v4.0.e to v4.2.a,
– Upgrade from v4.2.a to v4.2.b,
– Upgrade from v4.2.b to v4.2.c,
– Upgrade from v4.2.c to v4.2.d,
– Upgrade from v4.2.d to v4.2.e,
– Upgrade from v4.2.e to v4.2.f,
– Upgrade from v4.2.f to v5.0.a.

You can take your own risks “jumping” some steps, and in some cases it would work, but nothing is garantee in every case. In this tutorial I decided to take a reasonable risk, often discussed in the forums and tutorials, and “jump” with a single upgrade process.

Preparing the upgrade

To develop the upgrade I need the Alfresco backup of my v4.0.e production installation. If you don’t know what is an Alfresco backup and how to obtain it, I strongly recommend to take a look here.

In this tutorial I choose to define a brand new server with the recent Alfresco installation (in our case the v4.2.f) but you could choose to use the same server. Of course, in this case, the task is even more critical and the steps are the same but developed in different folders from the “old” version of Alfresco.

The new Alfresco installation

As introduced before, in this tutorial I work in a vanilla server with Ubuntu 14.04 LTS on board. In the server is installed Oracle Java v1.7.60u, always installed as described here.

To install Alfresco you can follow this tutorial even if it describes one specific version (the installation steps don’t change too much). Alternatively you can choose to install it using the easier wizard. In every case you will install the target version of Alfresco, in our case: Alfresco Community v4.2.f.

For the purpose of the post, the way you use to install Alfresco is not relevant but remember that it will be your brand new server, so it’s always suggested to have the most robust and stable one. 😉

If you have some customizations (custom models, behaviors, actions or something else) not it’s time to install them in the new server. The task is always the same: stop alfresco, deploy the customizzations in the way you always do (AMP, maven, manually) and start Alfresco again.

As final step, it is always suggested to switch off the indexing. In our case we suppose to use Solr but with Lucene it will be the same. To develop the task, please follow the steps below:

cd <alfresco>
./alfresco.sh stop
nano tomcat/shared/classes/alfresco-global.properties

 #solr.port.ssl=8443 (comment it)

Save and exit.

Database restore

Now it’s time to restore the alfresco database from the backup. To do it, please be sure that PostgreSql (or the database you use) is running. If you installed the Alfresco with the wizard you can use the command below.

./alfresco.sh start postgresql

To delete the current Alfresco’s database use the commands below.

cd <postgresql>/bin
./psql -h localhost -U postgres -d postgres

  DROP DATABASE alfresco;
  CREATE DATABASE alfresco WITH owner = alfresco;

To restore the database dump you can use:

./pg_restore -h localhost -U postgres -d alfresco <file.dump>

Filesystem restore

Once the database is restored you have to restore the documents on the file system from the backup.

cd <alfresco>/alf_data
rm -rf contentstore
rm -rf contentstore.deleted

Now it’s time to copy the ‘contentstore’ and ‘contentstore.deleted’ folders form the backup, directly in the ‘alf_data’.

Can’t you see the indexes are not restored? If possible it’s always preferrable to rebuild the indexes from scratch. In the other cases we suggest to restore them from the backup, hoping nothing changed in the structure. 🙂

Alfresco bootstrap

Now everything is ready to start alfresco again.

cd <alfresco>
./alfresco.sh start tailf tomcat/logs/catalina.out

You will see that the starting process is updating the database and everything is necessary to upgrade the system. Errors or problems will be listed here.

Indexes rebuild

As you read before, the Alfresco update has been without the indexes.
Now it’s time to rebuild them following what you read here.

./alfresco.sh stop
nano <alfresco>/tomcat/shared/classes/alfresco-global.properties


cd <alfresco>/alf_data/solr
rm -rf workspace/SpacesStore/*
rm -rf archive/SpacesStore/*
rm -rf workspace-SpacesStore/alfrescoModels/*
rm -rf archive-SpacesStore/alfrescoModels/*
cd <alfresco>
./alfresco.sh start

Enjoy your brand new Alfresco installation…

7 thoughts on “Yet another Alfresco Community upgrade tutorial: from 4.0.d to 4.2.f.

  1. Francesco Corti

    Hi Alejandro,
    Alfresco requests to pass through all the releases with the community edition.
    So the update path should be: 4.2.f -> 5.0.a -> 5.0.b -> 5.0.c.
    Being practical, as usual when you work with Alfresco, probably the path could be reduced even if we will have the correct answer only after a test.
    Typically the first release upgrade is recommended so 4.2.f -> 5.0.a should be developed.
    The minor upgrades always work so you could try 5.0.a -> 5.0.c with a high percentage of success.
    You could try 4.2.f -> 5.0.c with some risks… but in a development environment you could easily try.
    Please, let us know if it works.

  2. Avatar

    Hi Francesco,

    all our articles are great. Congratulations! It’s always great o share experiences, since it only improves the knowledge management.

    Sorry if I post it at the wrong time and place, but I’m facing a problem with Alfresco 4.2.f. It’s related with index.
    When I search for any document inside any Site of Alfresco, results are zero! No one document is shown, even after having passed correct search parameters. No document, no folder, nothing.
    Any suggestion?
    Thank you in advance!

    • Francesco Corti

      Hi Allan,
      Thank you for the feedback.
      Typically the problem you have is due to some kind of problem in the indexes.
      My first suggestion is to rebuild the indexes from scratch (if you use Lucene or Solr there are two different steps to develop).
      I hope this will helps you.

  3. Avatar

    Hello all,
    Just in case this information is useful for you, I upgraded from 4.0.d to 5.0.d based on these instructions and some troubleshooting related to 5.0.d itself and not the migration. Given that you do not mind a full-reindexing, it is absolutely possible.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.