Created
March 21, 2013 12:34
-
-
Save JoshData/5212696 to your computer and use it in GitHub Desktop.
Deploy CKAN 2 beta from source on Ubuntu 12.04 64bit w/ Solr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Spin up an Ubuntu 12.04 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 | |
# 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/[email protected]#egg=ckan' | |
# Install CKAN dependencies, then fix up the shell. | |
pip install -r pyenv/src/ckan/pip-requirements.txt | |
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 | |
mkdir ~/conf | |
paster make-config ckan ~/conf/ckan.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-2.0.xml /etc/solr/conf/schema.xml | |
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 | |
# 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. | |
paster serve ~/conf/ckan.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