CKAN installation on macOS High Sierra - ckan/ckan GitHub Wiki
Install CKAN on macOS High Sierra (v10.13.6)
Based on https://github.com/ckan/ckan/wiki/How-to-Install-CKAN-2.3a-on-Mac-OS-X-10.7-Lion and https://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html
Tested on CKAN v2.8.1
You should have installed:
- Python's virtualenv
- Wget, once you have brew:
brew install wget
(however, not sure if it is really needed - i just pick it up from some wikis)
Since /usr
is protected on OS X El Capitan and later (see details), we are using /usr/local
directory:
mkdir -p ~/ckan/lib
sudo ln -s ~/ckan/lib /usr/local/ckan
mkdir -p ~/ckan/etc
sudo ln -s ~/ckan/etc /etc/ckan
sudo mkdir -p /usr/local/ckan/default
sudo chown `whoami` /usr/local/ckan/default
# Use Python v2.7 path on your machine, use `which python` or `which python2` command to print its path:
virtualenv --no-site-packages /usr/local/ckan/default -p /Library/Frameworks/Python.framework/Versions/2.7/bin/python
. /usr/local/ckan/default/bin/activate
# If you have activated virtualenv, you should see `(default)` in the beginning of a command prompt.
As recommended in the official docs, install setuptools==36.1
:
pip install setuptools==36.1
To install the latest stable release of CKAN (CKAN 2.8.1), run:
pip install -e 'git+https://github.com/ckan/[email protected]#egg=ckan'
Install the Python modules that CKAN requires into your virtualenv:
pip install -r /usr/local/ckan/default/src/ckan/requirements.txt
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:
deactivate
. /usr/local/ckan/default/bin/activate
Check if you have psql
command available by just running psql
. If the command unavailable you either need to install PostgreSLQ or setup a CLI tool.
FYI, I'm using https://postgresapp.com/documentation/cli-tools.html on my machine.
sudo -u <postgresuser> createuser -S -D -R -P ckan_default
sudo -u <postgresuser> createdb -O ckan_default ckan_default -E utf-8
sudo mkdir -p /etc/ckan/default
sudo chown -R `whoami` /etc/ckan/
sudo chown -R `whoami` ~/ckan/etc
paster make-config ckan /etc/ckan/default/development.ini
Open the config file in the editor:
# eg, in atom:
atom /etc/ckan/default/development.ini
and edit sqlalchemy.url = postgresql://ckan_default:<pass>@localhost/ckan_default
line by replacing <pass>
with the password you have setup earlier.
Also, set a value for site_url
, eg, it can be ckan.site_url = http://whatever.com
(the server wouldn't start if you leave this value empty)
Link to who.ini
:
ln -s /usr/local/ckan/default/src/ckan/who.ini /etc/ckan/default/who.ini
Download solr
v1.4.1 from here - http://archive.apache.org/dist/lucene/solr/1.4.1/apache-solr-1.4.1.tgz
Unzip it and move:
tar -zxvf ~/path-to-downloaded-file/apache-solr-1.4.1.tgz
mv apache-solr-1.4.1/ /usr/local/Cellar/solr14/
Now set it up:
cd /usr/local/Cellar/solr14/example/
sudo mv solr/conf/schema.xml solr/conf/schema.xml.backup
sudo ln -s /usr/local/ckan/default/src/ckan/ckan/config/solr/schema.xml solr/conf/schema.xml
Download - https://www-eu.apache.org/dist/tomcat/tomcat-7/v7.0.91/bin/apache-tomcat-7.0.91.tar.gz
Unzip and move:
tar -zxvf ~/path-to-donwloaded-file/apache-tomcat-7.0.91.tar.gz
sudo mv apache-tomcat-7.0.91/ /usr/local/apache-tomcat
Set it up:
sudo cp /usr/local/Cellar/solr14/example/webapps/solr.war /usr/local/apache-tomcat/webapps/solr.war
Starting apache-tomcat, unzip the
solr.war
:/usr/local/apache-tomcat/bin/startup.sh
Closing apache-tomcat:
/usr/local/apache-tomcat/bin/shutdown.sh
Configure:
cd /usr/local/apache-tomcat/webapps/solr/WEB-INF
atom web.xml
and uncomment lines 36-42 and modify the values so that it looks like this:
<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>/usr/local/Cellar/solr14/example/solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
Running Apache Tomcat:
/usr/local/apache-tomcat/bin/startup.sh
Now go to http://127.0.0.1:8080/solr/ and it should work.
Go to ckan dir in the virtualenv:
cd /usr/local/ckan/default/src/ckan
Now create tables in the database:
paster db init -c /etc/ckan/default/development.ini
and you should see following message: "Initialising DB: SUCCESS"
Now it is time to start the server:
paster serve /etc/ckan/default/development.ini