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...")
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
Installing DHIS Example data requires a couple steps:  
+
__TOC__
 +
 
 +
<pre>
 +
Hey fellow students,
 +
 
 +
Since we needed some sample data to test our app, we installed the sample data from the site.
 +
 
 +
To make it easy for our other team members we made a small tutorial, which you can now also use :)
 +
 
 +
Happy hacking!,
 +
 
 +
Trust us, we're Scientists! team.
 +
</pre>
 +
 
 +
 
 +
'''Installing DHIS Example data requires a couple steps:'''
  
 
*Downloading the sample data  
 
*Downloading the sample data  
Line 8: Line 23:
 
<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 16: Line 31:
 
<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 35: Line 50:
  
 
<code>postgres=# \du </code>  
 
<code>postgres=# \du </code>  
 +
 +
<tt></tt>
  
 
<tt></tt>
 
<tt></tt>
Line 45: Line 62:
 
  postgres  | Superuser, Create role, Create DB, Replication | {}
 
  postgres  | Superuser, Create role, Create DB, Replication | {}
 
</tt>
 
</tt>
 +
 +
<tt></tt>
  
 
<tt></tt>  
 
<tt></tt>  
Line 54: Line 73:
 
We can now close the command line with  
 
We can now close the command line with  
  
<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  

Latest revision as of 23:17, 1 November 2013

Hey fellow students,

Since we needed some sample data to test our app, we installed the sample data from the site.

To make it easy for our other team members we made a small tutorial, which you can now also use :)

Happy hacking!,

Trust us, we're Scientists! team.


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>