CKAN
CKAN (Comprehensive Knowledge Archive Network) is an open-source platform designed to simplify the management, publication, and utilization of data. CKAN enables organizations to store, manage, and share datasets efficiently. With features like metadata search, data APIs, and a user-friendly interface, CKAN supports data transparency, collaboration, and data reuse by various stakeholders. This platform is commonly used by governments, non-profit organizations, and research institutions to manage open data portals.
1. System Requirements
Recommended hardware requirements for running CKAN:
- CPU 2 Core
- RAM 4 GB
- Disk 60 GB
Software requirements for CKAN package-based installation:
- OS Ubuntu 22.04
- Database PostgreSQL
- Web server Nginx
- Search engine Solr
Before starting the deployment, prepare:
- A VPS or server with Ubuntu 22.04 OS
- SSH access to the server
- A domain already pointed to the server
2. Server Preparation
Update the system
sudo apt update
sudo apt upgrade -y
Install dependencies
sudo apt install libpq5 redis-server nginx supervisor postgresql -y
Download and install CKAN
wget https://packaging.ckan.org/python-ckan_2.11-jammy_amd64.deb
sudo dpkg -i python-ckan_2.11-jammy_amd64.deb
3. Create Database
Create a user named ckan_user
sudo -u postgres createuser -S -D -R -P ckan_user
Create a database named ckan_dbase
sudo -u postgres createdb -O ckan_user ckan_dbase -E utf-8
Verify the creation of the user and database
sudo -u postgres psql -l
4. Install Apache Solr
Install default-jdk
sudo apt install default-jdk -y
Download Apache Solr
wget https://dlcdn.apache.org/solr/solr/9.7.0/solr-9.7.0.tgz
Extract Solr
tar xvzf solr-9.7.0.tgz solr-9.7.0/bin/install_solr_service.sh --strip-components=2
Run the Solr installer
sudo bash ./install_solr_service.sh solr-9.7.0.tgz
Verify the Solr service status
sudo systemctl status solr
Create a role for CKAN
sudo -u solr /opt/solr/bin/solr create -c ckan
Replace the standard schema with the CKAN schema
sudo -u solr wget -O /var/solr/data/ckan/conf/managed-schema https://raw.githubusercontent.com/ckan/ckan/2.11/ckan/config/solr/schema.xml
Restart Solr
sudo systemctl restart solr
5. CKAN Configuration
Open the CKAN configuration file
sudo nano /etc/ckan/default/ckan.ini
Set the site_url
and database connection
ckan.site_url = https://ckan.contoh.com
sqlalchemy.url = postgresql://ckan_user:ckanpassword@localhost/ckan_dbase
Initialize the CKAN database
sudo ckan db init
Response to the command above
Upgrading DB: SUCCESS
Restart supervisor
sudo supervisorctl reload
sudo supervisorctl status
6. Create Sysadmin User
Activate the virtual environment
source /usr/lib/ckan/default/bin/activate
cd /usr/lib/ckan/default/src/ckan
Create a new user
ckan -c /etc/ckan/default/ckan.ini sysadmin add adminckan [email protected] name=adminckan
Response to the command above
Create new user: adminckan? [Y/n]: Y
Password :
Repeat for confirmation:
2025-01-21 11:22:19,860 DEBUG [ckanext.activity.logic.action] Created 'new user' activity
Successfully created user: adminckan
Added adminckan as sysadmin
If elevating an existing user to sysadmin
ckan -c /etc/ckan/default/ckan.ini sysadmin add userckan
Exit the virtual environment
deactivate
cd
7. Nginx Configuration
Open the Nginx configuration file for CKAN
sudo nano /etc/nginx/sites-available/ckan
Add the listen
and server_name
configuration
proxy_temp_path /tmp/nginx_proxy 1 2;
server {
listen 80;
server_name ckan.contoh.com;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
Restart Nginx
sudo systemctl restart nginx
Install Certbot
sudo apt install python3-certbot-nginx -y
Request SSL
sudo certbot --non-interactive \
-m [email protected] \
--agree-tos \
--no-eff-email \
--nginx -d ckan.contoh.com \
--redirect
The CKAN application deployment is complete. Access https://ckan.contoh.com
.