Home  >  Article  >  System Tutorial  >  Detailed steps for upgrading glibc on Centos6.5

Detailed steps for upgrading glibc on Centos6.5

PHPz
PHPzforward
2024-01-07 16:29:491208browse

Scene requirements

Note that there are certain risks in updating the system library, please operate with caution
The default Centos6.5 glibc version is up to 2.12, and when developing Nodejs, the packages that the project depends on often require higher version of the glibc library support. Therefore, without upgrading the system, you need to actively update the system glibc library. Generally, when you encounter the error libc.so.6: version GLIBC_2.14 not found, it means that glibc needs to be upgraded.
glibc version

To view the system glibc library version, use the following command:

$ strings /lib64/libc.so.6 |grep GLIBC_

Centos6.5 outputs the following glibc version list. From this figure, we can see that the system supports up to version 2.12 of glibc:

Detailed steps for upgrading glibc on Centos6.5

In addition, execute $ ll /lib64/libc** and you can see that libc.so.6 at this time is an alias of libc-2.12.so, as shown in the following figure:

Detailed steps for upgrading glibc on Centos6.5

glibc installation
First, click here to download glibc, click to download, and get glibc-2.14.tar.gz. Use the following command to decompress glibc-2.14.tar.gz:

$ tar -xzvf glibc-2.14.tar.gz 

Get the directory glibc-2.14 in the current directory, execute the $cd glibc-2.14 command to enter the directory, and execute the following commands in sequence to compile and install glibc-2.14:

$ mkdir build // 在glibc-2.14目录下建立build文件夹
$ cd build // 进入build目录
$ ../configure --prefix=/opt/glibc-2.14 // 配置glibc并设置当前glibc-2.14安装目录
$ make && make install // 编译安装glibc-2.14库

glibc soft link

After the installation is completed, create a soft link pointing to glibc-2.14 and execute the following command:

$ rm -rf /lib64/libc.so.6 // 先删除先前的libc.so.6软链
$ ln -s /opt/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6

Note
After deleting libc.so.6, system commands may become unavailable. You can use the following methods to solve the problem:

$ LD_PRELOAD=/opt/glibc-2.14/lib/libc-2.14.so ln -s /opt/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6

If the above update fails, you can use the following command to restore:

$ LD_PRELOAD=/lib64/libc-2.12.so ln -s /lib64/libc-2.12.so /lib64/libc.so.6 // libc-2.12.so 此项是系统升级前的版本

At this time, check the system glibc version as shown below:

Detailed steps for upgrading glibc on Centos6.5

You can see that the current highest version of glibc is 2.14, and the libc.so.6 soft link points to the following figure:

Detailed steps for upgrading glibc on Centos6.5

The above is the detailed content of Detailed steps for upgrading glibc on Centos6.5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete