Install

From CKAN

Jump to: navigation, search

This page is for sharing experiences of installing CKAN on different platforms.

Contents

Ubuntu Lucid (10.04 LTS)

This is the main platform, for which OKF provides free support on at ckan-dev. Users should use this platform if possible.

Ubuntu >10.04

Fedora (Red Hat)

Amazon EC2

OSX (Apple Mac)

OS X 10.7 Lion, Source Install

This is based on the source install instructions for Ubuntu 10.04

1. Install Homebrew. Homebrew is a free third-party package manager for OS X that installs software packages into /usr/local. We'll use Homebrew to install some of CKAN's dependencies.

2. Install some CKAN dependencies:

If you're getting "could not connect to server: Permission denied" errors when running psql commands, this may be because the version of PostgreSQL that ships preinstalled on OS X Lion is getting in the way of the version you have installed. You can get around this problem by editing your PATH. Here are some links:
Before Lion OS X didn't ship with PostgreSQL preinstalled.

3. Follow the Ubuntu source install instructions to create a Python virtual environment, activate it, install the CKAN source code into it, and then install the additional CKAN dependencies. Just skip the sudo apt-get install ... commands and let the pip install ... commands that follow handle installing those dependencies (unfortunately installing the dependencies this way takes quite a long time, and you have to do it every time you create a new virtual environment for CKAN). Summary:

cd ~ virtualenv pyenv
. pyenv/bin/activate
pip install --ignore-installed -e 'git+https://github.com/okfn/ckan.git#egg=ckan'
pip install --ignore-installed -r pyenv/src/ckan/requires/lucid_missing.txt -r pyenv/src/ckan/requires/lucid_conflict.txt
pip install webob==1.0.8 
pip install --ignore-installed -r pyenv/src/ckan/requires/lucid_present.txt
deactivate
. pyenv/bin/activate

4. Follow the Ubuntu source install instructions to setup a PostgreSQL database. The only difference was that when I installed PostgreSQL with Homebrew it configured postgres to run under my user account instead of under a 'postgres' user, so I had to remove the sudo -u postgres from the front of each postgres command.

5. Follow the Ubuntu source install instructions to create a CKAN config file.

6. Install Jetty and start it:

brew install jetty
/usr/local/Cellar/jetty/6.1.26/libexec/bin/jetty.sh start

Then open http://127.0.0.1:8080/ in a web browser to check that Jetty's working. To stop Jetty do /usr/local/Cellar/jetty/6.1.26/libexec/bin/jetty.sh stop

TODO How to make Jetty start automatically?

7. Install, configure and start Solr.

brew install solr

You need to switch to the older version of Solr (1.4.1) that CKAN uses (1.4.1 is the nearest still available version of solr to the version provided with Ubuntu 10.04). brew versions solr should print out a list of available Solr versions and the commands for switching to them:

~> brew versions solr
3.5.0    git checkout 6259d05 /usr/local/Library/Formula/solr.rb
3.4.0    git checkout da53d68 /usr/local/Library/Formula/solr.rb
3.3.0    git checkout 14e4db3 /usr/local/Library/Formula/solr.rb
3.1.0    git checkout 1fb85ef /usr/local/Library/Formula/solr.rb
1.4.1    git checkout 0476235 /usr/local/Library/Formula/solr.rb
1.4.0    git checkout eb32026 /usr/local/Library/Formula/solr.rb
1.3.0    git checkout 8db9aaa /usr/local/Library/Formula/solr.rb

Switch to version 1.4.1, you have to cd into the Formula dir first:

$ cd /usr/local/Library/Formula
$ git checkout 0476235 /usr/local/Library/Formula/solr.rb

Now brew info solr should tell you that you have version 1.4.1.

Now you need to set solr's schema.xml file:

cd /usr/local/Cellar/solr/1.4.1/libexec/example
sudo mv solr/conf/schema.xml solr/conf/schema.xml.backup
sudo ln -s ~/pyenv/src/ckan/ckan/config/solr/schema-1.4.xml solr/conf/schema.xml
/usr/local/Cellar/jetty/6.1.26/libexec/bin/jetty.sh restart
java -jar start.jar

Then open http://127.0.0.1:8983/solr/ in a web browser to check that Solr's working.

TODO How to make Solr start automatically?

The Ubuntu instructions talk about editing an /etc/default/jetty file, I skipped that part and didn't seem to have any problems.

8. Follow the Ubuntu source install instructions to create the database tables and the cache and session directories, in short:

paster --plugin=ckan db init 
mkdir data sstore

9. Load some test data into CKAN:

paster create-test-data

10. Start CKAN:

paster serve development.ini

Then open http://127.0.0.1:5000/ in a web browser to check that CKAN is working.

11. Follow the Testing for Developers instructions from the CKAN admin guide to run the sqlite and then the postgresql tests to check that everything is working. In short, make sure your virtual environment is activated and then do:

pip install ckanclient
nosetests --ckan
nosetests --ckan --with-pylons=test-core.ini

Windows

Windows/OS X/Linux Source Install using Vagrant/VirtualBox

You can install CKAN in a virtual machine using Vagrant, a tool for managing virtual machines using Oracle's VirtualBox.

1. Install VirtualBox and Vagrant on your system, following the instructions on the Vagrant website.

2. Use vagrant to create an Ubuntu 10.04 virtual machine, boot it up, and ssh into it:

host> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
host> mkdir my_vagrant_box
host> cd my_vagrant_box
host> vagrant init lucid32
host> vagrant up
host> vagrant ssh
vagrant@lucid32:~$

3. Inside your virtual machine, install the latest Ubuntu updates and install PostgreSQL:

vagrant@lucid32:~$ sudo aptitude update
vagrant@lucid32:~$ sudo aptitude upgrade
vagrant@lucid32:~$ sudo aptitude install postgresql

4. Create a postgresql database cluster and check that you can connect to postgresql and list your databases:

vagrant@lucid32:~$ sudo pg_createcluster 8.4 main --start
vagrant@lucid32:~$ sudo su
vagrant@lucid32:~$ sudo -u postgres psql -l

You should see something like this:

                                  List of databases
   Name    |  Owner   | Encoding |  Collation  |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                             : postgres=CTc/postgres
(3 rows)

4b. If you get an initdb: encoding mismatch error from the pg_createcluster command, then you need to fix your virtual machine's broken locale settings (thanks, Crowd Interactive Tech Blog):

Edit the system bashrc file (sudo nano /etc/bash.bashrc), add these lines to the bottom of the file:

# Add these lines to the bottom of the file:
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Save the file and exit your text editor, then do:

vagrant@lucid32> sudo locale-gen en_US.UTF-8
vagrant@lucid32> sudo dpkg-reconfigure locales

Then disconnect from your virtual machine (ctrl-d) and connect to it again (vagrant ssh). You should now be able to create the databse successfully.

5. Follow the Ubuntu 10.04 Source Install Instructions in your virtual box.

6. If you're running CKAN in your virtual machine and you want to visit the CKAN web interface using the web browser on your host machine, then you'll have to setup port forwarding. Follow the port forwarding instructions on the Vagrant website.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox