Skip to content

Instantly share code, notes, and snippets.

@waldoj
Forked from JoshData/gist:5212696
Last active December 15, 2015 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waldoj/5226202 to your computer and use it in GitHub Desktop.
Save waldoj/5226202 to your computer and use it in GitHub Desktop.
The steps required to get CKAN running on Ubuntu 12.10. Note that they are not the same as [the official instructions](http://docs.ckan.org/en/latest/install-from-source.html), because those do not work.
# Spin up an Ubuntu 12.10 LTS (64bit) server.
# The following are based on the source install of CKAN....
# http://ckan.readthedocs.org/en/latest/install-from-source.html
# install dependencies
sudo apt-get update
sudo apt-get install python-dev postgresql libpq-dev python-pip python-virtualenv git-core libcap-dev
# We'll install in the ubuntu user's home directory, i.e.
# /home/ubuntu/pyenv/src/ckan
# prepare Python environment
virtualenv --no-site-packages pyenv
. pyenv/bin/activate
pip install -e 'git+https://github.com/okfn/ckan.git@ckan-1.8#egg=ckan'
# Install CKAN dependencies, then fix up the shell.
pip install -r pyenv/src/ckan/pip-requirements.txt
pip install webob==1.0.8
sudo apt-get install python-psycopg2
deactivate
. pyenv/bin/activate
# Creating a fresh CKAN database.
sudo -u postgres psql -l # ...make sure the collation/ctype are en_US.UTF-8, if not, stop
sudo -u postgres createuser -S -D -R -P ckan # ...it asks for a password, remember for later
sudo -u postgres createdb -O ckan ckan -E utf-8 # user 'ckan' owns database 'ckan'
# Create the CKAN .ini file.
cd pyenv/src/ckan
paster make-config ckan development.ini
# Then update ckan.site_url, sqlalchemy.url, and the log file location in the handler_file section at the end.
# (see http://ckan.readthedocs.org/en/latest/deployment.html)
# Configure a local Solr.
sudo apt-get install solr-jetty openjdk-6-jdk
sudo sed -i "s/NO_START=.*/NO_START=0/" /etc/default/jetty
sudo sed -i "s/^#*JETTY_HOST=.*/JETTY_HOST=127.0.0.1/" /etc/default/jetty
sudo sed -i "s/^#*JETTY_PORT=.*/JETTY_PORT=8983/" /etc/default/jetty
sudo sed -i "s|^#*JAVA_HOME=.*|JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/|" /etc/default/jetty
sudo mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.xml.bak
sudo ln -s ~/pyenv/src/ckan/ckan/config/solr/schema-1.4.xml /etc/solr/conf/schema.xml
sudo rm /usr/share/jetty/webapps/solr # remove bad link
sudo ln -s /usr/share/solr/web /usr/share/jetty/webapps/solr
sudo service jetty start
wget -qO- http://localhost:8983/solr/ |grep "Welcome to Solr"
# ...verify you see <title>Welcome to Solr</title>
# Initialize the CKAN database.
paster --plugin=ckan db init --conf ~/conf/ckan.ini
# Set up the DataStore
# http://web.archiveorange.com/archive/v/zU249zTPFULFLkFO5A5F
cd ~/pyenv/src/ckan/
paster --plugin=ckan datastore set-permissions postgres
# Other setup things that the instructions tell us to do...
ln -s ~/pyenv/src/ckan/who.ini ~/conf/
cd ~/conf
mkdir -p data sstore
sudo chmod a+w -R ~/conf/{data,sstore}
# Verify CKAN functions! First, start the development server.
# Then in another terminal open up http://127.0.0.1:5000.
sudo paster serve ~/pyenv/src/ckan/development.ini
wget -qO- http://127.0.0.1:5000|grep Welcome # in another terminal!
# ...should see: <title>Welcome - CKAN</title>
# Kill paster.
# Apache deployment.
sudo aptitude install apache2 libapache2-mod-wsgi
# You'll need a wsgi file and an Apache conf file.
# I have examples of that too........
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment