How to install glibc package version 2.28+ on RHEL 7 unofficially for testing purposes?

In this post, we will see an interesting topic how to install glibc package version 2.28 on RHEL 7 or CentOS 7.

CentOS or RHEL does not officially support this and provides glibc version 2.17 as official version.

Since these packages affect the core OS, upgrading unofficial version makes your OS out of support.

However in some scenarios we need this version for testing.

Hence i thought to put this trick here.

 

1. Download glibc 2.28 packages.

[root@ngelinux001 ~]# wget http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/glibc-devel-2.28-158.el8.x86_64.rpm
--2022-05-12 04:37:43-- http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/glibc-devel-2.28-158.el8.x86_64.rpm
Resolving mirror.centos.org (mirror.centos.org)... 198.15.72.18, 2600:1f14:fad:5c02:ccad:ce61:a8ed:ba90
Connecting to mirror.centos.org (mirror.centos.org)|198.15.72.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1075944 (1.0M) [application/x-rpm]
Saving to: 'glibc-devel-2.28-158.el8.x86_64.rpm'
100%[====================================================================================>] 1,075,944 --.-K/s in 0.1s
2022-05-12 04:37:43 (7.12 MB/s) - 'glibc-devel-2.28-158.el8.x86_64.rpm' saved [1075944/1075944]

[root@ngelinux001 ~]# wget https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/nscd-2.28-158.el8.x86_64.rpm
--2022-05-12 04:39:26-- https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/nscd-2.28-158.el8.x86_64.rpm
Resolving rpmfind.net (rpmfind.net)... 195.220.108.108
Connecting to rpmfind.net (rpmfind.net)|195.220.108.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 135432 (132K) [application/x-rpm]
Saving to: 'nscd-2.28-158.el8.x86_64.rpm'
100%[====================================================================================>] 135,432 270KB/s in 0.5s
2022-05-12 04:39:27 (270 KB/s) - 'nscd-2.28-158.el8.x86_64.rpm' saved [135432/135432]
[root@ngelinux001 ~]#

[root@ngelinux001 eag]# wget http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/glibc-common-2.28-164.el8.x86_64.rpm
--2022-05-12 04:31:01-- http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/glibc-common-2.28-164.el8.x86_64.rpm
Resolving mirror.centos.org (mirror.centos.org)... 67.222.128.246, 2604:1580:fe02:2::10
Connecting to mirror.centos.org (mirror.centos.org)|67.222.128.246|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1378856 (1.3M) [application/x-rpm]
Saving to: ‘glibc-common-2.28-164.el8.x86_64.rpm’
100%[====================================================================================>] 1,378,856 4.55MB/s in 0.3s
2022-05-12 04:31:01 (4.55 MB/s) - ‘glibc-common-2.28-164.el8.x86_64.rpm’ saved [1378856/1378856]

[root@ngelinux001 eag]# wget http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/glibc-langpack-sw-2.28-199.el8.x86_64.rpm
--2022-05-12 04:31:11-- http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/glibc-langpack-sw-2.28-199.el8.x86_64.rpm
Resolving mirror.centos.org (mirror.centos.org)... 67.222.128.246, 2604:1580:fe02:2::10
Connecting to mirror.centos.org (mirror.centos.org)|67.222.128.246|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 397584 (388K) [application/x-rpm]
Saving to: ‘glibc-langpack-sw-2.28-199.el8.x86_64.rpm’
100%[====================================================================================>] 397,584 1.58MB/s in 0.2s
2022-05-12 04:31:11 (1.58 MB/s) - ‘glibc-langpack-sw-2.28-199.el8.x86_64.rpm’ saved [397584/397584]
[root@ngelinux001 eag]#

 

2. Installing the packages one by one.

[root@ngelinux001 eag]# rpm -ivh ./glibc-langpack-sw-2.28-199.el8.x86_64.rpm --nodeps
warning: ./glibc-langpack-sw-2.28-199.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:glibc-langpack-sw-2.28-199.el8 ################################# [100%]
[root@ngelinux001 eag]#

[root@ngelinux001 ~]# rpm -ivh glibc-devel-2.28-158.el8.x86_64.rpm nscd-2.28-158.el8.x86_64.rpm --nodeps --force
warning: glibc-devel-2.28-158.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:nscd-2.28-158.el8 warning: /etc/nscd.conf created as /etc/nscd.conf.rpmnew
################################# [ 50%]
2:glibc-devel-2.28-158.el8 ################################# [100%]
[root@ngelinux001 ~]#

[root@ngelinux001 eag]# rpm -ivh ./glibc-common-2.28-164.el8.x86_64.rpm --nodeps --force
warning: ./glibc-common-2.28-164.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:glibc-common-2.28-164.el8 ################################# [100%]
[root@ngelinux001 eag]#

 

3. Link new installed binaries

[root@ngelinux001 lib]# pwd
/lib
[root@ngelinux001 lib]# ls -ltr | grep -i '2.17.so'
-rwxr-xr-x. 1 root root 40348 Jun 16 2017 librt-2.17.so
-rwxr-xr-x. 1 root root 22484 Jun 16 2017 libnss_hesiod-2.17.so
-rwxr-xr-x. 1 root root 36104 Jun 16 2017 libnss_db-2.17.so
-rwxr-xr-x. 1 root root 159636 Jun 16 2017 ld-2.17.so
-rwxr-xr-x. 1 root root 13128 Jun 16 2017 libutil-2.17.so
-rwxr-xr-x. 1 root root 63104 Jun 16 2017 libnss_nisplus-2.17.so
-rwxr-xr-x. 1 root root 40296 Jun 16 2017 libnss_compat-2.17.so
-rwxr-xr-x. 1 root root 110240 Jun 16 2017 libnsl-2.17.so
-rwxr-xr-x. 1 root root 34924 Jun 16 2017 libcrypt-2.17.so
-rwxr-xr-x. 1 root root 14156 Jun 16 2017 libanl-2.17.so
-rwxr-xr-x. 1 root root 7596 Jun 16 2017 libBrokenLocale-2.17.so
-rwxr-xr-x. 1 root root 136388 Jun 16 2017 libpthread-2.17.so
-rwxr-xr-x. 1 root root 50088 Jun 16 2017 libnss_nis-2.17.so
-rwxr-xr-x. 1 root root 195444 Jun 16 2017 libcidn-2.17.so
-rwxr-xr-x. 1 root root 2079172 Jun 16 2017 libc-2.17.so
-rwxr-xr-x. 1 root root 104220 Jun 16 2017 libresolv-2.17.so
-rwxr-xr-x. 1 root root 55024 Jun 16 2017 libnss_files-2.17.so
-rwxr-xr-x. 1 root root 25996 Jun 16 2017 libnss_dns-2.17.so
-rwxr-xr-x. 1 root root 307128 Jun 16 2017 libm-2.17.so
-rwxr-xr-x. 1 root root 18200 Jun 16 2017 libdl-2.17.so
lrwxrwxrwx. 1 root root 10 Apr 21 23:35 ld-linux.so.2 -> ld-2.17.so
lrwxrwxrwx. 1 root root 23 Apr 21 23:35 libBrokenLocale.so.1 -> libBrokenLocale-2.17.so
lrwxrwxrwx. 1 root root 14 Apr 21 23:35 libanl.so.1 -> libanl-2.17.so
lrwxrwxrwx. 1 root root 12 Apr 21 23:35 libc.so.6 -> libc-2.17.so
lrwxrwxrwx. 1 root root 15 Apr 21 23:35 libcidn.so.1 -> libcidn-2.17.so
lrwxrwxrwx. 1 root root 16 Apr 21 23:35 libcrypt.so.1 -> libcrypt-2.17.so
lrwxrwxrwx. 1 root root 13 Apr 21 23:35 libdl.so.2 -> libdl-2.17.so
lrwxrwxrwx. 1 root root 12 Apr 21 23:35 libm.so.6 -> libm-2.17.so
lrwxrwxrwx. 1 root root 14 Apr 21 23:35 libnsl.so.1 -> libnsl-2.17.so
lrwxrwxrwx. 1 root root 21 Apr 21 23:35 libnss_compat.so.2 -> libnss_compat-2.17.so
lrwxrwxrwx. 1 root root 17 Apr 21 23:35 libnss_db.so.2 -> libnss_db-2.17.so
lrwxrwxrwx. 1 root root 18 Apr 21 23:35 libnss_dns.so.2 -> libnss_dns-2.17.so
lrwxrwxrwx. 1 root root 20 Apr 21 23:35 libnss_files.so.2 -> libnss_files-2.17.so
lrwxrwxrwx. 1 root root 21 Apr 21 23:35 libnss_hesiod.so.2 -> libnss_hesiod-2.17.so
lrwxrwxrwx. 1 root root 18 Apr 21 23:35 libnss_nis.so.2 -> libnss_nis-2.17.so
lrwxrwxrwx. 1 root root 22 Apr 21 23:35 libnss_nisplus.so.2 -> libnss_nisplus-2.17.so
lrwxrwxrwx. 1 root root 18 Apr 21 23:35 libpthread.so.0 -> libpthread-2.17.so
lrwxrwxrwx. 1 root root 17 Apr 21 23:35 libresolv.so.2 -> libresolv-2.17.so
lrwxrwxrwx. 1 root root 13 Apr 21 23:35 librt.so.1 -> librt-2.17.so
lrwxrwxrwx. 1 root root 15 Apr 21 23:35 libutil.so.1 -> libutil-2.17.so
[root@ngelinux001 lib]#

Here we need to change all the links from 2.17.so library to 2.28 libraries exists in /usr/lib64 or /lib64 directory.

We need to delete all these links and create new ones.

The correct way is to build the package using below steps, however this seems to not work on RHEL 7 or CentOS 7

[user@ngelinux001 ~]$ wget http://gnu.bardia.tech/gnu/libc/glibc-2.28.tar.gz
–2022-05-12 00:46:17– http://gnu.bardia.tech/gnu/libc/glibc-2.28.tar.gz
Resolving gnu.bardia.tech (gnu.bardia.tech)… 185.142.159.242, 2a07:4282:159:496::2
Connecting to gnu.bardia.tech (gnu.bardia.tech)|185.142.159.242|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 32584904 (31M) [application/octet-stream]
Saving to: ‘glibc-2.28.tar.gz’

100%[====================================================================================>] 32,584,904 8.33MB/s in 4.9s

2022-05-12 00:46:24 (6.33 MB/s) – ‘glibc-2.28.tar.gz’ saved [32584904/32584904]

[user@ngelinux001 ~]$ tar -xvf glibc-2.28.tar.gz
glibc-2.28/
glibc-2.28/.gitattributes
glibc-2.28/.gitignore
glibc-2.28/COPYING
glibc-2.28/COPYING.LIB

[user@ngelinux001 ~/glibc-2.28]$ sudo ./configure
checking build system type… x86_64-pc-linux-gnu
checking host system type… x86_64-pc-linux-gnu
checking for gcc… gcc
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for readelf… readelf
checking for g++… g++
checking whether we are using the GNU C++ compiler… yes
checking whether g++ accepts -g… yes
checking whether g++ can link programs… no
configure: error: you must configure in a separate build directory
[user@ngelinux001 ~/glibc-2.28]$

[user@ngelinux001 ~/glibc-2.28]$ sudo mkdir eag /opt/glibc-2.28
mkdir: cannot create directory ‘eag’: File exists
[user@ngelinux001 ~/glibc-2.28]$ cd eag
[user@ngelinux001 eag]$

# make

# make install

1.6 10 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments