понедельник, 23 февраля 2009 г.

Steps for setup python2.5 django and satchmo on CentOS

# This post is HOW TO Install python2.5 and django and satchmo on CentOS
# You can copy this post to file and run: $ sudo sh this-post-text-file
# See also:
# http://www.perplexedlabs.com/2008/11/10/setup-python-25-mod_wsgi-and-django-10-on-centos-5-cpanel/


### Setup Python2.5 and setuptools
# Install gcc
yum -y install gcc

# Python2.5 + CentOS + ziplib, fix error: zipimport.ZipImportError: can’t decompress data; zlib not available
# for fix
# See also: http://brichotomy.com/post/49322472/python-2-5-zlib-on-centos-5
yum -y install zlib-devel

# fix: django.core.exceptions.ImproperlyConfigured: Error loading sqlite3 module: No module named _sqlite3
yum -y install sqlite-devel

# Setup python2.5.4 (before MUST setup zlib-devel). To avoid static link by python modules(e.g. mod_python) you should run configure script with "--enable-shared" option
cd /tmp
wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tgz
tar xvfz Python-2.5.4.tgz
cd Python-2.5.4
./configure --enable-shared
make
make install

# Enable to find your dyamic link liblary
echo /usr/local/lib > /etc/ld.so.conf.d/python2.5.conf
ldconfig


# Setup easy_install (setuptools)
cd /tmp
wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg
sh setuptools-0.6c9-py2.5.egg


### Setup Django
# See also: http://docs.djangoproject.com/en/dev/topics/install/
yum -y install subversion
mkdir /home/apps
svn co http://code.djangoproject.com/svn/django/trunk/ /home/apps/django-trunk
ln -s /home/apps/django-trunk/django /usr/local/lib/python2.5/site-packages/django
ln -s /home/apps/django-trunk/django/bin/django-admin.py /usr/local/bin


### Setup Dependencies for Satchmo
# See also:http://www.satchmoproject.com/docs/svn/new_installation.html
easy_install-2.5 pycrypto
easy_install-2.5 http://code.enthought.com/enstaller/eggs/rhel/3/Reportlab-2.1.0001-py2.5.egg
easy_install-2.5 django-registration

cd /tmp
wget http://www.satchmoproject.com/snapshots/trml2pdf.tar.gz
tar xvfz trml2pdf.tar.gz
cp -R /tmp/trml2pdf/trml2pdf /usr/local/lib/python2.5/site-packages

easy_install-2.5 PyYAML
easy_install-2.5 --find-links=http://download.zope.org/distribution PILwoTk

cd /temp
wget http://banjo.assembla.com/spaces/threaded_multihost/documents/cN9MkM2jyr3Aayab7jnrAJ/download/django_threaded_multihost-1.3_0-py2.5.egg
easy_install-2.5 django_threaded_multihost-1.3_0-py2.5.egg

svn checkout http://django-app-plugins.googlecode.com/svn/trunk/ /home/apps/django-app-plugins
ln -s /home/apps/django-app-plugins/app_plugins /usr/local/lib/python2.5/site-packages/app_plugins

svn co http://sorl-thumbnail.googlecode.com/svn/trunk/sorl/ /home/apps/sorl
ln -s /home/apps/sorl /usr/local/lib/python2.5/site-packages/sorl

### Setup Satchmo
svn co svn://satchmoproject.com/satchmo/trunk /home/apps/satchmo-trunk
cd /home/apps/satchmo-trunk
python2.5 setup.py install

# setup compleeted, test correct
# first test:
# step 4 in http://www.satchmoproject.com/docs/svn/new_installation.html#installing-satchmo-into-your-path
# second test:
# cd /home/apps/satchmo-trunk/satchmo/projects/simple
# python2.5 manage.py runserver
# go to: http://localhost:8000, you can see simple shop

#
#if django running by mod_python we need upgrade mod_python for work with python2.5
#

# "apxs" is extension development framework for Apache web server. mod_python requires apxs
yum -y install httpd-devel

# mod_python; IMPORTANT: you must specify "--with-python"
cd /tmp
wget http://apache.mirrors.redwire.net/httpd/modpython/mod_python-3.3.1.tgz
tar xvfz mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure --with-python=/usr/local/bin/python2.5
make
make install

# add mod_python to Apache config and restart web server
echo LoadModule python_module /usr/lib/httpd/modules/mod_python.so\ > /etc/httpd/conf.d/python.conf

service httpd restart


# setup sqlite for python2.4

cd /tmp
wget http://oss.itsystementwicklung.de/download/pysqlite/2.5/2.5.5/pysqlite-2.5.5.tar.gz
tar xvfz pysqlite-2.5.5.tar.gz
cd pysqlite-2.5.5
python setup.py

# setup sqllite via easy_install for python2.4
uname -a

yum -y install python-devel
yum -y install sqlite-devel

cd /tmp

wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c9-py2.4.egg
sh setuptools-0.6c9-py2.4.egg
easy_install pysqlite


# alternative install setuptools
yum -y install python-setuptools

# install PIL
easy_install --find-links http://www.pythonware.com/products/pil/ Imaging


setup postgre
http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html