Publish: 2021-10-19 | Modify: 2021-11-22
There is a CentOS 6 system in the test environment that needs to set up an Android compilation environment. However, it is found that the Android SDK requires a minimum version of 2.14
for glibc, while CentOS 6 defaults to version 2.12
of glibc. This document records the process of upgrading glibc. Please backup the server before upgrading. It is not recommended to perform this operation in a production environment.
To check the glibc version of the system library, you can use the command:
strings /lib64/libc.so.6 |grep GLIBC_
Next, download glibc 2.14 and upgrade it:
# Download the source code package
wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
# Extract the package
tar -xvf glibc-2.14.tar.gz
# Enter the source code directory
cd glibc-2.14
# Create the build directory and enter it
mkdir build && cd build
# Compile glibc
../configure --prefix=/usr/local/glibc-2.14
make && make install
# Remove the original symbolic link first
rm -rf /lib64/libc.so.6
# Create a new symbolic link
ln -s /usr/local/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6
# If the system command is not available, execute:
LD_PRELOAD=/usr/local/glibc-2.14/lib/libc-2.14.so ln -s /usr/local/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6
# If the update fails, execute the restore command:
LD_PRELOAD=/lib64/libc-2.12.so ln -s /lib64/libc-2.12.so /lib64/libc.so.6
# Resolve the issue of garbled Chinese characters after the upgrade
cp /usr/lib/locale/locale-archive /usr/local/glibc-2.14/lib/locale/locale-archive
# Resolve the incorrect time zone issue
ln -sf /etc/localtime /usr/local/glibc-2.14/etc/localtime
glibc is a low-level dependency library of the system. Please make relevant backup operations before upgrading. Upgrading has risks, and if there are any errors during the upgrade, please take full responsibility. This document refers to:
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.