=== modified file 'src/docbkx/en/dhis2_implementation_guide_en.xml' --- src/docbkx/en/dhis2_implementation_guide_en.xml 2012-02-18 07:50:49 +0000 +++ src/docbkx/en/dhis2_implementation_guide_en.xml 2012-03-13 12:38:06 +0000 @@ -15,7 +15,6 @@ - === modified file 'src/docbkx/en/dhis2_implementation_guide_installation.xml' --- src/docbkx/en/dhis2_implementation_guide_installation.xml 2012-03-13 11:05:21 +0000 +++ src/docbkx/en/dhis2_implementation_guide_installation.xml 2012-03-13 12:38:06 +0000 @@ -57,7 +57,7 @@ Make the startup script executable by invoking chmod 755 bin/* DHIS 2 can now be started by invoking bin/startup.sh The log can be monitored by invoking tail -f logs/catalina.out DHIS 2 can be stopped by invoking bin/shutdown.sh Assuming that the WAR file is called dhis.war, you can now access your DHIS instance at http://localhost:8080/dhis
- Reverse proxy (optional) + Reverse proxy with nginx (optional) A reverse proxy is a proxy server that acts on behalf of a server. Using a reverse proxy in combination with a servlet container is optional but has many advantages: @@ -138,6 +138,55 @@ }]]>
+ Reverse proxy with Apache (optional) + Using nginx is the preferred option as reverse proxy and you should not attempt to install both nginx and apache. If you have installed nginx please ignore this section. + First we need to install a few necessary programs. + sudo apt-get install apache2 libapache2-mod-proxy-html libapache2-mod-jk a2enmod proxy proxy_ajp proxy_connect + Lets define an AJP connector which Apache HTTP server will use to connect to Tomcat with. The Tomcat server.xml file should be located in the /usr/local/apache-tomcat-7.0.8/conf/ directory. Be sure this line is uncommented.You can set the port to anything you like which is unused. + <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> +Now, we need to make the adjustments to the Apache HTTP server which will answer requests on port 80 and pass them to the Tomcat server through an AJP connector. Edit the file /etc/apache2/mods-enabled/proxy.conf so that it looks like the example below. Be sure that the port defined in the configuration file matches the one from Tomcat. + <IfModule mod_proxy.c> +ProxyPreserveHost On +ProxyRequests Off +ProxyPass /dhis ajp://localhost:8009/dhis +ProxyPassReverse /dhis ajp://localhost:8009/dhis +ProxyVia On +<Location "/dhis"> + Order allow,deny + Allow from all +</Location> +</IfModule> + + You now can restart Tomcat and the Apache HTTPD server and your DHIS 2 instance should not be available on http://localhost/dhis. + Implementing SSL encryption + Using Apache and the reverse proxy setup described in the previous section, we can easily implement encrypted transfer of data between clients and the server over HTTPS. This section will describe how to use self-signed certificates, although the same procedure could be used if you have fully-signed certificates as well. + First (as root), generate the necessary private key files and CSR (Certificate Signing Request) + mkdir /etc/apache2/ssl +cd /etc/apache2/ssl +openssl genrsa -des3 -out server.key 1024 +openssl req -new -key server.key -out server.csr + We need to remove the password from the key, otherwise Apache will not be able to use it. + cp server.key server.key.org +openssl rsa -in server.key.org -out server.key + Next, generate a self-signed certificate which will be valid for one year. + openssl x509 -req -days 365 -in server.csr -signkey \ server.key -out server.crt + Now, lets configure Apache by enabling the SSL modules and creating a default site. + a2enmod ssl +a2ensite default-ssl + Now, we need to edit the default-ssl (located at /etc/apache2/sites-enabled/default-ssl) file in order to enable the SSL transfer functionality of Apache. + <VirtualHost *:443> + ServerAdmin wemaster@mydomain.org + SSLEngine On + SSLCertificateFile /etc/apache2/ssl/server.crt + SSLCertificateKeyFile /etc/apache2/ssl/server.key +... + Be sure that the *:80 section of this file is changed to port *:443, which is the default SSL port. Also, be sure to change the ServerAdmin to the webmaster's email. Lastly, we need to be sure that the hostname is setup properly in /etc/hosts. Just under the "localhost" line, be sure to add the server's IP address and domain name. + 127.0.0.1 localhost +XXX.XX.XXX.XXX foo.mydomain.org + Now, just restart Apache and you should be able to view https://foo.mydomain.org/dhis. + /etc/init.d/apache2 restart +
+
DHIS 2 Live setup The DHIS 2 Live package is extremely convenient to install and run. It is intended for demonstrations, for users who want to explore the system and for small, offline installations typically at districts or facilities. It only requires a Java Runtime Environment and runs on all browsers except Internet Explorer 7 and lower. To install start by downloading DHIS 2 Live from http://dhis2.org and extract the archive to any location. On Windows click the executable archive. On Linux invoke the startup.sh script. After the startup process is done your default web browser will automtically be pointed to http://localhost:8082 where the application is accessible. A system tray menu is accessible on most operating systems where you can start and stop the server and start new browser sesssions. Please note that if you have the server running there is no need to start it again, simply open the application from the tray menu. === removed file 'src/docbkx/en/dhis2_implementation_guide_installation_detailed.xml' --- src/docbkx/en/dhis2_implementation_guide_installation_detailed.xml 2012-02-14 08:15:15 +0000 +++ src/docbkx/en/dhis2_implementation_guide_installation_detailed.xml 1970-01-01 00:00:00 +0000 @@ -1,751 +0,0 @@ - - - - Installation on Ubuntu 10.10 - Detailed guide - This guide is a more detailed walk-through installation guide on how to install DHIS 2 on Ubuntu 10.10. DHIS2 requires Java, a relational database system and a Java servlet container to run. This guide will guide you through the installation of Java, PostgreSQL (a relational database system) , pgAdmin (the graphical userinterface for PostgreSQL) and Apache Tomcat (a Java servlet container). -
- Installing Java - To install Java, the repository where Java resides needs to be added to Ubuntu's repositories. Invoke the following command to do that (Note: it's one command, not two!): - sudo add-apt-repository ppa:sun-java-community-team/sun-java6 - Then the package list needs to be updated, before continuing to installing java. Invike the following command to do that: - sudo apt-get update - sudo apt-get install sun-java6 - When installation is finished, a blue screen appears: - - Java license agreement - - - - - - - Press the TAB key on your keyboard so that <OK> is marked red, and then press ENTER. In the next window, when you're asked whether you agree, use the arrow keys to mark <Yes> red, and then press ENTER. The TAB key looks like this: -
-
- Instaling PostgreSQL - In the terminal, invoke the following command to install PostgreSQL: - sudo apt-get install postgresql-8.4 - Type Y and press ENTER if you're asked if you want to continue: - - Type Y when you're asked if you want to continue - - - - - - -
- Set password for the system user> - To set the password for the postgres system user, invoke the following command and then follow the instructions: - sudo passwd postgres - - Set password for the system user - - - - - - -
-
- Edit database users and create a database - To modify the databases and the database users, we need to log in as the postgres system user. We use the switch user command su as shown below. When the screen reads: Password:, type the password you created for the postgres system user in the previous step. Invoke the following command (from terminal): - su postgres - Now your terminal should start with postgres=# - - - NB!!For the following three commands, please note: - - - - Remember the semi colons (;) at the end of the lines! - - - Also remember to use the apostrophes (') where specified! - - - If something is unclear, consult the screen shot just below the commands. - - To edit the password for the postgres database user, invoke the following command: - ALTER USER postgres WITH password '<a password of your choice>'; - To create a new user, invoke: - CREATE USER <a user name> WITH PASSWORD '<a password of your choice>'; - To create a new database, invoke: - CREATE DATABASE <a database name> WITH OWNER <a user name> ENCODING 'utf8'; - To quit, type: - \q - - Create a new database user and database - - - - - - - In the terminal again, to log off the postgres system user, simply invoke: - exit -
-
- Open the server for connections - If the server is going to be open for connections, we need to modify the postgresql.conf file: - sudo gedit /etc/postgresql/8.4/main/postgresql.conf - In the window that appears, scroll down to - #------------------------------- -CONNECTIONS AND AUTHENTICATION -#------------------------------- - and change the line - #listen_addresses = 'localhost' # what IP address(es) to listen on; - into: - listen_addresses = '*' # what IP address(es) to listen on; - - Modify the postgresql.conf file to open the server for connections - - - - - - - Then save and exit. -
-
- Define authorizations for the databases - To define authorizations for the databases, we need to modify the pg_hba.conf file: - sudo gedit /etc/postgresql/8.4/main/pg_hba.conf - In the window that opens, scroll down to the bottom of the file and change ident into md5 for the bottom line of the following lines: - # TYPE DATABASE USER CIDR-ADDRESS METHOD - -# "local" is for Unix domain socket connections only -local all all ident - When you're done, it should look like this (the edited line is highlighted): - - Edit the pg_hba.conf file to define authorizations - - - - - - - Save and exit. -
-
- Setting up ODBC Connections to the Postgresql server - Some implementations may require users to connect directly to the database with external software such as Excel, Stata, R or other analysis software. Using ODBC, a connection to the server can be established over the Internet or LAN, between the server and the clients computer. -
- Setting up a Windows 7 (32 bit) ODBC connection - - - Download and install the current ODBC driver from this location. - - - Execute from Start->Run this command to open the ODBC Data Source Administrator - %windir%\system32\odbcad32.exe - - - Click "Add" and choose the "Postgresql UNICODE" driver type and click "Finish". - - - Fill in the values in this dialog box. - - - - - - - - - - Data Source: The name of the ODBC data source. - - - Database: The name of the database to connect to.This should be the name of the DHIS 2 database in most cases. - - - Server: This should be the fully qualified domain name or the IP address of the server. - - - User Name: The user name which has properly configured permissions to connect to the database. The user will need to have the correct security settings (at least SELECT privileges) on the required tables. - - - Description: You can include a description of the ODBC connection here. - - - SSL mode: Determines whether to use an encrypted connection or not. - - - Port: The connection port for the database server. - - - Password: The password for the user which will be used to connec to the database. - - - - - Click the "Datasource" button, and be sure that the "Use Declare/Fech" option is enabled. - - - - - - - - - - ClickOK to exit this dialog box, and the click "Test" to see if the connection works. - - - - - - - - - - Click save to save the ODBC connection. The connection should be available to client applications such as Excel now. - - -
-
-
- Performance tuning - If you want to increase the performance of PostgreSQL, you can do some changes in some configuration files. -
- Increase shared memory - The operating system has something that is called shared memory. By increasing this, applications can perform better. Invoke the following to open the sysctl.conf file: - sudo gedit /etc/sysctl.conf - At the - bottom - of the file, add the following line: - - - If your computer has 12 GB of RAM, add - kernel.shmmax = 1073741824 - - - If your computer has less RAM installed, adjust the value accordingly; - For example, for 4 GB of RAM, add - kernel.shmmax = 352321536 - - - Save the file and exit. - For the changes to take effect, you need to invoke the following in the terminal: - sudo sysctl -p -
-
- Adjust PostgreSQL configurations - By adjusting some PostgreSQL settings, the system can perform even better. We can do this by editing the postgresql.conf file. Invoke the following command to open the file: - sudo gedit /etc/postgresql/8.4/main/postgresql.conf - Now you need to locate some lines and edit them. Follow these steps: - - - Locate the following line: - shared_buffers = 24MB # min 128kB - Change it so it reads (this assumes that your computer has 12 GB of RAM, if not, adjust the value accordingly): - shared_buffers = 512MB # min 128kB - - - Then locate the following line: - #synchronous_commit = on # immediate fsync at commit - Change it so it reads: - synchronous_commit = off - - - Now, locate the following line: - #wal_writer_delay = 200ms # 1-10000 milliseconds - Change it so it reads (your computer's RAM does not matter here): - wal_writer_delay = 10000ms # 1-10000 milliseconds - i.e. remove the first # and set the value to 10000ms (ten thousand) - - - Finally, locate the following line: - #effective_cache_size = 128MB - Change it so it reads (for 12 GB of RAM): - effective_cache_size = 3750MB - i.e. remove the first # and set the value to 3750MB - - - Now, save the file and exit. -
-
- Restart PostgreSQL - For the changes made in the previous section to take effect, you need to restart the PostgreSQL server. You can do that by invoking the following command: - sudo /etc/init.d/postgresql restart -
-
-
-
- Installing pgAdmin -
- Create dhis2/databases folder - Tip: - A wise thing to do, might be to create a folder called dhis2/databases in your local home folder where the database backups can be stored. To do that, in the terminal, invoke the following two commands: - mkdir ~/dhis2 -mkdir ~/dhis2/databases - Note: ~/ refers to the current user's home folder, i.e. /home/yourusername/ - Alternatively, you can navigate to your home folder from Places in the panel. In your home folder you can right-click to create a new folder -
-
- Create a server connectionin pgAdmin - Launch PgAdmin from the menu: Applications -> Programming -> pgAdmin III or from the terminal simply by invoking: - pgadmin3 - To create a server connection, click the button with the plug: - - Click the button with the plug to create a server connection - - - - - - - Enter the credentials - - - Give the connection a name of your choice - - - Host should be the ip address of the server (or localhost if you're running locally) - - - Port is 5432 by default - - - Let the Username be postgres, and - - - provide the correct password - - - You can choose whether or not to store the password. - (Note: The password will be saved in plain text. Avoid saving the password for an online server connection!) - - - - Enter the credentials for the server connection - - - - - - - If you have chosen to save your password, you will be prompted with this message: - - The warning message when you choose to save the password - - - - - - -
-
- Restore a database from pgAdmin - If you have a - compressed - backup-file created by pgAdmin, you can restore it in the similar way as you do in Microsoft Windows. - Connect to your database by double-clicking the server and click the '+'-sign next to Databases. Right-click your database and choose Restore: - - The warning message when you choose to save the password - - - - - - - - Then browse and find your backup file. When you find it, click Open, and then OK in the next window: - - Open your bakup file - - - - - - - Wait for a while until the restoration is finished. - Note: - - - - PostgreSQL 8.4 CAN NOT restore compressed backup files from PostgreSQL 9! - - - - -
-
- Plain text-restoration - If your backup file is in - plain text - , you can use either pgAdmin or the terminal to restore your database. With plain text it doesn't matter which version of PostgreSQL the backup file is made with. -
- Plain text-restoration with pgAdmin - In pgAdmin, select your database and click the SQL button: - - Select your database and click the SQL button - - - - - - - - Then click the open icon: - - SQL open icon - - - - - - - - Now, choose your file and open it: - - Open your plain text backup file - - - - - - - - When it's opened, click the leftmost green arrow to execute the query: - - Click the leftmost green arrow to execute the query - - - - - - - - While the file is being executed, it will say "Query running" in the lower left corner: - - It will say "Query running" while the query is running - - - - - - - - This might take some minutes, so please be patient. When it's finished, the text will say “OK.”. - If the plain text backup file is somewhat big, pgAdmin might crash. But fear not, the restoration process can always be run from terminal. The next section will show you how. -
-
- Plain text restoration from terminal - The command for restoring a plain text backup file, is the following: - psql -d <database> -U <user> -f <file> - For example: - psql -d dhis2 -U dhis -f ~/dhis2/databases/dhis2-backup.sql - Note that the full path of the backup file must be provided! (~/ points to the current user's home folder) -
-
-
-
- Installing Apache Tomcat - To download Apache Tomcat, you can either do it from the terminal, or you can use your web browser to download the latest release from http://tomcat.apache.org/download-70.cgi. If you use your web browser, download the tar.gz file from the Core section. If you want to do it from terminal, invoke the following command (Note: it's one command, not two!): - wget http://apache.uib.no/tomcat/tomcat-7/v7.0.8/bin/apache-tomcat-7.0.8.tar.gz - If you downloaded the file from terminal, extract the file by invoking: - tar xvzf apache-tomcat-7.0.8.tar.gz - Else, if you used your web browser, and your file is stored in the Downloads folder under your home directory, you need to adjust for that in the previous comment, by adding the full path to the downloaded file: - tar xvzf ~/Downloads/apache-tomcat-7.0.8.tar.gz - - Note that you have to change the version number if you download a version different from 7.0.8! - - After the files have been extracted, you can move the files to a folder of your choice. I choose /usr/local/apache-tomcat-7.0.8: - sudo mv apache-tomcat-7.0.8 /usr/local/apache-tomcat -7.0.8 - If you want to delete the downloaded file, you can do that by invoking: - rm apache-tomcat-7.0.8.tar.gz -
- Preparing Tomcat - To prepare Tomcat for DHIS 2, we need to make some adjustments. Go to the Tomcat root folder by invoking: - cd /usr/local/apache-tomcat-7.0.8 - We don't need anything else running than DHIS 2, so we can remove everything else from Tomcat's webapps folder: - rm -rf /webapps/* - Next, we want to create some environment variables that is used by Tomcat and DHIS 2. We're going to create a file called setenv.sh. If that file is placed in Tomcat's bin folder, it will be executed on startup. You can create the file by invoking: - gedit bin/setenv.sh - In this file, we want to define three environment variables. Add the following three lines to the file: - export JAVA_HOME=/usr/lib/jvm/java-6-sun -export JAVA_OPTS=”-Xmx600m -XX:MaxPermSize=1000m” -export DHIS2_HOME=/home/your-user-name/dhis2/DHIS2_HOME - Note that you must insert the user name for the user that is going to run DHIS 2 in the last name. In the last line above, change your-user-name to the actual user name, for example dhis. - JAVA_HOME will set the location of your Java Runtime Environment, JAVA_OPTS allocates memory to Tomcat, and DHIS2_HOME sets the location where the hibernate.properties file is stored (see section later on how to create this file and the DHIS2_HOME folder). -
-
- Reverse proxying with Tomcat and Apache - Tomcat should be run as a non-privileged user and the service will usually run on port 8080. If you want to run the DHIS 2 server on the nomal HTTP port (80), you will need to configure a reverse proxy using the Apache HTTPD server. First we need to install a few necessary programs. - sudo apt-get install apache2 libapache2-mod-proxy-html libapache2-mod-jk -a2enmod proxy proxy_ajp proxy_connect - The first command will install the necessary Tomcat modules and the second command will make them active. - Lets define an AJP connector which Apache HTTP server will use to connect to Tomcat with. The Tomcat server.xml file should be located in the /usr/local/apache-tomcat-7.0.8/conf/ directory. Be sure this line is uncommented.You can set the port to anything you like which is unused. - <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -Now, we need to make the adjustments to the Apache HTTP server which will answer requests on port 80 and pass them to the Tomcat server through an AJP connector. Edit the file /etc/apache2/mods-enabled/proxy.conf so that it looks like the example below. Be sure that the port defined in the configuration file matches the one from Tomcat. - <IfModule mod_proxy.c> -ProxyPreserveHost On -ProxyRequests Off -ProxyPass /dhis ajp://localhost:8009/dhis -ProxyPassReverse /dhis ajp://localhost:8009/dhis -ProxyVia On -<Location "/dhis"> - Order allow,deny - Allow from all -</Location> -</IfModule> - - You now can restart Tomcat and the Apache HTTPD server and your DHIS 2 instance should not be available on http://localhost/dhis. -
-
- Implementing SSL encryption - In certain deployments, data may need to be encrypted between the client and server. Using Apache and the reverse proxy setup described in the previous section, we can easily implement encrypted transfer of data between clients and the server over HTTPS. This section will describe how to use self-signed certificates, although the same procedure could be used if you have fully-signed certificates as well. - First (as root), generate the necessary private key files and CSR (Certificate Signing Request) - mkdir /etc/apache2/ssl -cd /etc/apache2/ssl -openssl genrsa -des3 -out server.key 1024 -openssl req -new -key server.key -out server.csr - We need to remove the password from the key, otherwise Apache will not be able to use it. - cp server.key server.key.org -openssl rsa -in server.key.org -out server.key - Next, generate a self-signed certificate which will be valid for one year. - openssl x509 -req -days 365 -in server.csr -signkey \ server.key -out server.crt - Now, lets configure Apache by enabling the SSL modules and creating a default site. - a2enmod ssl -a2ensite default-ssl - Now, we need to edit the default-ssl (located at /etc/apache2/sites-enabled/default-ssl) file in order to enable the SSL transfer functionality of Apache. - <VirtualHost *:443> - ServerAdmin wemaster@mydomain.org - SSLEngine On - SSLCertificateFile /etc/apache2/ssl/server.crt - SSLCertificateKeyFile /etc/apache2/ssl/server.key -... - Be sure that the *:80 section of this file is changed to port *:443, which is the default SSL port. Also, be sure to change the ServerAdmin to the webmaster's email. - Lastly, we need to be sure that the hostname is setup properly in /etc/hosts. Just under the "localhost" line, be sure to add the server's IP address and domain name. - 127.0.0.1 localhost -XXX.XX.XXX.XXX foo.mydomain.org - Now, just restart Apache and you should be able to view https://foo.mydomain.org/dhis. - /etc/init.d/apache2 restart -
-
- Reverse proxy with nginx - Nginx is a high-performance web server and reverse proxy with built with high concurrency, performance and low-memory usage in mind. For more installations, nginx may be a better alternative than the Apache web server for reverse proxy implementations. - To get started, simply install nginx on your system with the following command. - sudo apt-get install nginx - A sample configuration file is below, and should be placed in /etc/nginx/sites-available. - server { - listen *:80; - #This can be adjusted to allow larger upload file - #sizes, e.g. DXF files. - client_max_body_size 4M; - client_body_buffer_size 128k; - #This should be replaced with your DNS name. - server_name dhis.foo.org; -#Direct nginx access with these file types. -location ~ \.(gif|jpg|png|css|js)$ { -#This should be adjusted to the location of where the -#dhis.war file is located. -root /var/lib/tomcat6/webapps/; -} - -location / { - proxy_pass http://localhost:8080/; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - } -} - - You will need to adjust the server_name, and proxy_pass variables to suit your particular setup. The server name must match exactly the name of the server which will be running DHIS. In this particular setup, nginx will serve all static content and then redirect dynamic requests to the application server. Once you have adjusted the configuration file to suit your needs, be sure to activate it by creating a symbolic link in the /etc/nginx/sites-enabled directory which points to the file. -
-
- Performance tuning - To increase Tomcat's performance, you can install the native APR library by invoking: - sudo apt-get install libtcnative-1 - To make use of this, you need to edit the setclasspath.sh file in Tomcat's bin folder. Open it by invoking: - gedit bin/setclasspath.sh - Scroll down to the bottom of the file, and add the following line at the - bottom - : - LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH - Then save and exit. -
-
-
- Prepare for startup - This section will guide you through the last preparations you need to do before you can start using DHIS 2. -
- Creating the DHIS2_HOME folder - If you want to use your own database, DHIS 2 needs an environment variable called DHIS2_HOME. If you have not set this, see the section Preparing Tomcat to learn how you set this. If you have followed this guide, the DHIS2_HOME environment variable points to the folder /home/your-user-name/dhis2/DHIS2_HOME. However, this folder has not yet been created, so you need to create the folder. From the terminal, invoke the following command to create that folder: - mkdir ~/dhis2/DHIS2_HOME -
-
- Download and prepare DHIS 2 - Download the latest built DHIS 2 .war file from http://dhis2.org/downloads - The 'Download' folder (in which the downloaded files probably are store) can be found by navigating to - - - Places (on the menu bar) -> Downloads. - - - Copy the dhis.war file (Right-click on the file, and then click 'Copy'). Then go to the Tomcat webapps folder. The webapps folder can be found by navigating to: - - - Places (on the menu bar) -> File System -> usr -> local -> apache-tomcat-7.0.8 -> webapps - - - To paste the file in the folder, right-click on a white space within the folder and click 'Paste'. -
-
- Create the hibernate.properties file - To create the hibernate.properties file, invoke the following command from the terminal: - gedit ~/dhis2/DHIS2_HOME/hibernate.properties - In the empty file, paste the following lines and adjust database-name, user and password: - hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect -hibernate.connection.driver_class = org.postgresql.Driver -hibernate.connection.url = jdbc:postgresql:your-database-name -hibernate.connection.username = your-database-user -hibernate.connection.password = your-database-user-password -hibernate.hbm2ddl.auto = update - Then save and exit. -
-
-
- Run DHIS 2 -
- Start Tomcat - To start DHIS 2, you first need to start Apache Tomcat. Invoke the following command from the terminal to start Tomcat: - sh /usr/local/apache-­tomcat­7.0.8/bin/startup.sh -
-
- Open DHIS 2 - To start using DHIS 2, open a web browser and navigate to http://localhost:8080/dhis - The DHIS 2 team recommends Google's web browser Google Chrome for best experience with DHIS 2. -You can download it from http://www.google.com/chrome or by invoking the following command from the terminal: - sudo apt-get install google-chrome-stable -
-
- Stop Tomcat - To stop Apache Tomcat from running, invoke the following command from the terminal: - sh /usr/local/apache-­tomcat­7.0.8/bin/shutdown.sh -
-
-
- Useful scripts - A script can be considered as a "shortcut" in Linux (or any other opreating systems). In a script file, we can write several commands, and by calling the script file, all these commands will be executed automatically. - This section will teach you how to create some useful scripts to ease the startup and shutdown process. -
- DHIS 2 start and stop script - First of all, it can be wise to create a folder in which we can store all the scripts. I've chosen the folder ~/dhis2/scripts. To create this folder, from the terminal, invoke the following command: - Again, note that ~/ points to your local home folder. The full address will be /home/your-user-name/dhis2/scripts. Ubuntu understands however the ~/ shortcut, so it's no problem to use it. - mkdir ~/dhis2/scripts - Now we need to tell the system that we have scripts in this folder. We have to add the folder to the PATH environment variable. This can be done by editing the .bashrc file. Open it by invoking: - gedit .bashrc - At the - bottom - of the file, add the following line: - export PATH=~/dhis2/scripts:$PATH - Then save and exit. -
- The dhis script file - To create the file, invoke: - gedit ~/dhis2/scripts/dhis - In the file, paste the following lines: - if [[ $# > 0 && $1 == 'start' ]] -then - sh /usr/local/apache-tomcat-7.0.8/bin/startup.sh -elif [[ $# > 0 && 1 == 'stop' ]] -then - sh /usr/local/apache-tomcat-7.0.8/bin/startup.sh - echo - echo Please be patient while DHIS 2 is starting... - sleep 1 - echo Point your web browser to http://localhost:8080/dhis - echo -else - echo - echo Wrong usage: - echo You have to type dhis start or dhis stop - echo -fi - Note: If you have installed Apache Tomcat in a different location from what is given in the example, you will need to change the path both places it say /usr/local/apache-tomcat-7.0.8/ in the example. Also, if your war file is not called dhis.war, but something different, adjust the URL http://localhost:8080/dhis correspondingly. Note that .war is not supposed to be in the URL. - - What's left now, is to make the file executable. To do that, invoke the following two commands from the terminal: - cd ~/dhis2/scripts -chmod +x dhis - - Now your script is ready to being executed. From the terminal, you can invoke the following commands to start or stop DHIS 2: - dhis start -dhis stop -
-
-
-
- Using Amazon Web services - Amazon Web Services (AWS) offers virtual cloud-computing resources which allow developers and implementers to quickly scale an application, both horizontally and vertically, in a cost effective manner. AWS offers multiple operating systems and instance sizes depending on the exact nature of the deployment. This section will describe a basic setup with the AWS Elastic Cloud Compute (EC2) system using the Basic 32 bit Amazon AMI, which is based on the Red Hat Linux distribution. - Estimating the cost of an AWS instance can be performed using the "Simple Monthly Cal culator". AWS costs are based entirely on usage. As your application usage grows, you can provision new servers. - - - You will need an existing AWS account. If you do not have one, you can create one here. Once you have created and enabled your account, login to the AWS console. - - - Once you have logged in, select the "EC2" tab. You will need to select a region in which to instantiate your instance. Users in Europe and Africa, should probably use the EU West region, while users in Asia should probably use on of the Asia Pacific regions (either Singapore or Tokyo). Selection of the appropriate region will reduce latency between the server and clients. - - - Click the "Instances" link on the right menu, and then the "Launch Instances" button. - - - - - - - - Select one of the AMIs for your server. Using either of the Basic Amazon AMIs (either 32 or 64 bit) is recommended, but you can use whichever AMI is most appropriate. - - - Next, you will need to select the size of your instance. The size of the instance selected will depend on the number of anticipated users. Selecting the "Micro" size, will enable you to test DHIS 2 in the AWS environment for a period of one year, at no cost if you use one of the "Free tier eligible" AMIs. - - - - - - - - - - Once you have selected the instance size, you can select a specific kernel ID and RAM disk ID. If you do not have a specific reason, just use the defaults and proceed to the next dialog. - - - Next, you can add key-value pairs to help you to easily identify the instance. This is just metadata for your own usage. - - - Next, you will need a key pair which will enable you to remotely access your instance. If you have an existing key pair you can use it, otherwise, you can create a new key pair. - - - - - - - - - - You will need to assign a security group to the instance. Security groups can be used to expose certain services (SSH, HTTP, Tomcat, etc) to the Internet.With security groups, you can control which ports will be open to specific network ranges. For DHIS 2, you would normally need at least port 22 (SSH) and port 80 (HTTP) open to the internet or specific address ranges. - - - - - - - - - - Finally, you can review and launch your instance. - - - Once the instance, has been launched, you can connect via PuTTY or any other SSH client to the instance using the instance's Public DNS, which is listed on the EC2 control panel. You will need to install a few packages if you are using the Amazon default AMI. - yum install jdk.i586 postgresql-server.i686 apache-tomcat-apis. -noarch tomcat-native.i686 httpd.i686 - - - Once you have installed these packages, you can follow the instructions provided in the previous section on setting up a server. - - -
-
=== removed directory 'src/docbkx/en/resources/images/dhis2_ubuntu_installation' === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/CRS Comments - Google Chrome.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/CRS Comments - Google Chrome.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/CRS Comments - Google Chrome.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/Continue-Yes.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/Continue-Yes.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/Continue-Yes.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/Create-folder.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/Create-folder.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/Create-folder.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/JAVA_HOME.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/JAVA_HOME.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/JAVA_HOME.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/Java-agreement.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/Java-agreement.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/Java-agreement.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin-Add-Server.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin-Add-Server.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin-Add-Server.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin-Guru Hint - Saving passwords.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin-Guru Hint - Saving passwords.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin-Guru Hint - Saving passwords.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin_NewServerRegistration.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin_NewServerRegistration.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/PgAdmin_NewServerRegistration.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/Pg_hba.conf.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/Pg_hba.conf.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/Pg_hba.conf.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/Places-Home.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/Places-Home.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/Places-Home.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/Postgresql.conf.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/Postgresql.conf.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/Postgresql.conf.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/change maverick to lucid (2).png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/change maverick to lucid (2).png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/change maverick to lucid (2).png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/change maverick to lucid.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/change maverick to lucid.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/change maverick to lucid.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/download java jdk.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/download java jdk.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/download java jdk.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit password.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit password.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit password.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit_password-unix.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit_password-unix.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit_password-unix.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit_sources.list.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit_sources.list.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/edit_sources.list.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/export_CATALINA_OPTS.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/export_CATALINA_OPTS.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/export_CATALINA_OPTS.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/hibernate.properties.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/hibernate.properties.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/hibernate.properties.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-Restore.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-Restore.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-Restore.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-Query-running.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-Query-running.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-Query-running.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-file.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-file.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-file.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-open.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-open.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-open.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-run.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-run.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL-run.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin-SQL.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin_FindBackup.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin_FindBackup.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/pgAdmin_FindBackup.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/postgres.png' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/postgres.png 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/postgres.png 1970-01-01 00:00:00 +0000 differ === removed file 'src/docbkx/en/resources/images/dhis2_ubuntu_installation/tab_key.jpg' Binary files src/docbkx/en/resources/images/dhis2_ubuntu_installation/tab_key.jpg 2011-03-01 14:14:36 +0000 and src/docbkx/en/resources/images/dhis2_ubuntu_installation/tab_key.jpg 1970-01-01 00:00:00 +0000 differ