Skip to main content

 

Install the CKAN package

Begin by cleaning up your server environment.  Do this by updating Ubuntu’s package index:

sudo apt update

Now you can install the packages that CKAN requires (including ‘git’, which will allow you to install CKAN extensions):

sudo apt install -y libpq5 redis-server nginx supervisor

Response

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libhiredis0.14
  libjbig0 libjemalloc2 libjpeg-turbo8 libjpeg8 liblua5.1-0
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4 lua-bitop
  lua-cjson nginx-common nginx-core redis-tools
Suggested packages:
  libgd-tools fcgiwrap nginx-doc ssl-cert ruby-redis supervisor-doc
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libhiredis0.14
  libjbig0 libjemalloc2 libjpeg-turbo8 libjpeg8 liblua5.1-0
  libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libpq5 libtiff5 libwebp6 libxpm4
  lua-bitop lua-cjson nginx nginx-common nginx-core redis-server redis-tools
  supervisor
0 upgraded, 26 newly installed, 0 to remove and 9 not upgraded.
Need to get 3747 kB of archives.
After this operation, 14.1 MB of additional disk space will be used.
Get:1 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libhiredis0.14 amd64 0.14.0-6 [30.2 kB]
Get:2 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libjemalloc2 amd64 5.2.1-1ubuntu1 [235 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 liblua5.1-0 amd64 5.1.5-8.1build4 [99.9 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 lua-bitop amd64 1.0.2-5 [6680 B]
Get:5 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 lua-cjson amd64 2.1.0+dfsg-2.1 [17.4 kB]
Get:6 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 redis-tools amd64 5:5.0.7-2ubuntu0.1 [489 kB]
Get:7 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 redis-server amd64 5:5.0.7-2ubuntu0.1 [37.4 kB]
Get:8 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 supervisor all 4.1.0-1ubuntu1 [281 kB]
Get:9 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 fonts-dejavu-core all 2.37-1 [1041 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 fontconfig-config all 2.13.1-2ubuntu3 [28.8 kB]
Get:11 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libfontconfig1 amd64 2.13.1-2ubuntu3 [114 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libjpeg-turbo8 amd64 2.0.3-0ubuntu1.20.04.1 [117 kB]
Get:13 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libjpeg8 amd64 8c-2ubuntu8 [2194 B]
Get:14 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libjbig0 amd64 2.1-3.1build1 [26.7 kB]
Get:15 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libwebp6 amd64 0.6.1-2ubuntu0.20.04.1 [185 kB]
Get:16 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libtiff5 amd64 4.1.0+git191117-2ubuntu0.20.04.3 [162 kB]
Get:17 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libxpm4 amd64 1:3.5.12-1 [34.0 kB]
Get:18 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgd3 amd64 2.2.5-5.2ubuntu2.1 [118 kB]
Get:19 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-common all 1.18.0-0ubuntu1.3 [37.7 kB]
Get:20 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-image-filter amd64 1.18.0-0ubuntu1.3 [14.8 kB]
Get:21 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-xslt-filter amd64 1.18.0-0ubuntu1.3 [13.0 kB]
Get:22 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-mail amd64 1.18.0-0ubuntu1.3 [42.8 kB]
Get:23 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-stream amd64 1.18.0-0ubuntu1.3 [67.3 kB]
Get:24 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpq5 amd64 12.11-0ubuntu0.20.04.1 [117 kB]
Get:25 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-core amd64 1.18.0-0ubuntu1.3 [425 kB]
Get:26 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx all 1.18.0-0ubuntu1.3 [3620 B]
Fetched 3747 kB in 11s (332 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libhiredis0.14:amd64.
(Reading database ... 68038 files and directories currently installed.)
Preparing to unpack .../00-libhiredis0.14_0.14.0-6_amd64.deb ...
Unpacking libhiredis0.14:amd64 (0.14.0-6) ...
Selecting previously unselected package libjemalloc2:amd64.
Preparing to unpack .../01-libjemalloc2_5.2.1-1ubuntu1_amd64.deb ...
Unpacking libjemalloc2:amd64 (5.2.1-1ubuntu1) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../02-liblua5.1-0_5.1.5-8.1build4_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8.1build4) ...
Selecting previously unselected package lua-bitop:amd64.
Preparing to unpack .../03-lua-bitop_1.0.2-5_amd64.deb ...
Unpacking lua-bitop:amd64 (1.0.2-5) ...
Selecting previously unselected package lua-cjson:amd64.
Preparing to unpack .../04-lua-cjson_2.1.0+dfsg-2.1_amd64.deb ...
Unpacking lua-cjson:amd64 (2.1.0+dfsg-2.1) ...
Selecting previously unselected package redis-tools.
Preparing to unpack .../05-redis-tools_5%3a5.0.7-2ubuntu0.1_amd64.deb ...
Unpacking redis-tools (5:5.0.7-2ubuntu0.1) ...
Selecting previously unselected package redis-server.
Preparing to unpack .../06-redis-server_5%3a5.0.7-2ubuntu0.1_amd64.deb ...
Unpacking redis-server (5:5.0.7-2ubuntu0.1) ...
Selecting previously unselected package supervisor.
Preparing to unpack .../07-supervisor_4.1.0-1ubuntu1_all.deb ...
Unpacking supervisor (4.1.0-1ubuntu1) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../08-fonts-dejavu-core_2.37-1_all.deb ...
Unpacking fonts-dejavu-core (2.37-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../09-fontconfig-config_2.13.1-2ubuntu3_all.deb ...
Unpacking fontconfig-config (2.13.1-2ubuntu3) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../10-libfontconfig1_2.13.1-2ubuntu3_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.13.1-2ubuntu3) ...
Selecting previously unselected package libjpeg-turbo8:amd64.
Preparing to unpack .../11-libjpeg-turbo8_2.0.3-0ubuntu1.20.04.1_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (2.0.3-0ubuntu1.20.04.1) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../12-libjpeg8_8c-2ubuntu8_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu8) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../13-libjbig0_2.1-3.1build1_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1build1) ...
Selecting previously unselected package libwebp6:amd64.
Preparing to unpack .../14-libwebp6_0.6.1-2ubuntu0.20.04.1_amd64.deb ...
Unpacking libwebp6:amd64 (0.6.1-2ubuntu0.20.04.1) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../15-libtiff5_4.1.0+git191117-2ubuntu0.20.04.3_amd64.deb ...
Unpacking libtiff5:amd64 (4.1.0+git191117-2ubuntu0.20.04.3) ...
Selecting previously unselected package libxpm4:amd64.
Preparing to unpack .../16-libxpm4_1%3a3.5.12-1_amd64.deb ...
Unpacking libxpm4:amd64 (1:3.5.12-1) ...
Selecting previously unselected package libgd3:amd64.
Preparing to unpack .../17-libgd3_2.2.5-5.2ubuntu2.1_amd64.deb ...
Unpacking libgd3:amd64 (2.2.5-5.2ubuntu2.1) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../18-nginx-common_1.18.0-0ubuntu1.3_all.deb ...
Unpacking nginx-common (1.18.0-0ubuntu1.3) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../19-libnginx-mod-http-image-filter_1.18.0-0ubuntu1.3_amd64.deb ...
Unpacking libnginx-mod-http-image-filter (1.18.0-0ubuntu1.3) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../20-libnginx-mod-http-xslt-filter_1.18.0-0ubuntu1.3_amd64.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.3) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../21-libnginx-mod-mail_1.18.0-0ubuntu1.3_amd64.deb ...
Unpacking libnginx-mod-mail (1.18.0-0ubuntu1.3) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../22-libnginx-mod-stream_1.18.0-0ubuntu1.3_amd64.deb ...
Unpacking libnginx-mod-stream (1.18.0-0ubuntu1.3) ...
Selecting previously unselected package libpq5:amd64.
Preparing to unpack .../23-libpq5_12.11-0ubuntu0.20.04.1_amd64.deb ...
Unpacking libpq5:amd64 (12.11-0ubuntu0.20.04.1) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../24-nginx-core_1.18.0-0ubuntu1.3_amd64.deb ...
Unpacking nginx-core (1.18.0-0ubuntu1.3) ...
Selecting previously unselected package nginx.
Preparing to unpack .../25-nginx_1.18.0-0ubuntu1.3_all.deb ...
Unpacking nginx (1.18.0-0ubuntu1.3) ...
Setting up supervisor (4.1.0-1ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/supervisor.service → /lib/systemd/system/supervisor.service.
Setting up libxpm4:amd64 (1:3.5.12-1) ...
Setting up libpq5:amd64 (12.11-0ubuntu0.20.04.1) ...
Setting up nginx-common (1.18.0-0ubuntu1.3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.
Setting up libjemalloc2:amd64 (5.2.1-1ubuntu1) ...
Setting up libjbig0:amd64 (2.1-3.1build1) ...
Setting up libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.3) ...
Setting up lua-cjson:amd64 (2.1.0+dfsg-2.1) ...
Setting up libwebp6:amd64 (0.6.1-2ubuntu0.20.04.1) ...
Setting up fonts-dejavu-core (2.37-1) ...
Setting up libjpeg-turbo8:amd64 (2.0.3-0ubuntu1.20.04.1) ...
Setting up lua-bitop:amd64 (1.0.2-5) ...
Setting up liblua5.1-0:amd64 (5.1.5-8.1build4) ...
Setting up libhiredis0.14:amd64 (0.14.0-6) ...
Setting up libjpeg8:amd64 (8c-2ubuntu8) ...
Setting up libnginx-mod-mail (1.18.0-0ubuntu1.3) ...
Setting up fontconfig-config (2.13.1-2ubuntu3) ...
Setting up libnginx-mod-stream (1.18.0-0ubuntu1.3) ...
Setting up redis-tools (5:5.0.7-2ubuntu0.1) ...
Setting up libtiff5:amd64 (4.1.0+git191117-2ubuntu0.20.04.3) ...
Setting up libfontconfig1:amd64 (2.13.1-2ubuntu3) ...
Setting up redis-server (5:5.0.7-2ubuntu0.1) ...
Created symlink /etc/systemd/system/redis.service → /lib/systemd/system/redis-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/redis-server.service → /lib/systemd/system/redis-server.service.
Setting up libgd3:amd64 (2.2.5-5.2ubuntu2.1) ...
Setting up libnginx-mod-http-image-filter (1.18.0-0ubuntu1.3) ...
Setting up nginx-core (1.18.0-0ubuntu1.3) ...
Setting up nginx (1.18.0-0ubuntu1.3) ...
Processing triggers for ufw (0.36-6ubuntu1) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...

Okay - now you're ready to download the CKAN package.  Note, as I'm on Ubuntu 20.04, I'll be downloading Python 3:

wget https://packaging.ckan.org/python-ckan_2.9-py3-focal_amd64.deb

If you have an issue downloading with wget, then use curl

curl -O https://packaging.ckan.org/python-ckan_2.9-py3-focal_amd64.deb

Once download (quite quick), install the CKAN package

sudo dpkg -i python-ckan_2.9-py3-focal_amd64.deb

 

Install and configure PostgreSQL

In deployment CKAN uses PostgreSQL, not SQLite. Running the tests with SQLite is less thorough but much quicker than with PostgreSQL, good enough for an initial check but you should run the tests with PostgreSQL before deploying anything or releasing any code.

Install PostgreSQL, running this command in a terminal:

sudo apt install -y postgresql

response 

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libllvm10 libsensors-config libsensors5 postgresql-12 postgresql-client-12
  postgresql-client-common postgresql-common ssl-cert sysstat
Suggested packages:
  lm-sensors postgresql-doc postgresql-doc-12 libjson-perl openssl-blacklist
  isag
The following NEW packages will be installed:
  libllvm10 libsensors-config libsensors5 postgresql postgresql-12
  postgresql-client-12 postgresql-client-common postgresql-common ssl-cert
  sysstat
0 upgraded, 10 newly installed, 0 to remove and 9 not upgraded.
Need to get 30.5 MB of archives.
After this operation, 121 MB of additional disk space will be used.
Get:1 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libllvm10 amd64 1:10.0.0-4ubuntu1 [15.3 MB]
Get:2 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libsensors-config all 1:3.6.0-2ubuntu1.1 [6052 B]
Get:3 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 libsensors5 amd64 1:3.6.0-2ubuntu1.1 [27.2 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-client-common all 214ubuntu0.1 [28.2 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-client-12 amd64 12.11-0ubuntu0.20.04.1 [1050 kB]
Get:6 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 ssl-cert all 1.0.39 [17.0 kB]
Get:7 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-common all 214ubuntu0.1 [169 kB]
Get:8 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql-12 amd64 12.11-0ubuntu0.20.04.1 [13.5 MB]
Get:9 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 postgresql all 12+214ubuntu0.1 [3924 B]
Get:10 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 sysstat amd64 12.2.0-2ubuntu0.1 [448 kB]
Fetched 30.5 MB in 7s (4096 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libllvm10:amd64.
(Reading database ... 79452 files and directories currently installed.)
Preparing to unpack .../0-libllvm10_1%3a10.0.0-4ubuntu1_amd64.deb ...
Unpacking libllvm10:amd64 (1:10.0.0-4ubuntu1) ...
Selecting previously unselected package libsensors-config.
Preparing to unpack .../1-libsensors-config_1%3a3.6.0-2ubuntu1.1_all.deb ...
Unpacking libsensors-config (1:3.6.0-2ubuntu1.1) ...
Selecting previously unselected package libsensors5:amd64.
Preparing to unpack .../2-libsensors5_1%3a3.6.0-2ubuntu1.1_amd64.deb ...
Unpacking libsensors5:amd64 (1:3.6.0-2ubuntu1.1) ...
Selecting previously unselected package postgresql-client-common.
Preparing to unpack .../3-postgresql-client-common_214ubuntu0.1_all.deb ...
Unpacking postgresql-client-common (214ubuntu0.1) ...
Selecting previously unselected package postgresql-client-12.
Preparing to unpack .../4-postgresql-client-12_12.11-0ubuntu0.20.04.1_amd64.deb ...
Unpacking postgresql-client-12 (12.11-0ubuntu0.20.04.1) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../5-ssl-cert_1.0.39_all.deb ...
Unpacking ssl-cert (1.0.39) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../6-postgresql-common_214ubuntu0.1_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (214ubuntu0.1) ...
Selecting previously unselected package postgresql-12.
Preparing to unpack .../7-postgresql-12_12.11-0ubuntu0.20.04.1_amd64.deb ...
Unpacking postgresql-12 (12.11-0ubuntu0.20.04.1) ...
Selecting previously unselected package postgresql.
Preparing to unpack .../8-postgresql_12+214ubuntu0.1_all.deb ...
Unpacking postgresql (12+214ubuntu0.1) ...
Selecting previously unselected package sysstat.
Preparing to unpack .../9-sysstat_12.2.0-2ubuntu0.1_amd64.deb ...
Unpacking sysstat (12.2.0-2ubuntu0.1) ...
Setting up postgresql-client-common (214ubuntu0.1) ...
Setting up libsensors-config (1:3.6.0-2ubuntu1.1) ...
Setting up libllvm10:amd64 (1:10.0.0-4ubuntu1) ...
Setting up postgresql-client-12 (12.11-0ubuntu0.20.04.1) ...
update-alternatives: using /usr/share/postgresql/12/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up ssl-cert (1.0.39) ...
Setting up postgresql-common (214ubuntu0.1) ...
Adding user postgres to group ssl-cert

Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /lib/systemd/system/postgresql.service.
Setting up libsensors5:amd64 (1:3.6.0-2ubuntu1.1) ...
Setting up postgresql-12 (12.11-0ubuntu0.20.04.1) ...
Creating new PostgreSQL cluster 12/main ...
/usr/lib/postgresql/12/bin/initdb -D /var/lib/postgresql/12/main --auth-local peer --auth-host md5
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/12/main ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctlcluster 12 main start

Ver Cluster Port Status Owner    Data directory              Log file
12  main    5432 down   postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
update-alternatives: using /usr/share/postgresql/12/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
Setting up sysstat (12.2.0-2ubuntu0.1) ...

Creating config file /etc/default/sysstat with new version
update-alternatives: using /usr/bin/sar.sysstat to provide /usr/bin/sar (sar) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/sysstat.service → /lib/systemd/system/sysstat.service.
Setting up postgresql (12+214ubuntu0.1) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...

 

Is PostgreSQL running?  First check the status by executing the command

sudo service postgresql status

response

● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor pr>
     Active: active (exited) since Tue 2022-07-12 02:54:25 UTC; 7min ago
   Main PID: 782175 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 9535)
     Memory: 0B
     CGroup: /system.slice/postgresql.service

Jul 12 02:54:25 {project} systemd[1]: Starting PostgreSQL RDBMS...
Jul 12 02:54:25 {project} systemd[1]: Finished PostgreSQL RDBMS.

If PostgreSQL is not running then run the command

sudo service postgresql start

Also, confirm that the encoding of databases is UTF8, if not you might find issues later on with internationalisation.  Execute the following command:

sudo -u postgres psql -l

response:

                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+----------+----------+---------+---------+-----------------------
 postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |
 template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
 template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
(3 rows)

Create a database user if one doesn’t already exist.  Create a new PostgreSQL user called ckan_default and enter a password for the user when prompted

sudo -u postgres createuser -S -D -R -P ckan_default

Create a new PostgreSQL database, called ckan_default, owned by the database user you just created:

sudo -u postgres createdb -O ckan_default ckan_default -E utf-8

So now your database list will be

                                 List of databases
     Name     |    Owner     | Encoding | Collate |  Ctype  |   Access privileges
--------------+--------------+----------+---------+---------+-----------------------
 ckan_default | ckan_default | UTF8     | C.UTF-8 | C.UTF-8 |
 postgres     | postgres     | UTF8     | C.UTF-8 | C.UTF-8 |
 template0    | postgres     | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
              |              |          |         |         | postgres=CTc/postgres
 template1    | postgres     | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
              |              |          |         |         | postgres=CTc/postgres

Edit the sqlalchemy.url option in your CKAN configuration file (/etc/ckan/default/ckan.ini) and set the confirm that the password, database and database user are correct.  You can edit using vim:

vim /etc/ckan/default/ckan.ini

Using the default id's from above the config file will have the following:

## Database Settings
sqlalchemy.url = postgresql://ckan_default:pass@localhost/ckan_default

 

Install and configure Solr

You can install Solr by executing the command:

sudo apt install -y solr-tomcat

Change the default port Tomcat runs on (8080) to the one expected by CKAN. To do so change the following line in the /etc/tomcat9/server.xml

sudo vim /etc/tomcat9/server.xml
From:
<Connector port="8080" protocol="HTTP/1.1"


To:
<Connector port="8983" protocol="HTTP/1.1"

In the ckan.ini file, you will also need to configure the Solr server used for search.  The Solr schema found at that URL must be one of the ones in ckan/config/solr.  A check of the schema version number occurs when CKAN starts.

Optionally, solr_user and solr_password can also be configured to specify HTTP Basic authentication details for all Solr requests.

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

Location of schema.xml

/etc/solr/conf/schema.xml

Actioning the following

sudo mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.xml.bak
sudo ln -s /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml

Now restart Solr

sudo service tomcat9 restart

 

Start the Web Server and restart Nginx

Reload the Supervisor daemon so the new processes are picked up:

sudo supervisorctl reload

After a few seconds run the following command to check the status of the processes:

sudo supervisorctl status

Like above, you will hopefully see three processes running without errors:

ckan-datapusher:ckan-datapusher-00   RUNNING   pid 25124, uptime 0:03:18
ckan-uwsgi:ckan-uwsgi-00             RUNNING   pid 25125, uptime 0:03:18
ckan-worker:ckan-worker-00           RUNNING   pid 25126, uptime 0:03:18

If some of the processes report an error, ensure you’ve run all the previous steps and check the logs located in /var/log/ckan for more details.

 

Related articles

Andrew Fletcher18 Mar 2024
Resolving CVE-2022-48624 less issue
To resolve the CVE-2022-48624 vulnerability on Ubuntu using Nginx, it's crucial to understand that the issue lies within the "less" package, not Nginx itself. The vulnerability affects "less" before version 606, where close_altfile in filename.c in less omits shell_quote calls for LESSCLOSE,...
Andrew Fletcher06 Mar 2024
Terminal command to find and replace
In many terminal text editors, you use find command as reference in Terminal commands - find. &nbsp;How about find and replace. &nbsp;This action depends on the specific text editor you're using in the terminal. &nbsp;Here are a few common terminal text editors and how you can find and replace...