bash 升级

环境centos release 6.7

1.查看当前bash版本

[root@localhost ~]# bash --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

2.查看gcc是否安装(gcc:后面有路径说明已安装)

[root@localhost ~]# whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

3.查看bash安装路径

[root@localhost ~]# whereis bash
bash: /bin/bash /usr/share/man/man1/bash.1.gz       #find / -name bash也是查找和bash相关的文件,建议此处查到的bash文件备份,最大程度保证安全

4.备份bash

[root@localhost ~]# cp -a /bin/bash /bin/bash.bak

5.解压bash-4.4.tar.gz

[root@localhost tmp]# tar -zxvf bash-4.4.tar.gz 
........
bash-4.4/CWRU/misc/sigstat.c
bash-4.4/CWRU/misc/bison
bash-4.4/CWRU/misc/errlist.c
bash-4.4/CWRU/misc/hpux10-dlfcn.h

6.进入bash-4.4编译

./configure命令就是执行当前目录的名为configure的脚本,主要的作用是对即将安装的软件进行配置,检查当前的环境是否满足要安装软件的依赖关系,--bindir=/bin把生成的可执行文件默认放到/bin目录下(只./configure 的话安装成功后bash不生效,需其他配置后才生效),其他文件默认系统安装路径。

[root@localhost tmp]# cd bash-4.4
[root@localhost bash-4.4]# ./configure --bindir=/bin    #安装后会覆盖之前的/bin/bash
config.status: creating config.h
config.status: executing default-1 commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing default commands

7.make编译

[root@localhost bash-4.4]# make
.........
gcc -c  -DHAVE_CONFIG_H -DSHELL  -I/tmp/bash-4.4 -I..   -g -O2 -Wno-parentheses -Wno-format-security man2html.c
gcc  -DHAVE_CONFIG_H -DSHELL  -I/tmp/bash-4.4 -I..   -g -O2 -Wno-parentheses -Wno-format-security man2html.o -o man2html -ldl 		
make[1]: Leaving directory `/tmp/bash-4.4/support'

8.make test测试是否编译成功,没有error信息证明成功

[root@localhost bash-4.4]# make test
...................

< test-tests: the test suite should not be run as root
run-tilde
run-tilde2
run-trap
warning: UNIX versions number signals and schedule processes differently.
warning: If output differing only in line numbers is produced, please
warning: do not consider this a test failure.
71,72d70
< +[8] false
< +[8] cat
73a72,73
> +[8] cat
> +[8] false
run-type
run-varenv
run-vredir

9.安装 make install

[root@localhost bash-4.4]# make install
............
unlink
realpath
strftime
mypid
setpgid
make[1]: Leaving directory `/tmp/bash-4.4/examples/loadables'

10.bash --version 查看版本是否安装成功

[root@localhost bash-4.4]# bash --version
GNU bash, version 4.4.0(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

 

 

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值