Building FOAM

Building FOAM on CentOS 6.2

FOAM is written in python, requires Python 2.6.x, NGINX (an http server) and a number of Python packages.

Install initial prerequisites

$ sudo yum install nginx 
$ sudo easy_install pip

Download the source code and build (you have to use Mercurial client - downloading a zip file from github will not set the version properly, so getVersion will return garbage):

$ hg clone
$ cd onlab-foam-xxxx
$ sudo python 

If dependency tracking by pip fails as part of FOAM install, can be installed manually:

$ sudo easy_install "Flask==0.7.2"
$ sudo easy_install "SQLAlchemy==0.7.4"
$ sudo easy_install Flask-XML-RPC
$ sudo easy_install "Blinker==1.1"
$ sudo easu_install lxml
#ElementTree 1.2.7 has to be installed from source
#unzip, then sudo python install
#Flup can be installed by easy_install via egg

Continuing after foam install (note: installs under /opt/foam).

FOAM install fails to install M2Crypto, could not get it from EPEL and easy_install fails due to differences in openssl-devel configuration so get the source, untar and run ./ install from within the tar file:

$ chmod +x
$ ./ install

Change the permissions on the /opt/foam///. Note that FOAM uses www-data user under Debian (which is what nginx runs under) however on CentOS nginx runs under user nginx:

$ sudo chown -R nginx /opt/foam

Configure foam (Note that foamctl is installed under /usr/bin)

$sudo -u nginx foamctl init-db
$ sudo foamctl set-password

Create a self-signed cert for foam and configure /etc/nginx/sites-available/foam.conf (the default fails to do that). Note that nginx under CentOS does not use sites-available/, instead using conf.d:

$ sudo vi /etc/nginx/sites-available/foam.conf
$ cd /etc/nginx/conf
$ sudo ln -s ../sites-available/foam.conf

Download and bundle certs

$ sudo wget -O /opt/foam/etc/gcf-ca-certs/
$ sudo foamctl bundle-certs


$ /etc/init.d/nginx restart

Start FOAM (needs a custom start script because CentOS does not have start-stop-daemon which can put foam in the background; default centos daemon() function does not have the background option). The CentOS foam start script is attached to this page.

$ /etc/init.d/foam start