How to install CKAN dev v2.6 on Fedora 24

Rick Leir edited this page Oct 20, 2016 · 25 revisions
Clone this wiki locally

Note

This manual procedure needs to be more automated.

Distro

Start with a fresh install of the Fedora 24 Workstation distribution. If you installed the server version, or Fedora 23, there could be minor differences.

Java

The default Java is:

$ alternatives --display java
java - status is auto.
link currently points to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-7.b14.fc24.x86_64/jre/bin/java
$ java -version
openjdk version "1.8.0_91"

Python

The default python is:

# python --version
Python 2.7.11

We also need:

# dnf install python2-virtualenv postgresql-server postgresql-devel redhat-rpm-config
...
Installed:
  python-devel.x86_64 2.7.11-4.fc24 python-rpm-macros.noarch 3-7.fc24 python2-rpm-macros.noarch 3-7.fc24 python2-virtualenv.noarch 14.0.6-1.fc24 postgresql.x86_64 9.5.4-1.fc24 postgresql-server.x86_64 9.5.4-1.fc24 postgresql-devel.x86_64 9.5.4-1.fc24 postgresql-libs.x86_64 9.5.4-1.fc24 python-srpm-macros.noarch 3-7.fc24 redhat-rpm-config.noarch 41-2.fc24 ...

SELinux

For now, let's use permissive mode.

# setenforce Permissive
# getenforce
Permissive

Install for dev and testing

(adapted from http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html and https://github.com/ckan/ckan/wiki/How-to-install-CKAN-2.x-on-CentOS-7)

If you’re installing CKAN for development and want it to be installed in your home directory, you can symlink the directories used in this documentation to your home directory. This way, you can copy-paste the example commands from this documentation without having to modify them, and still have CKAN installed in your home directory:

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

Create a Python virtual environment (virtualenv) to install CKAN into, and activate it:

$ mkdir -p /usr/lib/ckan/default
$ virtualenv --no-site-packages /usr/lib/ckan/default
New python executable in /usr/lib/ckan/default/bin/python2
Also creating executable in /usr/lib/ckan/default/bin/python
Installing setuptools, pip, wheel...done.

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

Clone the project. Because of the above 'ln -s' commands, this is all cloned into ~/myckan/lib/default/src/ckan/

(default) $ pip install -e 'git+https://github.com/ckan/ckan.git@dev-v2.6#egg=ckan'
Obtaining ckan from git+https://github.com/ckan/ckan.git@dev-v2.6#egg=ckan
  Updating /usr/lib/ckan/default/src/ckan clone (to dev-v2.6)
Installing collected packages: ckan
  Running setup.py develop for ckan
Successfully installed ckan

(default) $

Install some prereqs:

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

Configure PostgreSQL

Initialize the PostgreSQL database

# postgresql-setup --initdb --unit postgresql

Edit /var/lib/pgsql/data/pg_hba.conf so it will accept passwords for login while still allowing the local postgres user to manage via ident login. The relevant changes to pg_hba.conf are as follows:

local   all         postgres                          ident
local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

Enable PostgreSQL to start on system boot

# systemctl enable postgresql.service
# systemctl start  postgresql.service
# systemctl status postgresql.service

Next you’ll need to create a database user if one doesn’t already exist. Create a new PostgreSQL database user called ckan_default, and enter a password for the user when prompted. You’ll need this password later:

# su - postgres -c 'createuser -S -D -R -P ckan_default'

Create a new PostgreSQL database, called ckan_default, owned by the database user you just created:

# su - postgres -c 'createdb -O ckan_default ckan_default -E utf-8'
# su - postgres -c 'psql -l'

CKAN Configuration

Create a CKAN config file:

(default) $ mkdir -p /etc/ckan/default
(default) $ cd /usr/lib/ckan/default/src/ckan
(default) $ paster make-config ckan /etc/ckan/default/development.ini
Distribution already installed:
  ckan 2.6.0b0 from /home/rleir/myckan/lib/default/src/ckan
Creating /etc/ckan/default
Creating /etc/ckan/default/development.ini
Now you should edit the config files
  /etc/ckan/default/development.ini
(default) $ 

Edit the development.ini config file in a text editor, replacing 'pass' with the db password from above:

sqlalchemy.url = postgresql://ckan_default:pass@localhost/ckan_default

In the same file, append the core name 'ckan' to the Solr URL:

solr_url = http://127.0.0.1:8080/solr/ckan

More RSN