Install CKAN and its dependencies Postgres and Solr on WSL2 Ubuntu
This is simpler version of CKAN official guide derived by me when trying to install the CKAN.
Note: This works on Ubuntu 22 on WSL 2 as of 2023
Step 1: Local installation
You need local installation for CKAN and its dependencies
sudo apt update
sudo apt install -y libpq5 redis-server nginx supervisor
wget https://packaging.ckan.org/python-ckan_2.10-jammy_amd64.deb
sudo dpkg -i python-ckan_2.10-jammy_amd64.deb
Check CKAN is installed
sudo ckan
You must see the command line help message like below
How to reinstall when anything go wrong
Sometime you mistakenly edit the config file or delete something. You can purge by the following command.
sudo dpkg -P python-ckan
rm -rf /etc/ckan
Then revisit the above step to install it again.
Step 2: Docker compose for Database and Solr (Search)
Make the new directory then create the docker-compose.yml
with the content below.
version: "3.8"
services:
db:
image: postgres
environment:
POSTGRES_DB: ckan_default
POSTGRES_USER: ckan_default
POSTGRES_PASSWORD: pass
ports:
- "5432:5432"
solr:
image: "ckan/ckan-solr:2.10"
ports:
- "8983:8983"
Check if PostgreSQL is online
You can inspect by your favorite database client like DBeaver or the command line psql
# psql -h <host_name> -U <user_name> <database_name>
psql -h localhost -U ckan_default ckan_deafult
# See Password for user ckan_default:
# type in pass
Check if Solr is online
Step 3: Configuration and Initialization
First, we create the folder for CKAN storage.
sudo mkdir -p /var/lib/ckan/default
sudo chown www-data /var/lib/ckan/default
sudo chmod u+rwx /var/lib/ckan/default
You might have to edit something at the configuration file.
sudo vim /etc/ckan/default/ckan.ini
For example, if you set database password to something else than pass
you will need to edit it here.
Then run the initialization
sudo ckan db init
Step 4: Start the web server
CKAN is using Python protocol uWSGI. This is not the simple http forwarding so to open the web you need to start nginx
too.
sudo supervisorctl reload
sudo systemctl restart nginx
Check if everything is run
sudo supervisorctl status
sudo systemctl status nginx
Now you can see the welcome screen
Visit the home screen in your Google Chrome or favorite browser.
Here we go and hope this help !