followed http://docs.ckan.org/en/2.8/maintaining/installing/install-from-package.html
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y nginx apache2 libapache2-mod-wsgi libpq5 redis-server git-core
nginx will fail to start since the apache webserver is using port 80. Install nano and change the apache port:
sudo apt-get install nano
sudo nano /etc/apache2/ports.conf
change Listen 80
to Listen 8080
and restart apache and nginx:
sudo service apache2 restart
sudo service nginx restart
wget http://packaging.ckan.org/python-ckan_2.8-xenial_amd64.deb
sudo dpkg -i python-ckan_2.8-xenial_amd64.deb
sometimes there are some hickups. If some depandencies are unresolved try:
sudo apt-get upgrade
sudo sercice apache2 reload
sudo dpkg -i python-ckan_2.8-xenial_amd64.deb
the following is just for testing purposes. In production you should run the postgreSQL DBMS on a seperate vm install postgreSQL DBMS on the VM. This will install pg v9.5 (as of 24.08.2018 and ubuntu 16.04).
sudo apt-get install -y postgresql
note: for production you should sign in for the postgresql repository to get a newer postgres version. See: https://www.postgresql.org/download/linux/ubuntu/
create the ckan_default user:
sudo -u postgres createuser -S -D -R -P ckan_default
create the ckan db with UTF-8 and set ckan_default as user:
sudo -u postgres createdb -O ckan_default ckan_default -E utf-8
note: for production you could run apache solr on a seperate vm. See: http://lucene.apache.org/solr/guide/7_4/installing-solr.html
instal solr in as jetty based java application:
sudo apt-get install -y solr-jetty
this will show some errors since the jetty will not start properly because the port (8080) is blocked by apache. Change the config files with:
sudo nano /etc/default/jetty8
and change the following:
NO_START=0 # (line 4)
JETTY_HOST=127.0.0.1 # (line 16)
JETTY_PORT=8983 # (line 19)
after this restart jetty:
sudo service jetty8 restart
now it sould start without errors
Solr should index ckans files and data in a ckan schema. Therefore move the ckan schema to Solr and upfront make a .bak of the old file:
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
again restart jetty:
sudo service jetty8 restart
config ckan following http://docs.ckan.org/en/2.8/maintaining/installing/install-from-package.html#update-the-configuration-and-initialize-the-database
sudo nano /etc/ckan/default/production.ini
here change eg:
sqlalchemy.url = postgresql://ckan_default:pass@localhost/ckan_default
solr_url = http://127.0.0.1:8983/solr
ckan.site_url = 134.110.18.66 #http://demo.ckan.org
initialize the db:
sudo ckan db init
again restarting the services:
sudo service restart apache2
sudo service restart jetty8
test ckan at http://134.110.18.66
http://docs.ckan.org/en/latest/maintaining/getting-started.html
aktivate the ckan environment and navigate to ckan source directory:
. /usr/lib/ckan/default/bin/activate
cd /usr/lib/ckan/default/src/ckan
create sysadmin for ckan
paster sysadmin add ckanadmin [email protected] name=ckanadmin -c /etc/ckan/default/production.ini
change ownership to www-data user to get write permissions for sysadmin ui:
sudo chown -R www-data /var/lib/ckan
sudo chmod -R u+rwx /var/lib/ckan
change config via UI at http://134.110.18.66/ckan-admin/config
following: http://docs.ckan.org/en/latest/maintaining/datastore.html# enable datastore extension in CKAN config file:
sudo nano /etc/ckan/default/production.ini
add datastore
to ckan.plugins
create db user:
sudo -u postgres createuser -S -D -R -P -l datastore_default
create datastore db:
sudo -u postgres createdb -O ckan_default datastore_default -E utf-8
update the ckan config:
sudo nano /etc/ckan/default/production.ini
change 'pass' in ckan.datastore.write_url = postgresql://ckan_default:pass@localhost/datastore_default
and ckan.datastore.read_url = postgresql://datastore_default:pass@localhost/datastore_default
to the given password for the datastore_default user.
grant priviliges to the datastore_default user:
sudo ckan datastore set-permissions | sudo -u postgres psql --set ON_ERROR_STOP=1
fix error in web.py for ckan 2.8 as statet in ckan/datapusher#166:
sudo nano /usr/lib/ckan/datapusher/lib/python2.7/site-packages/ckanserviceprovider/web.py
and replace: import flask.ext.login as flogin with:
import flask_login as flogin
enable datapusher site and restart all services:
sudo a2ensite datapusher
sudo service apache2 restart
sudo service nginx restart
sudo service jetty8 restart