GNU Health/Installation

From Wikibooks, open books for an open world
< GNU Health
Jump to: navigation, search

Contents

Requirements[edit]

The latest stable GNU Health has the following requirements:

  1. Operating System: GNU Health is Operating System independent, although we highly recommend the use of a Free OS (such as GNU/Linux or FreeBSD)
  2. Database: PostgreSQL
  3. Python: >= 2.7
  4. Tryton: = 2.6

Installing GNU Health[edit]

Creating the Operating System User[edit]

It is highly recommended that you use a dedicated user for your GNU Health Installation. The following steps will create the GNU Health operating system user:

# adduser gnuhealth

Installing GNU Health Dependencies[edit]

Parabola GNU/Linux[edit]

Parabola GNU/Linux is a completely free Operating System, derivative from ArchLinux.

To install gnuhealth, is necessary enable [pcr] repo uncommenting it on /etc/pacman.conf:

[pcr]
Include = /etc/pacman.d/mirrorlist

After this, run the following command as root (or using sudo):

# pacman -Sy && pacman -S gnuhealth


Other Arch Linux derivatives[edit]

Login as root :

# pacman -S postgresql
  pacman -S pygtk
  pacman -S gcc
  pacman -S python2-pip

Login as gnuhealth user :

# pip2 install --user relatorio
  pip2 install --user python-dateutil
  pip2 install --user psycopg2
  pip2 install --user pytz
  pip2 install --user polib
  pip2 install --user python-ldap
  pip2 install --user vobject
  pip2 install --user pywebdav
  pip2 install --user qrcode
  pip2 install --user PIL

Debian and derivatives[edit]

Run the following command as root (or using sudo):

# apt-get install python-pip python-lxml python-relatorio python-dateutil \
    python-psycopg2 python-tz python-polib python-ldap python-vobject python-webdav postgresql

Creating the Database user[edit]

Now we need to give permissions to your newly created gnuhealth administrator. Switch to the postgres administration user and execute the following command:

# su - postgres -c "createuser --createdb --no-createrole --no-superuser \
   --pwprompt gnuhealth"

Downloading and Installing GNU Health[edit]

Important notice : There are 2 main ways of installing GNU Health. : Installing from source and installing the GNU Health packages from the Python Package Index (Pypi). You are free to use the installation method you prefer, but use only one. The first method gives you maximum flexibility, but it may be a bit more complex for the newcomer. Installing GNU Health via the Python Package Index server installs the required dependencies, but it may be not as flexible as the source code.

Installing GNU Health from source and using the configure script[edit]

There are 3 main steps:

  1. Download Tryton 2.6.x server (trytond)
  2. Download and install the required Tryton modules for GNU Health (account, account_invoice, account_product, calendar, company, country, currency, party, product, stock and stock_lot). These trytond modules satisfy all the current GNU Health functionality. If you do a custom installation, some of these modules are not required.
  3. Install GNU Health sources

Example to download and install the Tryton server and the account module

cd $HOME
mkdir -p tryton/tryton_2_6/server
cd tryton/tryton_2_6/server

Download and extract the Tryton Server (trytond)

wget http://downloads2.tryton.org/2.6/trytond-2.6.3.tar.gz
tar -xzf trytond-2.6.3.tar.gz

Download and extract the required GNU Health dependencies (for example, the account module ). Repeat this step for the other modules.

wget http://downloads.tryton.org/2.6/trytond_account-2.6.3.tar.gz
tar -xvf trytond_account-2.6.3.tar.gz

Create a link from the "modules" directory to the just downloaded account module

cd trytond-2.6.3/trytond/modules
ln -si ../../../trytond_account-2.6.3/ ./account

Do the same for following trytond modules:

trytond_company-2.6.0.tar.gz
trytond_country-2.6.0.tar.gz
trytond_currency-2.6.0.tar.gz
trytond_account_invoice-2.6.3.tar.gz
trytond_party-2.6.1.tar.gz
trytond_account_product-2.6.0.tar.gz
trytond_product-2.6.0.tar.gz
trytond_calendar-2.6.2.tar.gz
trytond_stock-2.6.2.tar.gz
trytond_stock_lot-2.6.1.tar.gz

you may check latest version for each module at http://downloads.tryton.org/2.6/

Go back to your $HOME directory.

cd

Download and extract GNU Health sources : You can always download the latest GNU Health sources from the GNU FTP server, at this link : http://ftp.gnu.org/gnu/health/gnuhealth-latest.tar.gz

From the GNU Health user directory type :

wget http://ftp.gnu.org/gnu/health/gnuhealth-latest.tar.gz
tar -xvf gnuhealth-latest.tar.gz

This will uncompress the latest GNU Health sources into the directory gnuhealth-version directory (for example gnuhealth-1.8.1 )

cd gnuhealth-1.8.1 (or your version number)

If you are in a *NIX like Operating system, the GNU configure script verifies that you have the right Python version, and that you have Tryton installed. It will also install the man page. The steps are the following

  • Run the ./configure script . If you are installing GNU Health in a system-wide directory, you need to be root.

It will do the checks and if everything is OK, it will generate the Makefile. Running configure without arguments it will install GNU Health in the standard directories, normally system wide. If you want to install GNU Health in a different directory, you can use the argument --with-tryton=<path_of_the_tryton_server>. Otherwise just copy manually all health* modules in your tryton server modules folder.

  • Run make install to install the GNU Health modules in the right place
  • You can install the man page by typing "make install_man"


Remember that if you want to install GNU Health in system-wide directories, you will need to be root.
Summing up:

RECOMMENDED : Do a local installation for your tryton 2.6.3 server in your home directory

gnuhealth@beastie$ ./configure --with-tryton=$HOME/trytond-2.6.3
gnuhealth@beastie$ make install

Alternative system-wide installation as root (not recommended)

$ su -
# ./configure
# make install
# make install_man

If you successfully installed this section, please move to Booting up the Tryton Server

Installing the GNU Health packages from the Python Package Index (Pypi)[edit]

Since GNU Health version 1.4, all the health modules are also packaged as Python modules. They can be found at the Python Package Index. This means that GNU Health is fully integrated in the Python community. GNU Health as a Python package provides modularity and ease of installation. It will retrieve and install the package and all its dependencies. It will actually install the Tryton server for you, which is also available as a Python module.

pip is a tool for installing and managing Python packages. pip will install the requirements (the Tryton server and all the standard GNU Health modules) automatically in your ~/.local directory.

Make sure that you are NOT root. Log in with your gnuhealth user.

Installing the Basic set of GNU Health modules: The health_profile module[edit]

GNU Health comes with a predefined profile - health_profile - that installs the modules for the basic functionality. The modules within health_profile currently are :

  • health
  • health_socioeconomics
  • health_lifestyle
  • health_genetics
  • health_icd10
  • health_gyneco
  • health_pediatrics
  • health_surgery
  • health_lab
  • health_inpatient

Installing from the Sources[edit]

If you installed GNU Health from the source file, you already have the health_profile and the rest of the official modules in your system.

Installing from the the Python Package Index Site[edit]

If you are going to install the modules using the Python Package Index, then you need to download them using the pip command (pip2 in Arch Linux). For example to install the health_profile set of modules, type in the following command :

gnuhealth@beastie$ pip install --user trytond_health_profile

The local installation places the files under the $HOME/.local directory

Note: There are more modules to download at PyPI for GNU Health (invoice, health services, reporting, icd10-pcs....). You can download and install them at any moment. You can also opt not to install the predefined set of modules, and choose your own set.


Installation of the Tryton client
You can install the Tryton client with the following command

gnuhealth@beastie$ pip install --user tryton==2.6


Both commands will do the installation under $HOME/.local

If you successfully installed this section, please move to Booting up the Tryton Server

Booting up the Tryton Server[edit]

You should see something like this. Pay attention at the last line INFO:server:starting JSON-RPC protocol on localhost:8000

gnuhealth@beastie$:~/.local/bin$ ./trytond 
[Sat Oct 29 21:03:48 2011] INFO:server:using default configuration
[Sat Oct 29 21:03:48 2011] INFO:server:initialising distributed objects services
[Sat Oct 29 21:03:48 2011] INFO:server:starting JSON-RPC protocol on localhost:8000

Booting up the Tryton Client[edit]

gnuhealth@beastie$:~/.local/bin$ ./tryton

Setting the Tryton client Tabs position for GNU Health[edit]

Before you start the installation of the database, you need to set the Tabs position to be on "Top". This will produce the optimal navigation.

The following action in the Tryton client will set it: Options -> Form -> Tabs Position -> Top

GNU Health Client Tabs position.png
Finally, save your client preferences Options -> Save Options


You can also change the default value to "top" on the Tryton client configuration file, that resides in your $HOME directory, ($HOME/.config/tryton/x.y/tryton.conf). So for a Tryton version 2.2, you can check the value of your tab positions by doing:

cd $HOME/.config/tryton/2.2
grep form_tab tryton.conf

It should give back form_tab = top. If it has another value, please change it to "top".

Creating the GNU Health database[edit]

The first step is to create a database that will hold all the information for your GNU Health system.

All GNU Health information is stored in a PostgreSQL database, and processed by the Tryton kernel. No action is needed at the operating system level to create or manage the database, as all can be done via the Tryton / GNU Health frontend.

To create a Database, open your Tryton client. You will be presented with the following Login popup window:

GNU Health login popup.png

Click on Manage profiles, then click on Add. Give your new connection a name on the left side, and fill the fields on the right side. If you're doing the installation on the same machine, choose localhost as the hostname. Example:

GNU Health Profile Editor.png

Click on the Create button, the following popup appears:

GNU Health Create new database.png

The default Tryton Server Password is admin (you can change it later). Give your database a name, and enter a new admin password twice. Note: this will be the password of the super-user for your new database, so use a strong password when dealing with production servers.


Check in the server log (or console) if any error occurs. If so, try to fix the problem (ie. any Python module missing or some unmet dipendencies), drop the database just created and repeat the procedure.


After the database is created, click OK. You're now ready to log in!

Logging into the application[edit]

Now that you're back at the login screen, you'll notice that the selected Profile is the one you've just created. Fill in the login form:

  • User name: The one you used previously usually, admin
  • Password: the one entered twice in the previous section

Installing the default modules[edit]

From this point on, you will use the client for almost every process. Start with the installation of the basic functionality:

  1. After you've created the database, the system will ask you to create some new users. You can skip this step for now.
  2. You are then presented with a list of modules that will provide the functionality you desire. If you don't see the Modules window, navigate to it on the right side: Administration > Modules > Modules.
  3. Select the health_profile module, and click on Mark for installation:

    GNU Health Module selection.png

  4. Click on the Action icon (a blue rotated square) and select Perform Pending Installation/Upgrade:

    GNU Health Module selection - Marked for installation.png

  5. Tryton will automatically select all the dependent modules required for the installation:

    GNU Health Perform Pending Installation-Upgrade.png

  6. Click on Start Upgrade. This process will take a while, depending on the computer where GNU Health is being installed on. Once it's done, the following message appears:

    GNU Health system upgrade done message.png

Congratulations, you've successfully installed GNU Health!

Installing Extra Modules[edit]

GNU Health is constantly evolving. The default modules are just a subset of the modules available and provide basic functionality. Depending on your Health center, you will most likely want to install some of the other modules that come with GNU Health. Some of the modules that are ready to install are:

  • health_history: Generates the patient clinical history reports.
  • health_reporting: Statistics on different indicators (diseases, doctor assignments, .. ). It also creates different charts
  • health_services: Registers all the services done to a patient, in an ambulatory or inpatient scenario. It will also generate invoices on selected services.
  • health_qrcodes: Permits identifying the patient and the newborns with 2-dimensional Quick-Recognition codes.

There are many more. Just check on the module list and select those that fit best your health center.

Congratulations ! You have completed the initial installation of GNU Health.

The next chapters will guide you through the customization of GNU Health to meet your health center needs.


Introduction · First Steps