I am using Alfresco as a personal document archiving system for all my personal things. Everything that gets (snail-)mailed to me get scanned with my document scanner, which does OCR, page cutting, rotating and optimizing, and then uploaded to alfresco with pretty much one click. Well, one button (scanner), then I need to supply a file-name and finally the document is added via drag&drop to Alfresco. This system works great, even my wife uses it (frequently). The only thing that’s kept on paper are important documents like insurance policies and things like that.
As this is obviously a critical piece of our “digital lives”, it needs to be stable and somewhat up-to-date. I opt-out of going after every update and I seem to upgrade Alfresco only once a year, which works well for me. My Alfresco installation in shielded from the internet, that is, it’s on my private (non-internet connected) server, so bugs and exploits are of no concern here.
Now installing and running Alfresco is straightforward, consisting out of downloading, running and doing the setup and configuration wizard, period. But as some point, you do want to upgrade it. And this is where the fun starts.
Upgrading “their way”
- Backup all your data
- Delete your Installation
- Reinstall newer Version of Alfresco
- Restore your data
which seems odd for any piece of software in the year 2015, but who are we to judge free stuff. The problem is, or was at least for me, the lack of good information. Either the sites are obsoleted (for old Versions) or they refused to “hold my hand” during critical phases. I am not talking about “Backing up your data” – actually I am. Turns out even the real Alresco documentation says
[…] back up your database and content store (alf_data directory).
Backing up a directory is easy, but what about the database? It refers to “your used database“, mh. I am using their own supplied embedded postgresql database, so what about that? No answer here.
Upgrading “my way”
Long story short. To Upgrade Alfresco 4.x to 5.x do this: First, my Alfresco is installed in “/docstore”, so replace all occurrences of “/docstore” with your Alfresco root directory. The following steps might look scare, but fear not.
First, get your postgresql login information that Alfresco uses:
/docstore/tomcat/shared/classes/alfresco-global.properties db.username=alfresco db.password=somefancypasswort
After we got that, we stop Alfresco, but we keep the postgresql alive, so we can dump:
cd /docstore && ./alfresco.sh stop && ./alfresco start postgresql
Now we need to dump the postgresql database, when asked for a password, enter the db.password from above. Be sure to use the same Username (-U) as the db.username:
cd /docstore/postgresql/bin/ && ./pg_dump alfresco -U alfresco > /root/alfresco.sql
Now, backup all the documents:
cd /docstore && tar -cf /root/alfresco.tar alf_data/contentstore alf_data/solr/workspace alf_data/solr/archive
The scary part: Delete all of Alfresco, don’t forget the init.d script:
/etc/init.d/alfresco stop rm /etc/init.d/alfresco cd /docstore && rm -rf * && sync
cd /docstore && ./alfresco stop ; ./alfresco postgresql start
with that, we can remove the namespace (be sure to supply the correct username/passwords):
/docstore/postgresql/bin./psql -h localhost -U postgres -d postgres DROP DATABASE alfresco; CREATE DATABASE alfresco WITH owner = alfresco;
cd /docstore/postgresql/bin ./psql -U alfresco alfresco < /root/alfresco.sql
cd /docstore/alf_data rm -rf contentstore solr4/* tar -xf
mv solr solr4
cd /docstore ./alfresco stop postgresql ./alfresco start
as the root login information is unchanged.