Install modern compilers in CentOS / RHEL

Very often we need a more modern compiler than is included in base CentOS, particularly for HPC systems. It does require admin (sudo) privileges to install the programs, but they can be loaded by any user thereafter. DevToolset comes from RHEL and works on RHEL and CentOS.

Install

The one-time install will be like the gfortran example below:

yum install centos-release-scl
yum install devtoolset-7-gcc devtoolset-7-gcc-gfortran

Availability

  • devtoolset-7 is available for CentOS / RHEL 6 and 7.
  • devtoolset-8 was available for RHEL but not yet available for CentOS in January 2019, but should be coming soon.

Load

You can type the following or put it in the user’s ~/.bashrc

scl enable devtoolset-7 bash

Verify

gfortran --version