1. 程式人生 > >淺談Linux啟動MongoDB所遇問題

淺談Linux啟動MongoDB所遇問題

淺談Linux啟動MongoDB所遇問題

淺談Linux啟動MongoDB所遇問題

libc.so.6: version `GLIBC_2.14' not found問題

出現這個錯誤的原因是:Red Hat系統的glibc的版本太低,軟體編譯時使用了較高的glibc版本引起的。解決方法如下:

1.檢視系統glibc支援的版本

  • 命令列輸入strings /lib64/libc.so.6 |grep GLIBC_
[[email protected] bin]# strings /lib64/libc.so.6 |grep GLIBC_
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_PRIVATE
  • 命令列輸入rpm -qa |grep glibc
[[email protected] bin]# rpm -qa |grep glibc
glibc-headers-2.12-1.212.el6.x86_64
glibc-2.12-1.212.el6.x86_64
glibc-devel-2.12-1.212.el6.x86_64
glibc-common-2.12-1.212.el6.x86_64

可以看出系統只支援到2.12版本,本文使用的是glibc-2.14.tar.xz這個版本。

2.下載glibc-2.14.tar.xz

  • 注:可以到http://www.gnu.org/software/libc/下載最新版本,我這裡直接通過wget命令下載glibc-2.14.tar.xz 這個版本,解壓到任意目錄準備編譯
  • 命令列輸入wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.xz
[[email protected] usr]# wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.xz

3.解壓到指定資料夾

[[email protected] usr]# tar xvJf glibc-2.14.tar.xz /usr/glibc
  • 注:若解壓tar.xz檔案出錯,請命令列輸入安裝:yum -y install xz

4.進入到glibc原始碼目錄並建立build目錄,並進入

[[email protected] usr]# cd glibc
[[email protected] glibc]# cd glibc-2.14
[[email protected] build]# mkdir build
[[email protected] glibc-2.14]# cd build
[[email protected] build]# 

5.執行configure配置,make && sudo  make install

[[email protected] build]# ../configure --prefix=/opt/glibc-2.14
[[email protected] build]# make -j4

持續5-10分鐘的等待。。。

[[email protected] glibc-2.14]# make install

持續2-5分鐘的等待。。。

6.配置(重要步驟,缺少檔案)

[[email protected] glibc-2.14]# cp  /etc/ld.so.c* /opt/glibc-2.14/etc/
cp:是否覆蓋"/opt/glibc-2.14/etc/ld.so.cache"? y
cp: 略過目錄"/etc/ld.so.conf.d"
[[email protected] glibc-2.14]# ln -sf /opt/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6

7.檢視當前版本庫的支援

[[email protected] glibc-2.14]# strings /lib64/libc.so.6 | grep GLIBC
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_PRIVATE

8.恭喜完成操作,您可以繼續其他操作了。