Difference between revisions of "InstallSampleData"

From mn/ifi/inf5750
Jump to: navigation, search
(Created page with "Installing DHIS Example data requires a couple steps: *Downloading the sample data *Creating the dhis user in postgres *Creating the database *Importing the database from th...")
 
Line 1: Line 1:
Installing DHIS Example data requires a couple steps:  
+
__TOC__
 +
 
 +
'''Installing DHIS Example data requires a couple steps:'''
  
 
*Downloading the sample data  
 
*Downloading the sample data  
Line 8: Line 10:
 
<br>  
 
<br>  
  
= Step1: =
+
= Step1: =
  
 
Download the zip file from here: http://www.dhis2.org/download/resources/dhis2-demo.zip  
 
Download the zip file from here: http://www.dhis2.org/download/resources/dhis2-demo.zip  
Line 16: Line 18:
 
<br>  
 
<br>  
  
= Step2: =
+
= Step2: =
  
 
In your terminal / command line type the following to start the postgres command line:  
 
In your terminal / command line type the following to start the postgres command line:  
Line 35: Line 37:
  
 
<code>postgres=# \du </code>  
 
<code>postgres=# \du </code>  
 +
 +
<tt></tt>
  
 
<tt></tt>
 
<tt></tt>
Line 45: Line 49:
 
  postgres  | Superuser, Create role, Create DB, Replication | {}
 
  postgres  | Superuser, Create role, Create DB, Replication | {}
 
</tt>
 
</tt>
 +
 +
<tt></tt>
  
 
<tt></tt>  
 
<tt></tt>  
Line 56: Line 62:
 
<code>\q </code>  
 
<code>\q </code>  
  
= Step 3: =
+
= Step 3: =
  
 
To import the database use the following command in the folder where you unzipped the file  
 
To import the database use the following command in the folder where you unzipped the file  

Revision as of 23:34, 1 November 2013

Installing DHIS Example data requires a couple steps:

  • Downloading the sample data
  • Creating the dhis user in postgres
  • Creating the database
  • Importing the database from the sample data


Step1:

Download the zip file from here: http://www.dhis2.org/download/resources/dhis2-demo.zip

Extract it.


Step2:

In your terminal / command line type the following to start the postgres command line:

psql -U postgres

Note: If you need additional options like port number see (psql --help) for more information

It will likely ask you for your password, so you should give it and you'll get into the postgres terminal.

Now we will add the dhis user to postgres using the following command. create user dhis createdb;

This will create the db user that is needed for the script.

Use \du

to check if it was actually created, you should see something similar to the following.

postgres=# \du

                            List of roles
Role name |                   Attributes                   | Member of 
dhis      | Create DB                                      | {}
postgres  | Superuser, Create role, Create DB, Replication | {}

Before we can import lets create the database (if you already have the database, you might want to drop it and re-create it, use DROP DATABASE dhis2)

create database dhis2;

We can now close the command line with

\q

Step 3:

To import the database use the following command in the folder where you unzipped the file

psql -d dhis2 -U postgres -f default.sql

this stands for

psql -d <databasename> -U <username> -f <filename to run>