GRASS 6.4.1 on Scientific Linux 6.0

The latest stable release of GRASS GIS is 6.4.1. Binaries are already available for several operating systems and distros, but not yet for RHEL 6 or its clones. With the legwork done by the folks at FedoraProject, we can prepare RPMs and install GRASS with little ado also on SL6

We begin, as usual, getting the basic tools for building, the python GUI software and the GIS stack of libraries. The best approach is to configure your system to use the EPEL repository. Here’s the list of required packages (run as root):

yum install geos proj proj-epsg gdal proj-devel geos-devel gdal-devel proj-nad
yum install gcc gcc-c++ gcc-gfortran flex byacc ncurses-devel bison pkgconfig readline-devel blas-devel lapack-devel
yum install wxPython wxPython-devel wxGTK wxGTK-devel swig python-psycopg2 numpy PyQt4 PyQt4-devel sip sip-devel
yum install mesa-libGLU-devel libXmu-devel lesstif lesstif-devel libjpeg-devel
yum install tcl tcl-devel tk tk-devel fftw2 fftw2-devel hdf5
yum install unixODBC postgresql-devel mysql-devel sqlite-devel freetype-devel

One of the dependencies for building GRASS: mesa-libGLw and mesa-libGLw-devel is still missing from the Scientific Linux and EPEL repositories. But it’s available for Fedora, and the Fedora 13 binary seems to install fine. So download both of the above from the Fedora Project website (be sure to choose the correct package for your architecture). and run
rpm -Uhv mesa-libGLw-*fc15*
to get them installed.
Now download the Fedora source rpm for GRASS from here for GRASS 6.4.0 . Yes it’s currently one minor version behind, but we’ll fix that presently…
You can not just install the src rpm, since it’s configured for a different distro. But all we want it to extract the spec file and patches. Here’s a simple way to do that (no root privileges here):
rpm2cpio grass-6.4.0-3.fc15.src.rpm | cpio -idmv
This breaks open the rpm archive and extracts all its files.

OK, time to setup your rpm build environment (See the Fedora Project wiki for details)

From the Fedora source rpm that we unpacked a moment ago copy all the *.patch and the grasslogo_vector_small.png into the ~/rpmbuild/SOURCES directory. Also copy the grass.spec file into the ~/rpmbuild/SPECS directory. Next we download the grass source tarball for 6.4.1: Change into the rpmbuild SOURCES directory and get the source:
Now we must enter one last simple change to the spec file in order to build this latest version. Open ~/rpmbuild/SPECS/grass.spec with your favorite editor and alter the second line to read:
Version: 6.4.1
instead of the original 6.4.0

Now we should be ready to roll. Change into the spec directory and issue:
rpmbuild -bb grass.spec
Time for a beverage while the computer churns along. When it’s done, you should have, under the rpmbuild/RPMS directory three grass*.rpm files.
At this point you need to get root privileges again for installing and:
rpm -Uhv rpmbuild/RPMS/grass*.rpm

Leave a Reply

Your email address will not be published. Required fields are marked *