Title: Installation of the Provider Registry
Course: RHEA Provider Registry > Section: Installation of the Provider Registry

Provider Registry Architecture

The provider regsitry is built on the LAMP stack.

L= Linux, in our case Ubuntu

A=Apache

M=MySQL

P=PHP

The first thing we need is to have Ubuntu linux installed on our computer.

This is covered in a lesson of iHRIS Administators Course

Background Software - Supporting Software

From the Ubuntu command line we need to install the lamp stack.

The details of what you need to do depend on the verison of Ubuntu that you have installed.

Up to date installation intructions for the supporting software can be obtained here.

For the newest version of Ubuntu we can get our base supporting software installed by doing:

sudo install tasksel
sudo tasksel install lamp-server

sudo apt-get install php5-memcached memcached php-pear  php-mdb2 \
   php-mdb2-driver-mysql  php5-gd php5-tidy php-apc \
   bzr slapd ldap-utils
sudo pear install text_password console_getopt

Configuring APC

APC is a caching system of APC which we use to keep the system fast.

We need to configure this caching system.

During certain activities like installation and upgrades you may need more memory than APC uses by default. We also want to turn of the slam defense. We need to edit the configuration file file for apc:

sudo gedit /etc/php5/conf.d/apc.ini

It should look like this:

extension=apc.so
apc.write_lock=1
apc.shm_size=100M
apc.slam_defense=0

See slam defense and this.

You'll need to restart Apache after making this change.

sudo /etc/init.d/apache2 restart

Configuring MySQL

We will want to set some parameters in MySQL to increase the cache size.

Make sure you have in /etc/mysql/my.cnf the following values set:

sudo gedit /etc/mysql/my.cnf

query_cache_limit       = 4M
query_cache_size        = 64M

Next we need to restart mysql

sudo /etc/init.d/mysql restart

Next we need to configure MySQL so it can create needed functions:

mysql -u root -p

Enter the password you set above (XXXXX) for MySQL. You will now be able to send commands to MySQL and the prompt should always begin with 'mysql> '. Type these commands:

SET GLOBAL log_bin_trust_function_creators = 1;


CREATE DATABASE providerregistry;
GRANT ALL PRIVILEGES ON providerregistry.* TO pr@localhost identified by 'PASS';
exit

Configuring Apache

This is an optional step.

You will see later we are using the apache rewrite module. To enable the module:

sudo a2enmod rewrite

Now we need to make sure we can use the .htaccess file.

sudo gedit /etc/apache2/sites-available/default

Change:

<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride None
	Order allow,deny
	allow from all
</Directory>

to:

<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride All
	Order allow,deny
	allow from all
</Directory>

Downloading the I2CE Framework

The provider registry user interface uses the I2CE Framework.

The most recent version at the time of writing is 4.1.3.

You can check here to see if there is a more recent verison.

To download the I2CE framework

sudo mkdir -p /var/lib/iHRIS/lib/4.1.3
cd /var/lib/iHRIS/lib/4.1.3
sudo wget http://launchpad.net/i2ce/4.1/4.1.3/+download/ihris-suite-4.1.3.tar.bz2
sudo tar -xjf ihris-suite-4.1.3.tar.bz2

Downloading the Provider Registry Source Code

The source code for the provider registry is hosted on launchpad which uses bzr for its source control system.

If you are not familiar with bzr, you can look at the lesson in the iHRIS Administator's course.

To download the source code:

 sudo chown -R `whoami`:`whoami` /var/lib/iHRIS/lib
 cd /var/lib/iHRIS/lib
 bzr branch lp:rhea-pr

Note that if you are software developer and will be making changes to the source code, you may want to do bzr checkout lp:rhea-pr instead.

Configuring The Provider Registry User Interface

We need to copy and then edit the configuration file for the provider registry user interface.

 cd  /var/lib/iHRIS/lib/rhea-pr/UserInterface/pages
 mkdir -p local
 cp config.values.php local/config.values.php
 gedit local/config.values.php

We now need to uncomment and set the value of a few variables. Commented lines will begin with two slashes (//) that you'll need to remove.

They are:

Variable Name | Value
$i2ce_site_i2ce_path | /var/lib/iHRIS/lib/4.1.3/I2CE
$i2ce_site_dsn | mysql://pr:PASS@localhost/providerregistry
$i2ce_site_module_config | /var/lib/iHRIS/lib/rhea-pr/UserInterface/Provider-Registry-Rwanda.xml

In $i2ce_site_dsn, PASS is the password you set when configuring MySQL.

Making the Site Available

Now that we have configured the provider registry user interface, you can make it availble on apache by:

 sudo ln -s /var/lib/iHRIS/lib/rhea-pr/UserInterface/pages /var/www/providerregistry

OpenLDAP Configuration

To get the basic provider registry schema loaded for LDAP.

sudo /etc/init.d/slapd stop
sudo cp /var/lib/iHRIS/lib/rhea-pr/ldap/provider.schema /etc/ldap/schema
sudo chmod 644 /etc/ldap/schema/provider.schema
sudo chown root:root /etc/ldap/schema/provider.schema
sudo cp  /var/lib/iHRIS/lib/rhea-pr/ldap/slapd.conf /etc/ldap/slapd.conf
sudo chmod 644 /etc/ldap/slapd.conf
sudo chown openldap:openldap /etc/ldap/slapd.conf
sudo mv /etc/ldap/slapd.d /etc/ldap/slapd.d.backup_`date +"%d_%m_%y"`
sudo mkdir -p /etc/ldap/slapd.d
sudo chown -R openldap:openldap /etc/ldap/slapd.d
sudo chmod 755 /etc/ldap/slapd.d
sudo slaptest -f /etc/ldap/slapd.conf -F /etc/ldap/slapd.d
sudo chown -R openldap:openldap /etc/ldap/slapd.d

sudo -su openldap slapadd -l /var/lib/iHRIS/lib/rhea-pr/ldap/base_organizational_units.ldif

sudo -su openldap slapadd -l /var/lib/iHRIS/lib/rhea-pr/ldap/admin_pass.ldif

sudo /etc/init.d/slapd start

Making web services available

 ln -s /var/lib/iHRIS/lib/rhea-pr/webservices /var/www

Setting LDAP Password

The default password for LDAP is "manage".  You may want to change this as follows:

 litlfred@thyme:/tmp$ ldappasswd -SW -D "cn=admin, dc=moh,dc=gov,dc=rw"




In the User Interface, the Provider Registry user interface reads the person form and the post form from LDAP.

You need to set the LDAP password for each of these by following the links:

  http://localhost/providerregistry/magicDataBrowser/show//modules/forms/forms/person/storage_options/LDAP/connection

  http://localhost/providerregistry/magicDataBrowser/show//modules/forms/forms/post/storage_options/LDAP/connection

and setting the password under "pass"