Installing CKAN 2.2.1 on Mac OS X 10.10.1

anonoz edited this page May 23, 2017 · 5 revisions

This is based on the install instructions from

  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 mercurial told me to install Mercurial using pip install mercurial or sudo easy_install pip, but those were crashing for me so I downloaded the latest package for OS X form the Mercurial website and installed it that way instead. It seems to have installed Mercurial to /Library/Python/2.7/site-packages/mercurial.

    python-virtualenv This isn't in Homebrew so you installed it using pip: pip install virtualenv.

    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 git or using the OS X package from the Git website.

    svn Install it with brew install svn

    libxml2-dev, libxslt-dev, python-dev, libpq, openjdk-6-jdk These come preinstalled on OS X.

    Info: Manual installation the PostgreSQL, Solr, Jetty(or Tomcat)

  3. Install CKAN into a Python virtual enviroment.

    Recommend the official documents

    mkdir -p ~/ckan/lib
    sudo ln -s ~/ckan/lib /usr/lib/ckan
    mkdir -p ~/ckan/etc
    sudo ln -s ~/ckan/etc /etc/ckan

    a. Create a Python virtual environment to install CKAN into, and activate it:

    sudo mkdir -p /usr/lib/ckan/default
    sudo chown `whoami` /usr/lib/ckan/default
    virtualenv --no-site-packages /usr/lib/ckan/default
    . /usr/lib/ckan/default/bin/activate

    Important: activate virtualenv

    . /usr/lib/ckan/default/bin/activate
    (default) $ _

    b. Install the CKAN source code into your virtualenv. To install the latest stable release of CKAN(2.2.1), run:

    (default):pip install -e 'git+'

    c. Install postgresql using:

    (default):brew update (default):brew install postgresql

    d. Install the Python modules that CKAN requires into your virtualenv:

    Changed in version 2.1: In CKAN 2.0 and earlier the requirement file was called pip-requirements.txt not requirements.txt as below.

    (default): pip install -r /usr/lib/ckan/default/src/ckan/requirements.txt

    e. Deactivate and reactivate your virtualenv, to make sure you’re using the virtualenv’s copies of commands like paster rather than any system-wide installed copies:

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

  4. Manual installation the PostgreSQL.

    a. Download PostgreSQL for Mac OS X.

    b. Unzip the file, and install the PostgreSQL. You should remember the installation path and postgres password.

    c. Starting PostgreSQL on Mac OS X: -- important

    sudo su postgres
    pg_ctl start
    [or] pg_ctl -D /Library/Postgresql/9.3/data start|stop|restart|status

    Check the server is running:

    lsof -i:5432

    TODO How to make PostgreSQL automatically?

  5. Setup a PostgreSQL database: See the Official Document(step 3)

    List existing databases:

    (default):sudo -u postgres psql -l

    a. Create a database user.

    (default):sudo -u postgres createuser -S -D -R -P ckan_default

    b. Create a new PostgreSQL database.

    (default):sudo -u postgres createdb -O ckan_default ckan_default -E utf-8

    It's OK.

  6. Create a CKAN config file

    Create a directory to contain the site's config files:

    (default):sudo mkdir -p /etc/ckan/default
    (default):sudo chown -R 'whoami' /etc/ckan/

    Change to the ckan directory and create a CKAN config file:

    (default): cd /usr/lib/ckan/default/src/ckan
    (default): paster make-config ckan /etc/ckan/default/development.ini

    Edit the development.ini

    vi /etc/ckan/default/development.ini
    sqlalchemy.url = postgresql://ckan_default:<pass>@localhost/ckan_default

  7. Create database tables

    (default): cd /usr/lib/ckan/default/src/ckan
    (default): paster db init -c /etc/ckan/default/development.ini

    You should see Initialising DB: SUCCESS

  8. Link to who.ini

    (default): ln -s /usr/lib/ckan/default/src/ckan/who.ini /etc/ckan/default/who.ini

  9. Install, configure and start Solr:

    (default): brew tap homebrew/versions
    (default): brew install solr14
    (default): brew untap homebrew/versions

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

    (default):cd /usr/local/Cellar/solr14/1.4.1/libexec/example
    (default):sudo mv solr/conf/schema.xml solr/conf/schema.xml.backup
    (default):sudo ln -s /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml solr/conf/schema.xml

  10. Install Tomcat(Using it replace Jetty)

    If you are familiar with solr-jetty configuration, recommend use the Jetty.

    a. Download Apache Tomcat(apache-tomcat-7.0.56.tar.gz)

    tar -zxvf apache-tomcat-7.0.56.tar.gz
    mv apache-tomcat-7.0.56/ /usr/local/apache-tomcat(your path)

    b. Configure Apache Tomcat:

    1. Copy solr.war to tomcat webapps/ directory:

    (default):sudo cp /usr/local/Cellar/solr14/1.4.1/libexec/example/webapps/solr.war /usr/local/apache-tomcat/webapps/solr.war

    1. To start apache-tomcat:


    1. To stop apache-tomcat:


    1. Configure:

    cd /usr/local/apache-tomcat/webapps/solr/WEB-INF
    vi web.xml

    1. Add the following code:


    Warning: the env-entry-value is solr related configuration and index. (e.g. schema.xml)

    1. Set the apache-tomcat port(default: 8080): -- (optional)

    cd /usr/local/apache-tomcat/conf
    vi server.xml

    <Connector port="8983" protocol="HTTP/1.1" -- set:8983
    redirectPort="8443" />

    1. Running Apache Tomcat:


    Open in a web browser, it does work.

  11. You're done!

    (default):cd /usr/lib/ckan/default/src/ckan
    (default):paster serve /etc/ckan/default/development.ini

    Open in a web browser, and you should see the CKAN front page.


Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.