Skip to content

Data Portal installation on macOS High Sierra

Reuben Cummings edited this page Aug 10, 2019 · 8 revisions

Tested with CKAN 2.8.3 on macOS 10.13.6

Prerequisites

Open the terminal

  1. Click the magnifying glass in the upper-right corner of the menu bar, or press Command-Space bar. (Spotlight Search)

  1. Type "Terminal" into the search field
  2. When the selection says "Terminal.app", press Enter

Install build tools

Xcode Command Line Tools (gives your mac a C compiler)

  1. In your terminal, type the following command:
xcode-select --install

Homebrew (third-party macOS package manager)

install

  1. In your terminal, type the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. The script will explain what changes it will make and prompt you before the installation begins.

configure

Now you will update your PATH environment variable so your system has access to the Homebrew commands

  1. Ensure you have ~/.profile file by typing the following command in your terminal:
touch ~/.profile
  1. Add the Homebrew directory to your PATH by typing the following command in your terminal
echo "export PATH=\"/usr/local/bin:/usr/local/sbin:$PATH\"" >> ~/.profile

Install required software

Python 2 (the CKAN data portal does not yet support Python 3)

  1. Install Python 2.7
brew install python@2
  1. Add the python@2 directory to your PATH so your system has access to the Python commands
echo "export PATH=\"/usr/local/opt/python@2/libexec/bin:$PATH\"" >> ~/.profile
  1. Install virtualenv to manage your Python environments
pip install virtualenv

Git (distributed version control software)

  1. install Git
brew install git
  1. Set your name (replace Your Name with your first and last name, e.g., Reuben Cummings)
git config --global user.name "Your Name"
  1. Set your commit email address (replace your@email.address with your email address, e.g., reubano@gmail.com).

Note: This should be the same email address you used to signup for your GitHub account

git config --global user.email "your@email.address"
  1. Check that both configurations have been set correctly
git config --global --list

PostgreSQL (relational database)

  1. install
brew install postgresql@10

Magic (implementation of the file command)

  1. install libmagic
brew install libmagic

Git and GitHub

Fork the openpeoria/data-portal repo

  1. In the top-right corner of the repo page, click Fork.

fork button

Clone your forked repo

  1. On GitHub, navigate to your fork of the data-portal repository, e.g., https://github.com/yourusername/data-portal

  2. Under the repository name, click Clone or download

clone repo

  1. In the Clone with HTTPs section, click the clipboard icon to copy the clone URL for the repository.

https clone

  1. Create a directory to hold the cloned project
mkdir -p ~/Documents/Projects
cd ~/Documents/Projects
  1. Type git clone, and then paste the URL you copied in step 3 above. It will look like git clone https://github.com/YOUR-USERNAME/data-portal, but with your GitHub username instead of YOUR-USERNAME

  2. Press Enter. Your local clone will be created.

Portal Setup

Python environment setup

  1. Create and activate a virtual environment
cd data-portal
virtualenv --no-site-packages --python=python2.7 venv
source venv/bin/activate
  1. Install required Python libraries
pip install -r requirements.txt -r dev-requirements.txt 

PostgreSQL setup

  1. start the server
sudo pg_ctl -D /usr/local/var/postgres start
  1. Create a PostgreSQL user
sudo createuser -U postgres ckan_default
  1. Create a PostgreSQL database
sudo createdb -U postgres -O ckan_default ckan_default -E utf-8
  1. Open the development.ini file and edit line 47

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

to remove :password so that it looks like this

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

Note: if you created a database password, replace password with your password.

open development.ini
  1. Create database tables
paster --plugin=ckan db init -c development.ini

You should see Initialising DB: SUCCESS

  1. Start ckan
paster --plugin=ckan serve development.ini

You should see serving on http://127.0.0.1:5000

  1. Open http://127.0.0.1:5000, and you should see the CKAN front page.

  2. If you get an error similar to the following:

In the browser: Internal Server Error In the terminal: OSError: [Errno 13] Permission denied: '/tmp/default/session...'

You need to modify the directory permissions:

cd /tmp/default
sudo chmod -R 755 session

Reference: