Created
August 26, 2011 07:27
-
-
Save skull-squadron/1172907 to your computer and use it in GitHub Desktop.
Install django on ubuntu 10.04 lts
This file contains hidden or 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
#!/bin/sh | |
if [ `id -u` -ne 0 ]; then | |
echo "Rerun $0 as root" | |
exit 1 | |
fi | |
# Install pip | |
apt-get install -y --no-install-recommends python-setuptools python-dev || exit 1 | |
easy_install -U pip || exit 1 | |
# Install virtualenv | |
pip install --upgrade virtualenv || exit 1 | |
# Install supervisor for managing uwsgi processes | |
pip install --upgrade supervisor || exit 1 | |
# Install django-evolution for doing automagic django database scheme migrations | |
pip install --upgrade django_evolution || exit 1 | |
# Consider south instead for fixed migrations | |
# pip install --upgrade -U South || exit 1 | |
# Install postgres | |
apt-get install -y --no-install-recommends postgresql || exit 1 | |
# Make template1 UTF8 instead of US_ASCII | |
su - postgres -c psql << EOF | |
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1'; | |
DROP DATABASE template1; | |
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE'; | |
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; | |
\c template1 | |
VACUUM FREEZE; | |
UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template1'; | |
\q | |
EOF | |
# Enable admin pack | |
apt-get install -y --no-install-recommends postgresql-contrib | |
su - postgres -c "psql -d postgres < /usr/share/postgresql/8.4/contrib/adminpack.sql" | |
# Install the python postgres bindings | |
apt-get install -y --no-install-recommends python-dev libpq-dev || exit 1 | |
pip install --upgrade psycopg2 || exit 1 | |
# Install django-debug-toolbar | |
pip install --upgrade django-debug-toolbar || exit 1 | |
# Install the latest uwsgi (lts) | |
apt-get install -y --no-install-recommends libxml2-dev build-essential || exit 1 | |
wget --continue http://projects.unbit.it/downloads/uwsgi-lts.tar.gz || exit 1 | |
echo '1703b6baa8333c898671028e30ed9dd2 uwsgi-lts.tar.gz' | md5sum -c && \ | |
pip install uwsgi-lts.tar.gz | |
rm -f uwsgi-lts.tar.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Todo: 1. add install-nginx.sh (and nginx config) 2. add supervisor config 3. start supervisor