Saturday, 15 January 2011

Install EPEL Repository on CENTOS

Just putting this here:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Wednesday, 12 January 2011

Install latest Python on Centos

This script will download, compile and install a newer version of Python on CENTOS / RedHat 5.* in a way which respects the underlying Python 2.4 used by Yum etc.

Based on http://www.venkysblog.com/install-python264-modwsgi-and-django-on-cento and http://binarysushi.com/blog/2009/aug/19/CentOS-5-3-python-2-5-virtualevn-mod-wsgi-and-mod-rpaf/.

# wget -O install_python.sh https://gist.github.com/raw/777001/install_python.sh
# chmod +x install_python.sh
# ./install_python.sh
#!/bin/sh
echo "******************************************"
echo "Configure Centos box with a recent version"
echo "of Python. "
echo " - jgumbley 12/jan/11"
echo "******************************************"
echo " - Get source for Python"
cd /usr/local/src
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar xvfz Python-2.7.1.tgz
echo " - Install compilers"
yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-develsqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel make
echo " - Compile Python source"
cd Python-2.7.1
./configure --prefix=/opt/python2.7.1 --with-threads --enable-shared
make
make install
echo " - Add shared libraries in"
touch /etc/ld.so.conf.d/opt-python2.7.1.conf
echo "/opt/python2.7.1/lib/" >> /etc/ld.so.conf.d/opt-python2.7.1.conf
ldconfig
echo " - Create SymLink to updated version"
ln -sf /opt/python2.7.1/bin/python /usr/bin/python2.7
echo " - Install SetupTools."
cd /usr/local/src
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.1
echo " - Install pip."
/opt/python2.7.1/bin/easy_install pip
ln -sf /opt/python2.7.1/bin/pip /usr/bin/pip
echo " - Install virtualenv."
pip install virtualenv
ln -sf /opt/python2.7.1/bin/virtualenv /usr/bin/virtualenv
echo " - Pipe alias into .zshrc "
echo "alias python=/opt/python2.7.1/bin/python" >> ~/.zshrc
source ~/.zshrc
# wget -O install_python.sh https://gist.github.com/raw/777001/install_python.sh
# chmod +x install_python.sh
# ./install_python.sh
#!/bin/sh
echo "******************************************"
echo "Configure Centos box with apache and "
echo "mod_wsgi for running flask apps "
echo " - jgumbley 15/jan/11"
echo "******************************************"
echo " # install required apache pre-reqs "
yum -y install httpd httpd-devel
echo " # download mod_wsgi source "
cd /usr/local/src/
wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
tar xvfz mod_wsgi-3.3.tar.gz
echo " # compile mod_wsgi source "
cd mod_wsgi-3.3
./configure --with-python=/opt/python2.7.1/bin/python
make
make install
echo " # pipe module into httpd config"
echo "LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so" >> /etc/httpd/conf/httpd.conf
service httpd restart

ZSH and .zshrc

Apparently ZSH is quite good so I'm going to try it out. On most Linux distros this is going to be installed anyway, but the steps are:

yum install zsh
chsh -s /bin/zsh


Here are some links about customizing it:

Sunday, 2 January 2011

Unicode

Seems like a good article, this has always seemed a little mysterious.
I especially found the part about http-equiv content type useful. It had always bothered me how you could specify the character encoding after the start of the file. As it turns out it is a compromise and I am not the only person who had wondered about it.