Upgrade dhis2 from version 2.40.3 to 2.40.7

Hello everyone,
I am currently using dhis2 version 2.40.3 and would like to upgrade to the latest version 2.40.7.
I do not know how to do, if you can give me all the steps to follow to make this upgrade please.
Thank you for your help,

Since this is a minor release upgrade, the process is a little bit easier. Please make sure to still go through the upgrade notes first to see if there are any breaking changes.
This steps might be a little different depending on how you installed your DHIS2 instance. I will make the assumption you used the steps in this guide

PLEASE USE THIS INSTRUCTIONS WITH CAUTION OTHERWISE YOU MIGHT LOOSE YOUR INSTANCE OR DATA.

Please reach out to a professional implementer if you are unsure on how to proceed or any command below is unfamiliar.

Now that you have been sufficiently warned, let do this! :sunglasses:

  1. Stop tomcat sudo -u dhis /home/dhis/tomcat-dhis/bin/shutdown.sh
  2. Backup your postgres database pg_dump -U dhis -d dhis2 -W -f dhis2.backup.sql.Use the password from the file /home/dhis/config/dhis.conf
  3. Backup your DHIS2 HOME folder tar -czvf config.tar.gz -C /home/dhis config
  4. Download the appropriate war file from the releases page and move it to your webapps folder mv dhis.war tomcat-dhis/webapps/ROOT.war
  5. Start DHIS2 sudo -u dhis tomcat-dhis/bin/startup.sh

Give it a few minutes and check your URL to see if the site has come up. You should have upgraded your instance successfully

1 Like

Hello Eric
thank you for your reaction and the steps to follow.
Eric, at step 2, when I enter the command “pg_dump -U dhis -d dhis2 -W -f dhis2.backup.sql”, I am asked for the password to access postgresql, when I enter the password, I get the following error: pg_dump: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432 “failed: FATAL: Peer authentication failed for user “dhis”.

What should I do?
Thanks

Sorry about that. This is because the server has been configured to use peer authentication

Could you try sudo -u dhis pg_dump -U dhis -d dhis2 -f dhis2.backup.sql. This invokes the command with the user dhis

Another alternative would be to specify the host pg_dump -U dhis -h localhost -d dhis2 -W -f dhis2.backup.sql

Hello Eric
Sorry for my late return, I’m online for the rest of the day to upgrade dhis.
Well, thanks again for your promptness, I was indeed able, thanks to your reaction, to skip the step of backing up the postgres database, however continuing with the instructions, at the step of backing up the DHIS2 HOME folder, when I enter the command: tar -czvf config.tar.gz -C /home/dhis config
I get the following errors:

tar (child): config.tar.gz: Cannot open: Permission denied
tar (child): Error is not recoverable: exiting now
tar: config/files: Cannot open: Permission denied
tar: config/logs: Cannot open: Permission denied
config/dhis.conf
tar: config.tar.gz: Cannot write: Broken pipe
tar: Child returned status 2
tar: Error is not recoverable: exiting now