Difference between revisions of "InstallSampleData"

From mn/ifi/inf5750
Jump to: navigation, search
Line 10: Line 10:
 
<br>  
 
<br>  
  
= Step1: =
+
= 1st Downloading the sample data =
  
 
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 18: Line 18:
 
<br>  
 
<br>  
  
= Step2: =
+
= 2nd Preparing the database =
  
 
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 62: Line 62:
 
<code>\q </code>  
 
<code>\q </code>  
  
= Step 3: =
+
=3rd Importing the sample data =
  
 
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  
Line 71: Line 71:
  
 
<code>psql -d &lt;databasename&gt; -U &lt;username&gt; -f &lt;filename to run&gt; </code>
 
<code>psql -d &lt;databasename&gt; -U &lt;username&gt; -f &lt;filename to run&gt; </code>
 +
 +
 +
==Happy hacking! :)==

Revision as of 22:38, 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


1st Downloading the sample data

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

Extract it.


2nd Preparing the database

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

3rd Importing the sample data

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>


Happy hacking! :)