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)
rpmdev-setuptree

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:
wget http://grass.osgeo.org/grass64/source/grass-6.4.1.tar.gz
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

3 thoughts on “GRASS 6.4.1 on Scientific Linux 6.0

  1. Excellent guide… thanks. I’ve Grass 6.4.1 installed and runing in SL 6.1. Only add: install unixODBC-devel, and copy grass.desktop too to rpmbuild/SOURCE directory. In my case rpms are in rpmbuild/RPMS/x86_64/. Regards.

  2. You can also use rpmdev-extract to unpack any RPM. It is part of the same package, as rpmdev-setuptree is.

    Besides that, you can use yum-builddep , which is part of yum-utils, to comfortably install all build dependencies.

    Just replacing the tarball and changing the version number is brave. ;)

    I’d like to mention, that if you don’t change anything, you don’t have to unpack the SRPM at all, but use instead:

    rpmbuild –rebuild

    “You can not just install the src rpm, since it’s configured for a different distro.” — Well, the SRPM is not configured for anything actually, but the RPMs are linked against specific versions of libraries, etc. Just rebuild the SRPM, like I mentioned above.

    It’s even more elegant to use Mock (EPEL). It’s a chroot environment to build or rebuild your packages. This way, you don’t need to install the development libraries on your actual system. In that case, build a new SRPM with rpmbuild -bs and then throw that into Mock.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>