fbpx

How to Update glibc Newer Version on Centos 6.x

How to Update glibc Newer Version on Centos 6.x

You tried to runs some commands and got error about your glibc version is not high enough to complete your command. Thus, You may need newer version glibc on your Centos 6.x VPS server. I will show you how to update glibc.

How to Update glibc Newer Version on Centos 6.x

We have two way to accomplish this task. One way is that compile from source which take too long time to do that. Another way is that get files from repo which is relatively easy step.

Lets first check our glibc versions that installed in our VPS server:

strings /lib64/libc.so.6 | grep GLIBC

Result:

GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12

 

1.  Compile glibc From Source

We can get soruce file in 2 ways, using git or ftp. You can get latest version from git. We need GLIBC_2.17 version for our centos 6.x so we will use ftp.

mkdir ~/glibc-install; cd ~/glibc-install
wget http://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz
tar -zxvf glibc-2.17.tar.gz

After Download and extract all source files we need to create a build folder. It is better way to have another folder for build.

cd glibc-2.17
mkdir build

We need to put files  separete place in order to not corrput our linux system. /opt/glibc-2.17

cd build
../configure --prefix=/opt/glibc-2.17

We can start compiling our source files. It will take hours depending your CPU cores. You can find your <number of CPU Cores> by using nproc command.

make -j<number of CPU Cores>
make install

After compiling is done we need to show place of our new glibc to program we are gonna use. In order to do that follow step below;

 

LD_LIBRARY_PATH=/opt/glibc-2.17/lib

export LD_LIBRARY_PATH.

Furing your current login session on VPS Library is exposed

Another way is that creating symbolic link :

ln -sf /opt/glibc-2.17/glibc-2.17.so /lib/libc.so.6.

I do not recommend this step because linux use older version of glibc and if you create a symbolic link somethings will sure go wrong.

If you are not experienced system administrator do not play with glibc, it might break your Linux system.

2. Using RPM to install new version of glibc

Update glibc to 2.17 for CentOS 6

I found a script from github. We will use it. Lets appreciated his work : https://gist.github.com/harv/f86690fcad94f655906ee9e37c85b174

Script :


#! /bin/sh

# update glibc to 2.17 for CentOS 6

wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm

sudo rpm -Uvh glibc-2.17-55.el6.x86_64.rpm \
glibc-common-2.17-55.el6.x86_64.rpm \
glibc-devel-2.17-55.el6.x86_64.rpm \
glibc-headers-2.17-55.el6.x86_64.rpm

You might ecounter some errors: “error: Failed dependencies:

To fix it just add this parameter --force --nodeps at the end of the all command.

After finished up lets check again :

strings /lib64/libc.so.6 | grep GLIBC

Result :

GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE

We have GLIBC_2.17 on our centos 6.x VPS server.

If you have a question just post as a comment and i will reply it as soon as possible.

1 thought on “How to Update glibc Newer Version on Centos 6.x

Leave a Reply

Your email address will not be published.