CKAN Wheezy install

CKAN|CKAN

Install CKAN on GNU/Debian Wheezy


 * http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html

Install the required packages
Package: python-dev Version: 2.7.3-4+deb7u1

Package: postgresql Version: 9.1+134wheezy4

Package: libpq-dev Version: 9.1.12-0wheezy1

Package: python-pip Version: 1.1-3

Package: python-virtualenv Version: 1.7.1.2-2

Package: git-core Version: 1:1.7.10.4-1+wheezy1

Package: openjdk-6-jdk Version: 6b27-1.12.6-1~deb7u1

Package: solr-jetty Version: 3.6.2+dfsg-2 Depends: jetty (>= 6.1.22), libjetty-extra-java (>= 6.1.22), solr-common (=3.6.2+dfsg-2), default-jdk | java5-sdk

Edit the development.ini file (/etc/ckan/default/development.ini)
sqlalchemy.url = postgresql://ckan_default:pass@localhost/ckan_default ckan.site_id = default

Edit the Jetty configuration file (/etc/default/jetty)
NO_START=0 JETTY_HOST=127.0.0.1 JETTY_PORT=8983

Check the welcome page from Solr (http://localhost:8983/solr/)
If you get an:

HTTP ERROR 500 Problem accessing /solr/. Reason org/apache/tomcat/util/descriptor/LocalResolver

Downgrade libtomcat6-java due to a bug in 6.0.39-1 version


 * http://comments.gmane.org/gmane.linux.debian.packages.java.devel/40818

Change the solr_url setting in your CKAN config file (/etc/ckan/default/development.ini)
solr_url=http://127.0.0.1:8983/solr

Add the datastore plugin to your CKAN config file
ckan.plugins = datastore

Uncomment the ckan.datastore.write_url and ckan.datastore.read_url lines in your CKAN config file
ckan.datastore.write_url = postgresql://ckan_default:pass@localhost/datastore_default ckan.datastore.read_url = postgresql://datastore_default:pass@localhost/datastore_default

Testing CKAN

 * http://docs.ckan.org/en/latest/contributing/test.html

Set up the test databases
Set permissions:

database connection is specified in the test-core.ini file (/usr/lib/ckan/default/src/ckan/test-core.ini) by the sqlalchemy.url parameter

Run the tests
If you wish to drop and reinitialize the database before the run you can use the reset-db option:

FileStore and file uploads

 * http://docs.ckan.org/en/latest/maintaining/filestore.html

Setup CKAN’s FileStore with local file storage
Add the following line to your CKAN config file, after the [app:main] line:

ckan.storage_path = /var/lib/ckan/default

Set the permissions:

Restart your web server:

Deploying a source install

 * http://docs.ckan.org/en/latest/maintaining/installing/deployment.html

Install the required packages
Package: libapache2-mod-wsgi Version: 3.3-4

Package: libpython2.6 Version: 2.6.8-1.1

Package: nginx Version: 1.2.1-2.2+wheezy2

Install an email server
Skip!

Create the WSGI script file (/etc/ckan/default/apache.wsgi)
import os activate_this = os.path.join('/usr/lib/ckan/default/bin/activate_this.py') execfile(activate_this, dict(__file__=activate_this))

from paste.deploy import loadapp config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'production.ini') from paste.script.util.logging_config import fileConfig fileConfig(config_filepath) application = loadapp('config:%s' % config_filepath)

Create the Apache config file (/etc/apache2/sites-available/ckan_default)
 ServerName ckan.page ServerAlias ckan.page WSGIScriptAlias / /etc/ckan/default/apache.wsgi # Pass authorization info on (needed for rest api). WSGIPassAuthorization On    # Deploy as a daemon (avoids conflicts between CKAN instances). WSGIDaemonProcess ckan_default display-name=ckan_default processes=2 threads=15 WSGIProcessGroup ckan_default ErrorLog /var/log/apache2/ckan_default.error.log CustomLog /var/log/apache2/ckan_default.custom.log combined 

Create the Nginx config file (/etc/nginx/sites-available/ckan_default)
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache:30m max_size=250m; proxy_temp_path /tmp/nginx_proxy 1 2;

server { client_max_body_size 100M; location / { proxy_pass http://127.0.0.1:8080/; proxy_set_header Host $host; proxy_cache cache; proxy_cache_bypass $cookie_auth_tkt; proxy_no_cache $cookie_auth_tkt; proxy_cache_valid 30m; proxy_cache_key $host$scheme$proxy_host$request_uri; # In emergency comment out line to force caching # proxy_ignore_headers X-Accel-Expires Expires Cache-Control; } }