Install Django centos redhat

November 8, 2012

To install Django on Centos or Redhat

echo "Installing httpd and httpd-devel"
yum -q -y --enablerepo=ius install httpd httpd-devel > /dev/null 2>&1
chkconfig httpd on
sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf
service varnish start
service httpd start		

To Install Python 2.7.2 on redhat or centos
echo "Install Python 2.7.2"
mkdir -p /usr/local/src/python.2.7.2.install
cd /usr/local/src/python.2.7.2.install
wget "http://downloads.activestate.com/ActivePython/releases/2.7.2.5/ActivePython-2.7.2.5-linux-x86_64.tar.gz"
tar xzvf ActivePython-2.7.2.5-linux-x86_64.tar.gz
cd ActivePython-2.7.2.5-linux-x86_64
./install.sh -I /opt/ActivePython-2.7

echo "Install mod_wsgi"
wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
tar -zxvf mod_wsgi-3.3.tar.gz
cd mod_wsgi-3.3
./configure --enable-shared --prefix=/opt/mod_wsgi-3.3 --with-python=/opt/ActivePython-2.7/bin/python
make
make install

echo "Installing memcached"
yum -y --enablerepo=ius install memcached
sed -i 's/1024/20480/g' /etc/sysconfig/memcached
sed -i 's/64/1024/g' /etc/sysconfig/memcached
service memcached restart

echo "Installing Django"
export PATHOLD=$PATH
export PATH=/opt/ActivePython-2.7/bin:/root/.local/bin:$PATH
pypm -g install django
pypm -g install mysql-python
pypm -g install python-memcached 1.48
export PATH=$PATHOLD