Upgrading RHEL/CentOS v 7.x to GLIBC version 2.20

Compiling GLIBC-2.x from SOURCE RPM Package:

Background: the latest version of GLIBC from RHEL/CentOS for v7.7 is glibc-2.17. Some software require newer version (2.18 or newer). In the procedure below, I build GLIBC version 2.20 (you can also build version 2.18 using the same procedure).

  • Setup VirtualBox v 7.0.6 e.g., on Windows. So RHEL 7.7 on VirtualBox v7.0.6 used to compile glibc-2.20 or glibc-2.18 source RPM is the working combination.
    Note1: compiling/rebuilding the glibc-2.18 from source rpm consistently crashed VB v 7.0.4 on Windows)

  • Setup RHEL 7.7 from the DVD in a VM

  • Configure the Installation DVD (attached to the VM and mounted on /mnt) as a repo:
    [root@rhel77c ~]# mount /dev/cdrom /mnt
    [root@rhel77c ~]# cp /mnt/media.repo /etc/yum.repos.d/
    [root@rhel77c ~]#
    [root@rhel77c ~]# vi /etc/yum.repos.d/media.repo
    [root@rhel77c ~]#
    [root@rhel77c ~]# cat /etc/yum.repos.d/media.repo
    [InstallMedia]
    name=Red Hat Enterprise Linux 7.7
    mediaid=1563892373.442998
    metadata_expire=-1
    gpgcheck=0
    cost=500
    enabled=1
    baseurl=file:///mnt/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

  • Install required packages:
    [root@rhel77c ~]# yum install -y yum-utils gcc wget rpm-build
    [root@rhel77c ~]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    [root@rhel77c ~]# yum localinstall -y epel-release-latest-7.noarch.rpm
    [root@rhel77c ~]# yum install -y libpng-devel zlib-devel texinfo libselinux-devel audit-libs-devel libcap-devel nss-devel systemtap-sdt-devel
    [root@rhel77c ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/gd-2.0.35-26.el7.x86_64.rpm
    [root@rhel77c ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/gd-devel-2.0.35-26.el7.x86_64.rpm
    [root@rhel77c ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libstdc++-4.8.5-44.el7.x86_64.rpm
    [root@rhel77c ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libstdc++-static-4.8.5-44.el7.x86_64.rpm

– Make sure the DVD ISO is attached to the VM and mounted as yum will install dependencies from it:
      [root@rhel77c ~]# mount /dev/cdrom /mnt

  • Install the packages that were just downloaded (above):
    [root@rhel77c ~]# yum install -y gd* libstdc*

  • Download the glibc-2.x source RPM and rebuild it:
    [root@rhel77c ~]# wget ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/updates/21/SRPMS/g/glibc-2.20-8.fc21.src.rpm
    [root@rhel77c ~]# rpmbuild –rebuild glibc-2.20-8.fc21.src.rpm

  • Some of the Generated RPMs:
    /root/rpmbuild/RPMS/x86_64/glibc-2.20-8.el7.x86_64.rpm
    /root/rpmbuild/RPMS/x86_64/glibc-devel-2.20-8.el7.x86_64.rpm
    /root/rpmbuild/RPMS/x86_64/glibc-headers-2.20-8.el7.x86_64.rpm
    /root/rpmbuild/RPMS/x86_64/glibc-common-2.20-8.el7.x86_64.rpm

  • Testing: Upgrade the system’s GLIBC or transfer the files to another system to upgrade that system’s GLIBC version e.g.,:
    [root@rhel77c2 ~]# rpm -qa | grep glibc
    glibc-2.17-292.el7.x86_64
    glibc-devel-2.17-292.el7.x86_64
    glibc-common-2.17-292.el7.x86_64
    glibc-headers-2.17-292.el7.x86_64
    [root@rhel77c2 ~]#
    [root@rhel77c2 ~]# yum localinstall -y glibc-2.20-8.el7.x86_64.rpm glibc-common-2.20-8.el7.x86_64.rpm glibc-devel-2.20-8.el7.x86_64.rpm glibc-headers-2.20-8.el7.x86_64.rpm
    [root@rhel77c2 ~]#
    [root@rhel77c2 ~]# rpm -qa | grep glibc
    glibc-common-2.20-8.el7.x86_64
    glibc-2.20-8.el7.x86_64
    glibc-devel-2.20-8.el7.x86_64
    glibc-headers-2.20-8.el7.x86_64
    [root@rhel77c2 ~]#


Reference links:
https://github.com/sclorg/centos-release-scl
https://centos.pkgs.org/7/centos-updates-x86_64/
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/updates/21/SRPMS/g/glibc-2.20-8.fc21.src.rpm
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/releases/20/Fedora/source/SRPMS/g/glibc-2.18-11.fc20.src.rpm


EXTRAS:
————————————-

Installing GCC v 7.3.1/8.3.1/9.3.1 on RHEL/CENTOS v 7.x via the SCL (Software Collection) repository.
In order to gain access to SCLs for CentOS, you need to install the CentOS Linux Software Collections release file. It is part of the CentOS Extras repository (x86_64 only).

NOTE: RHEL v7.7 comes with gcc version 4.8.5. If you need a newer gcc version, you can install GCC versions 7.3.1/8.3.1/9.3.1 via the SCL package “devtoolset-7” or “devtoolset-8” or “devtoolset-9”.

  • On a CentOS system, enable the SCL repo with the command “yum install -y centos-release-scl”. On a RHEL system, enable the SCL repo with the command:
    [root@rhel77c ~]# yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm

  • Install devtoolset-7 and/or devtoolset-8:
    [root@rhel77c ~]# yum install -y devtoolset-7
    [root@rhel77c ~]# yum install -y devtoolset-8

  • To install devtoolset-9:
    [root@rhel77c ~]# yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/source-highlight-3.1.6-6.el7.x86_64.rpm
    [root@rhel77c ~]# yum install -y devtoolset-9

NOTE: devtoolset-7/8/9 files are installed in /opt/rh/devtoolset-7/ (or /opt/rh/devtoolset-8/ or /opt/rh/devtoolset-9/ as applicable). So GCC compiler and supporting binaries will be in /opt/rh/devtoolset-7/root/usr/bin/ (or /opt/rh/devtoolset-8/root/usr/bin/ or /opt/rh/devtoolset-9/root/usr/bin/ as applicable).

  • In order to use the compiler that comes with the devtoolset, temporarily or permanently adjust your PATH variable so that it is found first before the system’s default gcc version 4.8.5 e.g.,
    [root@rhel77c ~]# export PATH=/opt/rh/devtoolset-7/root/usr/bin:$PATH
    [root@rhel77c ~]# export LD_LIBRARY_PATH=/opt/rh/devtoolset-7/root/usr/lib64/
    [root@rhel77c ~]# gcc –version