In most cases, we are unable to provide support for DHIS2 instances that are not hosted by BAO Systems. However, you may find the following brief guide helpful when restoring DHIS2 backups downloaded from BAO Manager to your local systems. This guide assumes that you already have a properly provisioned and configured system per the official DHIS2 system administration guide.
Our backups do not contain any ownership or permission information so they can be restored by non-root users. Likewise, they don't contain PostGIS references. If you don't already have a `dhis2` database in your postgresql database server, you can create one using SQL commands similar to the following. You may need to alter this SQL depending on your specific configuration. In both code samples below, we are creating a database called `dhis2` that is owned by postgresql role/user `dhis`.
CREATE ROLE dhis WITH LOGIN PASSWORD 'Password-goes-here';
CREATE DATABASE dhis2 OWNER dhis;
GRANT ALL PRIVILEGES ON DATABASE dhis2 TO dhis;
\c dhis2
ALTER SCHEMA public OWNER TO dhis;
CREATE EXTENSION postgis WITH SCHEMA public;
Once you have a blank dhis2 database, you can import the database using following command line tools as a starting point:
gunzip backup-file.sql.gz
psql -d dhis2 -U dhis -f backup-file.sql
In the previous example, `dhis2` is the name of the database and `dhis` is the postgresql role.
When restoring if you see the error
ERROR: type "geometry" does not exist LINE 24: geometry geometry(Geometry,4326), ^
It means that you need to confirm that
CREATE EXTENSION postgis WITH SCHEMA public;
Ran properly, installing the postgres extension is a requirement of DHIS2.