CentOS6.10源码部署JumpServer-3.10.12

一、升级gcc以及glibc

1、升级glibc

1.1 查看现有glibc版本

  • 方法1:
strings /lib64/libc.so.6|grep GLIBC

参考:
[root@localhost ~]# strings /lib64/libc.so.6|grep GLI
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
  • 方法2:
ldd --version

参考:
[root@localhost ~]# ldd --version
ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

1.2 下载部署包并上传到服务

到glibc官网下载源码包,官网地址为:https://ftp.gnu.org/gnu/glibc/
由于本次安装的组件最低依赖glibc2.17,所以我们下载glibc-2.17版本的源码包:glibc-2.17.tar.gz
源码包下载完成后,将其上传到服务器的/opt目录

1.3 安装glibc

  • 解压源码包
cd /opt
tar xf glibc-2.17.tar.gz
  • 配置glibc
cd glibc-2.17 
mkdir build 
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
  • 编译glibc
make -j$(nproc --all)




参考:编译完成最后部分内容:
make[4]: Leaving directory `/opt/glibc-2.17/time'
make[4]: Entering directory `/opt/glibc-2.17/string'
make[4]: Entering directory `/opt/glibc-2.17/time'
make[4]: Nothing to be done for `rtld-all'.
make[4]: Leaving directory `/opt/glibc-2.17/time'
make[4]: Entering directory `/opt/glibc-2.17/nptl'
make[4]: Nothing to be done for `rtld-all'.
make[4]: Leaving directory `/opt/glibc-2.17/string'
make[4]: Nothing to be done for `rtld-all'.
make[4]: Leaving directory `/opt/glibc-2.17/nptl'
make[3]: Leaving directory `/opt/glibc-2.17/elf'
gcc -B/usr/bin/ -nostdlib -nostartfiles -o /opt/glibc-2.17/build/elf/sprof  -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2   -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both /opt/glibc-2.17/build/csu/crt1.o /opt/glibc-2.17/build/csu/crti.o `gcc -B/usr/bin/  --print-file-name=crtbegin.o` /opt/glibc-2.17/build/elf/sprof.o /opt/glibc-2.17/build/dlfcn/libdl.so.2  -Wl,-rpath-link=/opt/glibc-2.17/build:/opt/glibc-2.17/build/math:/opt/glibc-2.17/build/elf:/opt/glibc-2.17/build/dlfcn:/opt/glibc-2.17/build/nss:/opt/glibc-2.17/build/nis:/opt/glibc-2.17/build/rt:/opt/glibc-2.17/build/resolv:/opt/glibc-2.17/build/crypt:/opt/glibc-2.17/build/nptl /opt/glibc-2.17/build/libc.so.6 /opt/glibc-2.17/build/libc_nonshared.a -Wl,--as-needed /opt/glibc-2.17/build/elf/ld.so -Wl,--no-as-needed -lgcc  `gcc -B/usr/bin/  --print-file-name=crtend.o` /opt/glibc-2.17/build/csu/crtn.o
gcc -B/usr/bin/ -nostdlib -nostartfiles -o /opt/glibc-2.17/build/elf/pldd  -Wl,-dynamic-linker=/lib64/ld-linux-x86-64.so.2   -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both /opt/glibc-2.17/build/csu/crt1.o /opt/glibc-2.17/build/csu/crti.o `gcc -B/usr/bin/  --print-file-name=crtbegin.o` /opt/glibc-2.17/build/elf/pldd.o /opt/glibc-2.17/build/elf/xmalloc.o  -Wl,-rpath-link=/opt/glibc-2.17/build:/opt/glibc-2.17/build/math:/opt/glibc-2.17/build/elf:/opt/glibc-2.17/build/dlfcn:/opt/glibc-2.17/build/nss:/opt/glibc-2.17/build/nis:/opt/glibc-2.17/build/rt:/opt/glibc-2.17/build/resolv:/opt/glibc-2.17/build/crypt:/opt/glibc-2.17/build/nptl /opt/glibc-2.17/build/libc.so.6 /opt/glibc-2.17/build/libc_nonshared.a -Wl,--as-needed /opt/glibc-2.17/build/elf/ld.so -Wl,--no-as-needed -lgcc  `gcc -B/usr/bin/  --print-file-name=crtend.o` /opt/glibc-2.17/build/csu/crtn.o
make[2]: Leaving directory `/opt/glibc-2.17/elf'
make[1]: Leaving directory `/opt/glibc-2.17'
  • 安装glibc
make install 

参考:安装完成后最后部分的内容
mv -f /opt/glibc-2.17/build/elf/stubsT /opt/glibc-2.17/build/elf/stubs
make[2]: Leaving directory `/opt/glibc-2.17/elf'
(sed '/^@/d' include/stubs-prologue.h; LC_ALL=C sort /opt/glibc-2.17/build/csu/stubs /opt/glibc-2.17/build/iconv/stubs /opt/glibc-2.17/build/locale/stubs /opt/glibc-2.17/build/localedata/stubs /opt/glibc-2.17/build/iconvdata/stubs /opt/glibc-2.17/build/assert/stubs /opt/glibc-2.17/build/ctype/stubs /opt/glibc-2.17/build/intl/stubs /opt/glibc-2.17/build/catgets/stubs /opt/glibc-2.17/build/math/stubs /opt/glibc-2.17/build/setjmp/stubs /opt/glibc-2.17/build/signal/stubs /opt/glibc-2.17/build/stdlib/stubs /opt/glibc-2.17/build/stdio-common/stubs /opt/glibc-2.17/build/libio/stubs /opt/glibc-2.17/build/dlfcn/stubs /opt/glibc-2.17/build/malloc/stubs /opt/glibc-2.17/build/string/stubs /opt/glibc-2.17/build/wcsmbs/stubs /opt/glibc-2.17/build/timezone/stubs /opt/glibc-2.17/build/time/stubs /opt/glibc-2.17/build/dirent/stubs /opt/glibc-2.17/build/grp/stubs /opt/glibc-2.17/build/pwd/stubs /opt/glibc-2.17/build/posix/stubs /opt/glibc-2.17/build/io/stubs /opt/glibc-2.17/build/termios/stubs /opt/glibc-2.17/build/resource/stubs /opt/glibc-2.17/build/misc/stubs /opt/glibc-2.17/build/socket/stubs /opt/glibc-2.17/build/sysvipc/stubs /opt/glibc-2.17/build/gmon/stubs /opt/glibc-2.17/build/gnulib/stubs /opt/glibc-2.17/build/wctype/stubs /opt/glibc-2.17/build/manual/stubs /opt/glibc-2.17/build/shadow/stubs /opt/glibc-2.17/build/gshadow/stubs /opt/glibc-2.17/build/po/stubs /opt/glibc-2.17/build/argp/stubs /opt/glibc-2.17/build/crypt/stubs /opt/glibc-2.17/build/nptl/stubs /opt/glibc-2.17/build/resolv/stubs /opt/glibc-2.17/build/nss/stubs /opt/glibc-2.17/build/rt/stubs /opt/glibc-2.17/build/conform/stubs /opt/glibc-2.17/build/debug/stubs /opt/glibc-2.17/build/libidn/stubs /opt/glibc-2.17/build/nptl_db/stubs /opt/glibc-2.17/build/inet/stubs /opt/glibc-2.17/build/hesiod/stubs /opt/glibc-2.17/build/sunrpc/stubs /opt/glibc-2.17/build/nis/stubs /opt/glibc-2.17/build/nscd/stubs /opt/glibc-2.17/build/streams/stubs /opt/glibc-2.17/build/login/stubs /opt/glibc-2.17/build/elf/stubs) > /opt/glibc-2.17/build/stubs.h
if test -r /usr/include/gnu/stubs-64.h && cmp -s /opt/glibc-2.17/build/stubs.h /usr/include/gnu/stubs-64.h; \
        then echo 'stubs.h unchanged'; \
        else /usr/bin/install -c -m 644 /opt/glibc-2.17/build/stubs.h /usr/include/gnu/stubs-64.h; fi
stubs.h unchanged
rm -f /opt/glibc-2.17/build/stubs.h
/opt/glibc-2.17/build/elf/sln /opt/glibc-2.17/build/elf/symlink.list
rm -f /opt/glibc-2.17/build/elf/symlink.list
test ! -x /opt/glibc-2.17/build/elf/ldconfig || LC_ALL=C LANGUAGE=C \
          /opt/glibc-2.17/build/elf/ldconfig  \
                                       /lib64 /usr/lib64
LD_SO=ld-linux-x86-64.so.2 CC="gcc -B/usr/bin/" /usr/bin/perl scripts/test-installation.pl /opt/glibc-2.17/build/
Your new glibc installation seems to be ok.
make[1]: Leaving directory `/opt/glibc-2.17'

1.4 检查glibc是否安装成功

[root@localhost build]# ldd --version 
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.



[root@localhost build]# 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_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE

2、升级gcc

1.1 查看现有gcc版本

strings /usr/lib64/libstdc++.so.6 | grep GLIBC


参考:
[root@localhost build]# strings /usr/lib64/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.4
GLIBC_2.3.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

1.2 下载gcc源码包以及gcc依赖的三个包(mpc,mpfr,gmp)

gcc源码包下载地址:https://ftp.gnu.org/gnu/gcc/gcc-4.8.5/
mpc/mpfr/gmp包下载地址:可以通过gcc源码包解压后的contrib/download_prerequisites文件中查看三个文件的具体版本和下载地址。这里直接给出下载具体的下载地址,

  • mpfr: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
  • gmp: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
  • mpc: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1tar.gz

1.3 上传gcc源码包到服务器

我们将下载的源码包上传到服务器的/opt目录并解压

cd /opt
tar xf gcc-4.8.5.tar.gz

上面说了,gcc还有三个依赖的包(mpfr,gmp,mpc)我们需要将这三个包的源码包上传到gcc源码包的解压目录下,这里目录为:/opt/gcc-4.8.5,然后解压这三个文件

# 文件上传到/opt/gcc-4.8.5目录下后,进行解压
cd /opt/gcc-4.8.5
tar xf gmp-4.3.2.tar.bz2 
tar xf mpc-0.8.1.tar.gz 
tar xf mpfr-2.4.2.tar.bz2 
# 解压完成后进行重命名
mv mpfr-2.4.2/ mpfr
mv gmp-4.3.2/ gmp
mv mpc-0.8.1/ mpc

1.4 安装gcc

  • 配置gcc
cd /opt/gcc-4.8.5 && mkdir build && cd build
 ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
 
 
 参考:配置完成后末尾输出:
 checking where to find the target as... host tool
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... host tool
checking where to find the target gcc... just compiled
checking where to find the target gcj... host tool
checking where to find the target gfortran... host tool
checking where to find the target gccgo... host tool
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... host tool
checking where to find the target objdump.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值