Thursday, March 11, 2010

GNUmed on Mandriva 2010

GNUmed client and server run fine on Mandriva 2010. The client runs out of the box on Mandriva. If all is well the server part installs without a hitch and the command 'gm-boostrap_server' will happily create a GNUmed database. In some corner cases due to the interaction with PostgreSQL the bootstrap process may fail. If that happens you will need some time or someone with good GNU/Linux skills to correct this situation.

If you encounter a message like:
DataError: new encoding (UTF8) is incompatible with the encoding of the
template database (SQL_ASCII)
TIP:  Use the same encoding as in the template database, or use
template0 as template.
most likely your installation of PostgreSQL on Mandriva has a cluster with SQL-ASCII encoding. You can find out by running the following commands as user root on the command shell.
su postgres
psql -l
If the output shows SQL_ASCII for encoding you weil have to change a few things manually before the GNUmed server part can run porperly. If you are sure that you have not used PostgreSQL previously and have no data in it until now then and only then you can try to uninstall all Postgresql packages and reinstall them. Before you reinstall backup and remove the directory '/var/lib/pgsql/data'. After you have reinstalled everything and restarted PostgreSQL (e.g. /etc/init.d/postgresql start) issue the above command again and observe the output. If you now have UFT8 as encoding instead of SQL_ASCII you are good to go. If not or if you don't want to remove the SQL_ASCII cluster then you are in for some manual work on your system. In that case you need to initialize a second cluster in another directory.

Issue these commands as user root.
mkdir /var/lib/pgsql/data1
chown postgres /var/lib/pgsql/data1
As user postgres (via 'su postgres' ) issue this command.
/usr/bin/initdb --locale=de_DE.UTF-8 -D /var/lib/pgsql/data1
Now change into that directory.
cd /var/lib/pgsql/data1/
Edit the file postgresql.conf and set the line #port = 5432 to port = 5433. Make sure to strip away the # at the beginning of the line .Now you have to tell the bootstrap script that PostgreSQL is listening on port 5433 instead of 5432.Change into the directory
/usr/lib/gnumed-server/bootstrap
 and edit the file
bootstrap-latest.sh
Find the line #export GM_DB_PORT=5433 and remove the # to activate the line. To start the second cluster on port 5433 issue these commands as user postgres.
'pg_ctl -D /var/lib/pgsql/data1 start'
To stop PostgreSQL on port 5433 run this command as user postgres.
'pg_ctl -D /var/lib/pgsql/data1 stop'
-Now to finally bootstrap a GNUmed database run this command as user root.
gm-boostrap_server
This is tested and works. You can verify that the second server is running on
port 5433 by running this command as user postgres.
'psql -p 5433 -l'
What is left is a way to automatically cater for the above situation. I
recommend to extend the script 'postgresql 'in /etc/init.d' but this exercise
is left to the user.

Don't forget to edit your config file to tell the client that the server is on port 5433. One way to do this is to edit the file /etc/gnumed/gnumed-client.conf. Find the line port in the profile of your choice and replace 5432 by 5433. Let us know if it does not work out for you.

Sebastian

No comments: