How to Install CKAN 2.0 on SLES 11 SP2 in an offline environment

Stefan Wehrmeyer edited this page May 17, 2013 · 3 revisions
Clone this wiki locally

This guide will explain how to install CKAN on SLES 11 SP2. Additional challenge: no internet access.

Deployment goal

Apache will serve CKAN via WSGI. CKAN will run with Python 2.6 and connect to a PostgreSQL Server 9.1. A Tomcat 6 server will host a Solr 3.6 for search. The installation of PostgreSQL server will not be covered by this document.

Required packages SLES 11 SP2

Install the following packages from the standard SLES repository: apache, tomcat6, python, libpq5, gcc.

We also need packages from the SLES SDK repository: postgresql-devel and python-devel.

Additionally we need the mod_wsgi module for Apache. This is not available from the SLES repositories. Download and install the RPM from the SuSE RPM index.

Create a database for CKAN

Become the postgres user. su - postgres Create a PostgreSQL database user named ckanuser with a password of pass. $ createuser -S -D -R -P ckanuser Create a PostgreSQL database named ckantest with ckanuser as the owner. $ createdb -O ckanuser ckantest Exit the postgres user environment. $ exit

Install CKAN

In order to install CKAN in an offline environment you will first need to collect all required packages on a machine with internet access.

On the machine with an existing Python installation and internet access, download and unpack virtualenv and build a bootstrapping environment

wget "http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz"
tar -xvf virtualenv-1.9.1.tar.gz
cd virtualenv-1.9.1
python virtualenv.py --no-site-packages --distribute base
source base/bin/activate

Now you can download the dependency list, create a testing environment and then use this to archive the required packages to a directory packages

wget "https://raw.github.com/okfn/ckan/ckan-2.0/pip-requirements.txt"
# Replace editable dependency with released dependency
sed "s_-e git+https://github.com/okfn/vdm.git@vdm-0.11#egg=vdm_vdm==0.11_" pip-requirements.txt > requirements.txt
mkdir -p packages
pip install -r requirements.txt
pip freeze > all-pip-requirements.txt
pip install --download packages -r all-pip-requirements.txt

You have to make sure that the all-pip-requirements.txt file does not contain editable resources (startin with -e).

Zip the packages directory and move it, the virtualenv-1.9.1.tar.gz and the CKAN 2.0 release to your offline target machine.

Extract the virtualenv and setup a new virtual environment

tar -xvf virtualenv-1.9.1.tar.gz
python virtualenv.py --no-site-packages --distribute ckanenv
source ckanenv/bin/activate

Extract ckan-2.0.zip to a ckan directory and extract the packages zip file to a packages directory. Then again apply a small change to the dependency file of CKAN to make if offline installable.

sed "s_-e git+https://github.com/okfn/vdm.git@vdm-0.11#egg=vdm_vdm==0.11_" ckan/pip-requirements.txt > requirements.txt

Then install the dependencies of the requirements file while pointing to the packages directory:

pip install -r requirements.txt --no-index --find-links=packages

Go to the ckan directory and execute

python setup.py develop

Now your virtualenv is containing a complete CKAN installation with dependencies.

You can continue with the usual installation steps.