Installing OpenGroupware.org 1.1 on Debian Linux

The first and most important thing to know about OpenGroupware.org is that the documentation is absolute crap. It is clear that first and foremost, the goal is to sell the complete server distribution that works from install. The system has become much more work-at-first than it used to be, but the install is still pretty lumpy. This document will tell you how I managed to install the latest (as of 20060530) version of OpenGroupware.org (OGo) on a fairly plain Debian sarge (currently the stable release) installation.

I chose debian because of the more "server"-style linux distributions, I feel it walks the best balance between functionality and being light in weight. It is also by far the best-supported Linux server, if you're not talking about commercial support such as from companies like Oracle - most of them prefer SuSE or Red Hat Enterprise Linux (RHEL). Setting up Debian is outside the scope of this article and in any case is pretty damned easy. Short form: I used bittorrent to download the netinst iso, which downloads the balance of the distribution a piece at a time from the package repository mirror of your choice (or does it automatically, which was my choice.) Suffice to say that besides installing debian and bringing it up to current, I installed apache2 and postgresql packages. These are prerequisites for OpenGroupware.org.

Now, back to the aforementioned crap documentation. I did manage to find a document that tells you how to install OpenGroupware.org 1.0a on debian but this document as written is unlikely to work even for 1.0. At least, it wasn't working for me. In particular, the 1.0 install does not install the .psql file to create the database schema! The 1.1 version has an option to create an instance of OGo, but it doesn't work - it mangles the pg_hba file that controls access to the postgresql server.

Most of the information in that document is right on, even today. But, not all of it! Here's the procedure I followed.

Add the following line to your /etc/apt/sources.list file:

deb http://download.opengroupware.org/nightly/packages/debian sarge trunk

You could also use the following line if you're on sid instead of sarge:

deb http://download.opengroupware.org/nightly/packages/debian sid trunk

Either way, add something to the file and then do an apt-get update or the equivalent in your deb package mangler of choice. Having done this, you can now apt-get install opengroupware.org which at this moment will install OGo 1.1. You also will want/need some other debs, like "opengroupware.org-misc-tools" which contains the "Defaults" command you will need to change OGo options. This deb is NOT included in the opengroupware.org deb, and you will need to install it manually. I believe the apache module is also not included; It's called libapache2-mod-ngobjweb, at least for apache2. I'm not going to tell you how to deal with apache1, because I didn't do that, and I don't care. Anyway if it's automatically installed, don't install it below.

apt-get install opengroupware.org
apt-get install opengroupware.org-misc-tools
apt-get install libapache2-mod-ngobjweb

Check your /etc/postgresql/postgresql.conf file to check to see if you have the following line:

tcpip_socket = true

If not, add it. If it's set to false, set it to true.

Edit your /etc/postgresql/pg_hba.conf file and make sure the last two lines look like this:

host all all 127.0.0.1 255.255.255.255 trust
host all all 0.0.0.0 255.255.255.255 reject

If you later have database connection problems (you'll know that and not something else is the problem because when you connect to http://servername/OpenGroupware it will tell you it cannot connect to the database, and what username/password it's using to try (I know, how nice and secure, eh?) Anyway, you can go look in the /var/log/postgresql/postgres.log. It's not a bad idea to tail -f /var/log/postgresql/postgres.log if you have an xterm or virtual console free; do this before you even start any daemons. It will tell you if database logins succeed or fail, or if there are malformed config files (pg_hba.conf is the most likely candidate) that prevent the daemon from operating correctly.

Start (/etc/init.d/postgresql start) or restart (/etc/init.d/postgresql restart) the postgresql daemon (postmaster) any time you have changed any postgresql config files.

If the install didn't create your database instance, it's pretty simple, and can be done pretty much like in the documentation. If you're having problems connecting to the database at any point, add "-h localhost" to the command you're using, whether it's psql, createdb, or whatever. This makes you connect to the database on the local system through network (sockets) instead of named pipes.

Become postgres:

$ su - postgres

or

$ sudo su - postgres

Create the database:

$ createdb ogo

Create the database user:

$ createuser -A -D ogo

Stop being user "postgres"

$ exit

Create database schema on db "ogo": Become ogo

$ su - ogo

Or:

$ sudo su - ogo

Insert the schema information into the database:

$ cd /usr/lib/opengroupware.org-1.1/commands/OGo.model/Resources/
$ psql ogo -U ogo

Or, if you get connection errors there, you can try psql ogo -h localhost -U ogo. psql will print some messages and give you a prompt.

ogo=> \i pg-build-schema.psql

(Some output)

ogo=> \q

You can use any means you want to create the user and database, including using the official admin tools. If you want to stick with using "trust" authentication for postgres, you shouldn't even need a password for connecting to the database: just leave it blank when we put it in, later. I used a password, so I also set a password on the ogo user. This is done in psql; log in to postgres using psql as a superuser (like "postgres") and do alter user ogo with password '<em>foo</em>' (note semicolon) in order to set a plain text password on the user. You can also use md5 or crypt passwords; see the postgresql documentation for more information.

Now, the documentation that I linked above tells you how to modify your apache configs, but that's not necessary if you install the proper packages. Just "include" the file /etc/opengroupware.org/apache-resources-1.1 into your apache config someplace. This is done automatically on debian sarge with OGo 1.1 by creating a symlink from this file in the directory /etc/apache2/conf.d. You also must enable the "rewrite" and "include" modules. With debian sarge, this is done by moving the "include.load" and "rewrite.load" files from /etc/apache2/mods-available to /etc/apache2/mods-enabled. /etc/opengroupware.org/ogo/mod_ngobjweb.conf is also linked here.

Restart apache or reload its configuration when you are done.

sudo /etc/init.d/apache2 restart

Or

sudo /etc/init.d/apache2 reload

There is a problem with the /etc/init.d/opengroupware.org control script. The start-stop-daemon program that handles tracking daemon processes in debian is in the /sbin directory, but that's not necessarily in the path. I fixed this by adding the following line to this file, right after the other variable definitions:

PATH=$PATH:/sbin:/usr/sbin

It will work if it is placed anywhere after the first line in the script, and before the first time the words "stop-start-daemon" appears, provided you do not put it inside of a function definition. If you are seriously worried about where it goes, move the second line down, and put it in the space.

Now comes setting the defaults. This section may be retained verbatim from the linked installation instructions.

$ sudo su - ogo
$ Defaults write NSGlobalDomain LSAdaptor PostgreSQL
$ Defaults write NSGlobalDomain LSConnectionDictionary '{databaseName = ogo; hostName = localhost; password = ""; port = 5432; userName = ogo}'
$ Defaults write NSGlobalDomain NGBundlePath /usr/lib/opengroupware.org-1.1/
$ Defaults write NSGlobalDomain LSAttachmentPath /var/lib/opengroupware.org/documents/

Now some explanation. Assuming you haven't changed any defaults, or set a password on the database user "ogo", the above will work just fine. If you have used a different username for the database user, or a different database (maybe you've got multiple instances on the same system for some reason) then you'll need to change something. If you have changed something, then I'm not helping you, because you should be able to figure it out. If not, then this should work, and if it doesn't, tell me.

Once you've made all of these changes, you can start OGo:

sudo /etc/init.d/opengroupware.org start

And everything should work.

Well, everything didn't work the first time I did this, but I didn't do it precisely in that order, and bounced back and forth for a while trying to figure out how to make things work properly. This led me to find this helpful note on starting services in the proper order. Short form: Start apache first, then postgres, then OGo. Failure to do this may result in your getting "500" errors when attempting to use OGo.

I hope this helps, because OGo pretty well kicked my ass for two days while I was trying to get SOME version of it to work, SOMEHOW. This was how.

Add new comment