Install
From CKAN
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.
- Package install - instructions: http://docs.ckan.org//en/latest/install-from-package.html
- Source install - instructions: http://docs.ckan.org/en/latest/install-from-source.html
Ubuntu >10.04
- David Raznick keeps up to date with Ubuntu releases and runs CKAN having used the source install.
- Mike Dupont followed the source install on Oneiric: http://lists.okfn.org/pipermail/ckan-discuss/2012-February/002021.html
- The only trouble was the SOLR config directory having moved - see the emails.
Fedora (Red Hat)
- Ian Murray installed on Fedora 15 from source
- It has PostgreSQL v9.05 (instead of v8.4) so he needed SQLAlchemy 0.7.3 (and migrate 0.7.3) used which has been introduced the CKAN branch feature-1371-task-status-logic-layer (which should be merged in soon).
- Sheldon Rampton and Paul de Paula installed on Red Hat Enterprise Linux 6. Full instructions are available here.
Amazon EC2
OSX (Apple Mac)
- VirtualBox running Ubuntu - instructions: http://readthedocs.org/docs/ckan/en/latest/install-from-package.html#using-virtualbox
- John Glover had no issues installing natively to OS X 10.6 using instructions to install from source. He installed Postgres by following the instructions in the INSTALL file.
- Tom Rees had a relatively smooth install to OS X 10.7 from source and using the PostgreSQL one-click installer.
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:
- Mercurial
brew search mercurialtold me to install Mercurial usingpiporeasy_install, but those were crashing for me so I downloaded the latest package for OS X from the Mercurial website and installed it that way instead. It seems to have installed Mercurial to/Library/Python/2.7/site-packages/mercurial.
- PostgreSQL People have reported that installing PostgreSQL on OS X from source or using the pre-built binary package from the PostgreSQL website works fine. I chose to install it with homebrew, just do
brew install postgresqland then follow the instructions frombrew info postgresqlto set it up.
- 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.
- python-virtualenv This isn't in Homebrew so I installed it (system-wide) using pip:
sudo pip install virtualenv(you may find that you have to install pip first:sudo easy_install pip).
- wget Install with Homebrew:
brew install wget
- build-essential This is an Ubuntu-specific package that doesn't exist for OS X. On OS X, just make sure you have an up to date version of Xcode installed.
- git You can install git with
brew install gitor using the OS X package from the Git website. I found that I didn't have to because it was already installed on my system. I guess it may have come preinstalled with OS X or may have come with Xcode. - svn I found that I already had this on my system as well, but you could install it with
brew install svn
- libxml2-dev, libxslt-dev Homebrew says that these come preinstalled on OS X.
- python-dev, libpq, openjdk-6-jdk I ignored these and didn't have any problems, I guess they may ship preinstalled on OS X or with Xcode.
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
- David Read has managed to run CKAN on Windows. See his walk-through: CKAN install on 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.