How to Install CKAN on OpenSUSE Latest?
CKAN is an open-source data management system used to manage and publish datasets. In this tutorial, we will guide you on how to install CKAN on OpenSUSE Latest.
Prerequisites
Before proceeding with the installation, make sure you have the following prerequisites:
- OpenSUSE Latest installation with root privileges.
- Python 2.7.x and pip (Python Package Manager) installed.
- PostgreSQL 9.0+ installed.
- A user with sudo access.
Step 1: Install CKAN Dependencies
The first step is to install the dependencies needed to run CKAN. You can do this by executing the following commands:
sudo zypper install -y gcc make python-devel python-virtualenv \
python-psycopg2 libxslt-devel libxml2-devel git-core
Step 2: Install Apache
CKAN is usually run behind Apache, so we need to install it. To do this, run the following command:
sudo zypper in apache2
Step 3: Setup virtual environment
Once you have installed Apache, we need to set up the virtual environment for CKAN. We will create a new directory named CKAN and create a virtual environment inside that directory.
mkdir CKAN
cd CKAN
virtualenv --no-site-packages ckanenv
source ckanenv/bin/activate
Step 4: Install CKAN
With the virtual environment set up, you can now install CKAN by running the following command:
pip install -e 'git+https://github.com/ckan/ckan.git#egg=ckan'
Step 5: Setup CKAN
Now that CKAN is installed, we need to create the necessary configuration files. To do this, run the following commands:
sudo mkdir -p /etc/ckan/default
sudo chown -R $USER /etc/ckan/
sudo chmod u+rwx /etc/ckan/
cd /etc/ckan/default/
Next, create a new file named production.ini using your favorite editor.
sudo vi production.ini
Then copy and paste the following code into the file.
[server:main]
use = egg:gunicorn
host = 0.0.0.0
port = 80
[app:main]
# In this section, configure CKAN's main application.
# Set the secret key used to sign sessions and cookies.
# Generate one with `openssl rand -g 128`.
ckan.session.secret = YOUR_SECRET_KEY_HERE
# Set the local directory to which CKAN saves uploaded files.
# This must be writable by the CKAN web server user.
ckan.storage_path = /var/lib/ckan
# Set the maximum size of file uploads in bytes.
ckan.max_resource_size = 1000000000
# Set the PostgreSQL database URI.
ckan.sqlalchemy.url = postgresql://ckanuser:ckanpassword@localhost/ckan
[plugin:statsd]
use = egg:statsd
[ckanext-geoview]
mapquest.apikey = YOUR_MAPQUEST_APIKEY_HERE
[ckan:geoview]
geom_type = MultiPolygon
leaflet.tilelayer = MapQuest OpenStreetMap
Be sure to replace YOUR_SECRET_KEY_HERE with a 128-bit secret key generated by openssl, and YOUR_MAPQUEST_APIKEY_HERE with your own MapQuest API key (you can get one from MapQuest's website).
Finally, you need to create the database and user for CKAN. To do this, run the following command:
sudo -u postgres createuser -S -D -R ckanuser
sudo -u postgres createdb -O ckanuser ckan -E utf-8
Step 6: Start CKAN
With everything set up, you can now start CKAN. To do this, run the following commands:
ckan -c /etc/ckan/default/production.ini run
Then point your browser to http://localhost/ to access CKAN.
Conclusion
That's it! You've successfully installed CKAN on OpenSUSE Latest. You can now use CKAN to manage and publish datasets.