How to Install CKAN for Open Data Portal on Ubuntu 20.04

Install CKAN Open Data Portal

Comprehensive Knowledge Archive Network (CKAN) is an open source software for open data portal, CMS that can help us manage and publish data sets. CKAN is used by central and local governments, research institutions, and other organizations to publish data.

An example of usage in Indonesia is Satu Data Indonesia (SDI) which is a government data management policy with the aim of creating quality data, easily accessible, and can be shared between central and regional agencies. This SDI policy is contained in Presidential Regulation No. 39 of 2019 concerning One Indonesian Data. Through SDI, all government data and data from other related agencies can end up in the Satu Data Indonesia Portal (data.go.id). Examples of local governments that have open data portals are Open Data Jakarta, Open Data Bandung, and Open Data West Kalimantan.

Tech Stack

CKAN uses the Python programming language as the backend, JavaScript as the frontend, the PostgreSQL database and the Solr search engine. CKAN allows for additional extensions or features because it uses a modular architecture. Besides that, CKAN also has an API feature.

System Requirements

Hardware Requirements

For portals on a national scale with high traffic:

  • 2 servers with 8GB RAM. One server for web and the other for database/Solr
  • 160GB storage. The web server can be bigger, as needed, how much data you want to store
  • Quad core processor. Faster is better

For regional level portals with lower traffic:

  • 2 servers with RAM 2GB
  • Storage 80GB
  • Dual core processor

Web and database can be combined on the same server, but recommends separating them for security reasons.

Software Requirements

Operating system
Ubuntu 16.04 64bit is recommended, CKAN is available in .deb package. CKAN has also been tested on CentOS and other major Linux distributions.

Web server

  • Apache
  • Nginx, for https and caching
  • Python 2.7.x

Database server

  • Postgres 9.3+
  • Redis
  • Tomcat/Jetty + Solr

The system requirements above are based on CKAN’s hosting guidelines, last updated 12-20-2017.

Specifications in the Tutorial

Server specifications and software used in this tutorial:

  • VPS 1CPU, RAM 2GB, Disk 50GB
  • Ubuntu 20.04
  • Nginx 1.18
  • Python 3.8.5
  • Supervisor 4.1.0
  • PostgreSQL 12.4
  • Redis 5.0.7
  • Solr 3.6.2
  • CKAN package 2.9.1

Port used:

ServicePortUsed for
Nginx80Proxy
uWSGI8080Web server
uWSGI8800DataPusher
Solr/Jetty8983Search
PostgreSQL5432Database
Redis6379Search

1. Install CKAN package

Update Ubuntu.

Install package dependencies.

Download CKAN package.

Install CKAN package.

2. Install PostgreSQL

Install PostgreSQL database.

Check if PostgreSQL is installed properly by displaying the existing database.

Create a PostgreSQL user named ckan_default.

Create a PostgreSQL database named ckan_default.

Check whether the ckan_default database was successfully created.

The result.

3. Install Solr

Install Solr.

Open the Tomcat configuration file.

Change the default Tomcat port from 8080 to 8983.

Replace the default schema.xml file with a symlink to the CKAN schema file included in sources.

Restart Solr by restarting tomcat.

4. Configure CKAN

Open the CKAN configuration file.

Enable the solr_url option by removing the hashtag (#).

The URL for the CKAN site, for example, uses the subdomain data.defnex.com.

Options for connecting to PostgreSQL databases, for example username = ckan_default, password = secretpassword, and database = ckan_default.

Initialize the CKAN database.

The result.

Restart the Supervisor and check the status.

The result.

Restart Nginx.

5. Testing

Test by browsing http://localhost or http://data.defnex.com.

CKAN web frontpage
CKAN web frontpage

6. Install SSL

Backup the default ckan server block configuration file.

Open the ckan server block configuration file.

Enter server_name and log options.

Nginx configuration test.

Restart Nginx.

Test again to access http://data.defnex.com, if there are no problems after changing the Nginx configuration.

Install certbot for Let’s Encrypt SSL.

Request SSL for data.defnex.com.

Test browse https://data.defnex.com.

CKAN with the https protocol
CKAN with the https protocol

7. Create a user sysadmin

Use the CKAN command line interface to create a first-time sysadmin user and also to create test data.

Enabling virtualenv.

Create a new user with the name musa and make it a sysadmin.

Hasilnya.

Or if you want to make an existing user as sysadmin.

Test the newly created sysadmin user by logging in on the CKAN web.

CKAN dashboard
CKAN dashboard

8. Use of Resources

Check the use of VPS resources using htop.

Resources VPS yang terpakai
Used VPS Resources

Good luck 🙂

Default image
Musa Amin
I am a Linux System Administrator and also write many tutorials about Linux, Cloud, and Open Source. Hire me via email hai[at]musaamin.web.id.

Leave a Reply