How to set up Pentabarf Conferencing System with Apache and FCGID on Ubuntu

By webmaster | 14th July 2008 | 5 min read
We had recently been involved in a project to set up a Conference Management System for an International Conference to be conducted in Kerala sometime later this year. We had zeroed in on Pentabarf as the solution we were going to base the system on. Pentabarf is a Ruby on Rails solution that has been used for the last couple of DebConfs. Pentabarf as such is an excellent system, being a system created by programmers for programmers, but it heavily lacked in documentation both on their site and on the world wide web. We however managed to get it installed on Ubuntu with Apache, Ruby on Rails and FastCGI. We are sharing the installation instructions for Pentabarf on Ubuntu here

First we have to install all the relevant packages that are available in Ubuntu.
sudo apt-get install apache2
sudo apt-get install postgresql pgadmin3 ruby 
sudo apt-get install postgresql-contrib
sudo apt-get install imagemagick
sudo apt-get install libpq5 libpq-dev
sudo apt-get install shared-mime-info
sudo apt-get install libxmpp4r-ruby
sudo apt-get install rubygems
sudo gem install rails
sudo gem install xmpp4r
sudo apt-get install ruby1.8-dev
sudo apt-get install libmagick-dev
sudo gem install rmagick

This was failing. So went ahead and removed the following The following error was observed - "Can't install rmagick rmagick-2.5.1. Can't find MagickCore.h" Was also getting the following error initially "Can't find Magick-config or GraphicsMagick-config program."
sudo apt-get remove --purge librmagick-ruby-doc librmagick-ruby1.8
sudo apt-get remove graphicsmagick-libmagick-dev-compat

And installed the following
sudo apt-get install libmagick9-dev ruby1.8-dev
sudo gem install ruby-postgres

This was giving the following error
postgres.c:31: error: conflicting types for ‘pg_encoding_to_char’
/usr/include/postgresql/libpq-fe.h:518: error: previous declaration of ‘pg_encoding_to_char’ was here
postgres.c: In function ‘pgconn_s_escape_bytea’:
postgres.c:370: warning: pointer targets in passing argument 1 of ‘PQescapeBytea’ differ in signedness
postgres.c: In function ‘pgconn_s_unescape_bytea’:
postgres.c:401: warning: pointer targets in passing argument 1 of ‘PQunescapeBytea’ differ in signedness
make: *** [postgres.o] Error 1

To fix this open /usr/include/postgresql/libpq-fe.h replace
extern  const char *pg_encoding_to_char(int encoding);)
in line 518 with
extern  char *pg_encoding_to_char(int encoding);)
and rerun the command to install the gem
sudo gem install momomoto
sudo gem install shared-mime-info
sudo gem install icalendar
sudo gem install BlueCloth

Download the latest release of pentabarf from the URL given on the site. We used
svn co svn://

To start off, we need to change the PostgreSQL postgres user password, we will not be able to access the server otherwise. As the “postgres” Linux user, we will execute the psql command, in a terminal type:
sudo -u postgres psql template1

Then at the new prompt, type these two commands, replacing 'yourpassword' with the new password
ALTER USER postgres WITH PASSWORD 'yourpassword'; 
Then run the following to create the database
sudo -u postgres createdb pentabarf
sudo -u postgres PGDATABASE=pentabarf createlang plpgsql

cd <path to 0.3.13>/sql
sudo -u postgres PGDATABASE=pentabarf make install

Make sure that there were no errors during installation by checking the messages

Go edit /etc/postgresql/8.3/main/postgresql.conf
sudo gedit /etc/postgresql/8.3/main/postgresql.conf

Goto the variable custom_variable_classes and then set its value to

Also make sure to uncomment the line. Now restart pgsql by running
sudo /etc/init.d/postgresql-8.3 restart

If you don't set this the next command will fail with the following error "unrecognized configuration parameter "pentabarf.transaction_id""
sudo -u postgres PGDATABASE=pentabarf make import

Make sure that there were no errors by checking the install.log file created in the same folder
sudo -u postgres PGDATABASE=pentabarf make user

Make sure that there were no errors by checking the install.log file created in the same folder

Install pgcrypto in the pentabarf database. The path might be slightly differently depending on your operating system/distribution.
sudo -u postgres PGDATABASE=pentabarf psql < /usr/share/postgresql/8.3/contrib/pgcrypto.sql

Install the script provided with momomoto by using the following
sudo -u postgres PGDATABASE=pentabarf psql < /var/lib/gems/1.8/gems/momomoto-0.1.17/sql/install.sql

Goto <path to 0.3.13>/rails/config and copy database.yml.template and rename as database.yml Edit the database connection settings for the databases. The default system settings is for production

Set up fast-cgi which is the suggested method for running pentabarf
sudo apt-get install libapache2-mod-fcgid libfcgi-ruby1.8
sudo a2enmod fcgid

Now create a virtual host by editing httpd.conf. In our case we created it in the root by adding the following to /etc/apache2/httpd.conf
<VirtualHost *>
ServerName localhost
DocumentRoot /home/user/public_html/pentabarf/public/

<Directory /home/user/public_html/pentabarf/public/>
  AllowOverride All
  Order allow,deny
  allow from all


The AllowOverride option allows you to change settings using .htaccess Open .htaccess (copy and rename the htaccess.txt provided in the public folder) and add the following lines
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

Also make sure that rewrite base is pointing to the path to the virtualhost from the webhost root eg:
RewriteBase /

for the virtual host set up as shown above in the httpd.conf example.

Now comment the line
#RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
and add the following
RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]

This will allow the pass through of HTTP Authentication through http headers. This hack is required since Apache does not allow for the pass through of HTTP authentication to fcgid scripts.

The only rewrite condition and rule set required is
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]

You can leave the rules and conditions for the symlinked directories commented if you are not using symlinked directories.

Now open <path to 0.3.13>/rails/config/boot.rb and insert the following line at the beginning of the file.
RAILS_ROOT= "/full/path/to/pentabarf/public/folder/till/public/"
Make sure that the above path includes the complete path till the public folder.

These were the steps that we had to follow to get Pentabarf setup on an Apache server with Ruby on Rails and FastCGI. Since the system was not a freshly system it already had some of the required packages and there is a possibility that you will come across additional packages that would be required to get this up and running. If you do so, please post it as a comment so that we can update this information.

If you face problems in setting the solution up post your problems below and we can try to help you with your problems.