Option 1: Package Installation

This section describes how to install CKAN from packages. This is the recommended and the easiest way to install CKAN, but it requires Ubuntu 12.04 64-bit. If you’re not using Ubuntu 12.04 64-bit, or if you’re installing CKAN for development, you should follow Option 2: Install from Source instead.

If you run into problems, see Common error messages.

1. Install the CKAN Package

On your Ubuntu 12.04 system, open a terminal and run these commands to install CKAN:

  1. Update Ubuntu’s package index:

    sudo apt-get update
  2. Install the Ubuntu packages that CKAN requires:

    sudo apt-get install -y nginx apache2 libapache2-mod-wsgi libpq5
  3. Download the CKAN package:

    wget http://packaging.ckan.org/python-ckan-2.0_amd64.deb

    Note

    If wget is not present, you can install it via:

    sudo apt-get install wget
  4. Install the CKAN package:

    sudo dpkg -i python-ckan-2.0_amd64.deb

Note

If you get the following error it means that for some reason the Apache WSGI module was not enabled:

Syntax error on line 1 of /etc/apache2/sites-enabled/ckan_default:
Invalid command 'WSGISocketPrefix', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!

You can enable it by running these commands in a terminal:

sudo a2enmod wsgi
sudo service apache2 restart

2. Install PostgreSQL and Solr

Tip

You can install PostgreSQL, Solr and CKAN on different servers. Just change the sqlalchemy.url and solr_url settings in your /etc/ckan/default/production.ini file to reference your PostgreSQL and Solr servers.

  1. Install PostgreSQL and Solr, run this command in a terminal:

    sudo apt-get install -y postgresql solr-jetty

    The install will whirr away, then towards the end you’ll see this:

    * Not starting jetty - edit /etc/default/jetty and change NO_START to be 0 (or comment it out).
  2. Follow the instructions in Single Solr instance or Multiple Solr cores to setup Solr.

  3. Follow the instructions in 3. Setup a PostgreSQL database to setup PostgreSQL, then edit the sqlalchemy.url option in your /etc/ckan/default/production.ini file and set the correct password, database and database user.

  4. Initialize your CKAN database by running this command in a terminal:

    sudo ckan db init
  5. Optionally, setup the DataStore by following the instructions in Setting up the DataStore.

  6. Also optionally, you can enable file uploads by following the instructions in FileStore and File Uploads.

3. You’re done!

Open http://localhost in your web browser. You should see the CKAN front page, which will look something like this:

_images/9.png

You can now proceed to Post-Installation Setup.

Upgrading to CKAN 2.0

Note

If you want to upgrade to a 1.X version of CKAN rather than to CKAN 2.0, see the documentation relevant to the old CKAN packaging system.

The CKAN 2.0 package requires Ubuntu 12.04 64-bit, whereas previous CKAN packages used Ubuntu 10.04. CKAN 2.0 also introduces many backwards-incompatible feature changes (see the changelog). So it’s not possible to automatically upgrade to a CKAN 2.0 package install.

However, you can install CKAN 2.0 (either on the same server that contained your CKAN 1.x site, or on a different machine) and then manually migrate your database and any custom configuration, extensions or templates to your new CKAN 2.0 site. We will outline the main steps for migrating below.

  1. Create a dump of your CKAN 1.x database:

    sudo -u ckanstd /var/lib/ckan/std/pyenv/bin/paster --plugin=ckan db dump db-1.x.dump --config=/etc/ckan/std/std.ini
  2. If you want to install CKAN 2.0 on the same server that your CKAN 1.x site was on, uninstall the CKAN 1.x package first:

    sudo apt-get autoremove ckan
  3. Install CKAN 2.0, either from a package install if you have Ubuntu 12.04 64-bit, or from a source install otherwise.

  4. Load your database dump from CKAN 1.x into CKAN 2.0. This will migrate all of your datasets, resources, groups, tags, user accounts, and other data to CKAN 2.0. Your database schema will be automatically upgraded, and your search index rebuilt.

    First, activate your CKAN virtual environment and change to the ckan dir:

    . /usr/lib/ckan/default/bin/activate
    cd /usr/lib/ckan/default/src/ckan
    

    Now, load your database. This will delete any data already present in your new CKAN 2.0 database. If you’ve installed CKAN 2.0 on a different machine from 1.x, first copy the database dump file to that machine. Then run these commands:

    paster db clean -c /etc/ckan/default/production.ini
    paster db load -c /etc/ckan/default/production.ini db-1.x.dump
    
  5. If you had any custom config settings in your CKAN 1.x instance that you want to copy across to your CKAN 2.0 instance, then update your CKAN 2.0 /etc/ckan/default/production.ini file with these config settings. Note that not all CKAN 1.x config settings are still supported in CKAN 2.0, see Config File Options for details.

    In particular, CKAN 2.0 introduces an entirely new authorization system and any custom authorization settings you had in CKAN 1.x will have to be reconsidered for CKAN 2.0. See Authorization for details.

  6. If you had any extensions installed in your CKAN 1.x instance that you also want to use with your CKAN 2.0 instance, install those extensions in CKAN 2.0. Not all CKAN 1.x extensions are compatible with CKAN 2.0. Check each extension’s documentation for CKAN 2.0 compatibility and install instructions.

  7. If you had any custom templates in your CKAN 1.x instance, these will need to be adapted before they can be used with CKAN 2.0. CKAN 2.0 introduces an entirely new template system based on Jinja2 rather than on Genshi. See Theming and Customizing Appearance for details.