Skip to content

Data Portal installation on Ubuntu 18.04

Vladimir Stremoukhov edited this page Aug 10, 2019 · 11 revisions

Tested with CKAN 2.8.3 on Ubuntu 18.04.3

Prerequisites

Install required software

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

  1. Install Python 2.7
sudo apt-get install python-dev python-pip 
  1. Install virtualenv to manage your Python environments
sudo apt-get install python-virtualenv

Git (distributed version control software)

  1. install Git
sudo apt-get install git-core
  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 [email protected] with your email address, e.g., [email protected]).

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

git config --global user.email "[email protected]"
  1. Check that both configurations have been set correctly
git config --global --list

PostgreSQL (relational database)

  1. install
sudo apt-get install postgresql libpq-dev

Magic (implementation of the file command)

  1. install libmagic
sudo apt-get install libmagic-dev

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 service postgresql start
  1. Create a PostgreSQL user
sudo -u postgres createuser -U postgres ckan_default
  1. Create a PostgreSQL database
sudo -u postgres 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 replace password with the password you chose in step 3 above.

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.

Reference: