Tuesday, November 22, 2011

Installing mercurial on CentOS or RHEL 4

For mercurial/hg you need a relatively new version of python installed. Since that is not available as an rpm let's compile the source.

From http://python.org/download/ download a python source version like http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz

From http://mercurial.selenic.com/release/ download a mercurial source drop like http://mercurial.selenic.com/release/mercurial-1.7.5.tar.gz

Run the following commands as root:
#Install some dependencies
yum install zlib-devel.i386 ncurses-devel.i386 openssl-devel.i386 readline-devel.i386 bzip2-devel.i386

#Extract the python code
tar xvzf Python-2.7.2.tgz
cd Python-2.7.2

# Python will be installed in /opt/python27
make clean; ./configure --prefix=/opt/python27; make; make install
cd ..

# Extract the mercurial code
tar xvzf mercurial-1.7.5.tar.gz
cd mercurial-1.7.5

#Python will be installed in /opt/hg17
make install PYTHON=/opt/python27/bin/python PREFIX=/opt/hg17

#Add new python and mercurial to PATH
export PATH=/opt/python27/bin:/opt/hg17/bin:$PATH

No comments: