How can i Install DHIS2 Specific version with automated installation.
i want to install a specific DHIS2 version like 2.40.2.2 through Automated installation guide.
Automated Installation Guide
when i install it on my Ubuntu machine it installs the latest version like 2.42 but i want to install specific version.
Hi @Tahir_Zaman
You can follow the instructions under the “Adding a new instance” in the README.md for the Github repo, it says that you can use the following command: vim dhis2-server-tools/deploy/inventory/hosts
and then edit the instance version under [instances]
Here’s the direct link to the instructions: GitHub - dhis2/dhis2-server-tools: Tools to support installation and management of DHIS2
I hope this helps! Looking forward to your feedback.
Thanks!
Thanks Alot @Gassim it worked. ![]()
Hello AL-Gasmin thank you for the tutorial but if I had to delete an instance with ansible or how to return to a previous version because when I installed the dhis2 2.42 version I would like to return to 2.40 but when I do it nothing changes
Welcome back to the community! ![]()
When upgrading, the upgrade guide, mentions the important step to create a backup plan: Upgrade Guide - DHIS2 Documentation so if you created a backup plan, you will be able to rollback.
If you only need a clean installation of dhis2 using the same method, I recommend following the guide “Adding a new instance”, click here. In the second line you add, you will mention the version number 2.40.
Effectivement je l’ai fait de manière propre et ca marche. Mais il se trouve que je n’ai pas changé la version et ca installé la 2.42.1 or c’est la 2.40 que je voulais installer. je souhaite revenir à la version de 2.40 au lieu de 2.42
Hi again @GUY_ROLLAND_KOUASSI,
If you installed (using the lxc installation) version 2.42 but want version 2.40, you have only two options:
- Add a new instance with the version 2.40 as I mentioned in the post above
- Delete the instance (2.42) and then do the installation again (but I’ve not tested the deletion process, so I’ll triage your question).
Thank you!
Hello @GUY_ROLLAND_KOUASSI,
To answer your question: you should specify the exact version you want to install, for example 2.42.2.2. If you only provide a partial version (e.g., 2.42), the system will install the latest release under that branch. If you need a specific minor version (e.g., 2.41.2.5), you must provide the full version number—but keep in mind that the version must actually be available for installation.
Second part about downgrading:
So, you want to roll back to 2.40 after upgrading to 2.42. This is a common upgrade challenge. Let me explain the key differences between the two versions:
-
Different dependencies:
-
DHIS2 2.42 runs on Tomcat 10 with Java 17, and is typically deployed on Ubuntu 24.04. If you used the automated tools, your container is already running Ubuntu 24.04.
-
DHIS2 2.40 runs on Tomcat 9 with Java 11.
-
Because of this, downgrading from 2.42 to 2.40 isn’t just about changing the DHIS2 version—it also means downgrading Tomcat, Java, and the underlying operating system. While not impossible, it’s usually much more effort than simply spinning up a new instance with 2.40.
Another complication: if you already migrated your database into 2.42, schema changes will have been applied. Reversing those database changes is complex and not recommended.
In conclusion: DHIS2 upgrades generally go one way—from a lower version to a higher version. The best practice is to always test the migration in a staging environment first, and only upgrade production after confirming everything works, with a backup in place.
With the current tools, you can still do in-place automated upgrades up to 2.41. However, moving to 2.42 requires creating a new instance, because of the Tomcat 10 requirement and the need for Ubuntu 24.04 (or another OS that supports Tomcat 10).
Bonjour Tito
Je te remercie pour la reponse. J’ai refait l’ OS et repris les installations avec ansible. POur la version 2.42 s’est passé normalement mais la version 2.40 affiche HTTP Status 404 – Not Found
J’ai cherché les repertoires où se trouvent les fichiers dhis2.conf et setenv.sh de tomcat
Voir image ci dessous.
dhis2.40
fichier hosts
dhis2.42
Okay, this is what I will respond to Guy in English (and you will help me by providing the French translation please):
Hi Guy,
I think the issue stems from using ‘proxy_rewrite=true’ for both instances.
You can choose only one of those to have the redirection whereas the other one will remain at the base (which you will also need to include for both instances):
Please see if the following will fix the issue (I assumed that the version 40, dhis, is the primary one):
[instances]
dhis ansible_host=172.19.2.11 database_host=postgres dhis2_version=2.40 dhis2_base_path=dhis proxy_rewrite=True
dhis2 ansible_host=172.19.2.12 database_host=postgres dhis2_version=2.42 dhis2_base_path=dhis2
Maybe @tkipkurgat will have a better suggestion but I hope this helps. Thanks!
–AI Translation:
AI Réponse en Français
Salut Guy,
Je pense que le problème vient de l’utilisation de proxy_rewrite=True pour les deux instances. Vous ne pouvez choisir qu’une seule de ces instances pour avoir la redirection, tandis que l’autre restera à sa base (que vous devrez également inclure pour les deux instances).
Veuillez vérifier si la configuration suivante résout le problème (j’ai supposé que la version 2.40, dhis, est la principale) :
[instances] dhis ansible_host=172.19.2.11 database_host=postgres dhis2_version=2.40 dhis2_base_path=dhis proxy_rewrite=True dhis2 ansible_host=172.19.2.12 database_host=postgres dhis2_version=2.42 dhis2_base_path=dhis2
Peut-être que Tito aura une meilleure suggestion, mais j’espère que cela vous aidera. Merci !



