探索,發現,愛好、學習,記錄,分享。
學海無涯,天涯若比鄰,三人行,必有我師。

Linux系统升级bash

一般Linux发行版自带的bash版本都比较老,如果要体验一些新特征就无法实现,比如关联数组,需要bash 4.0以上,所以需要升级,方法很简单只需编译安装即可。

了解系统当前bash的版本

[root@mail ~]# /bin/bash -version
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

bash下载地址:http://ftp.gnu.org/gnu/bash/

安装升级bash

wget http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar zxvf bash-4.2.tar.gz
cd bash-4.2
./configure
make
make install

因为bash默认是安装在/usr/local/bin/目录下,所以需要创建一个链接到 /bin/目录下,安装完毕后需要重启生效!

mv /bin/bash /bin/bash.bak; ln -s /usr/local/bin/bash /bin/bash
[root@mail ~]# /bin/bash -version
GNU bash, version 4.2.0(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2011 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.

Linux Bash严重漏洞修复紧急通知(2014年9月25日更新)

日前Linux官方内置Bash中新发现一个非常严重安全漏洞,黑客可以利用该Bash漏洞完全控制目标系统并发起攻击,为了避免您Linux服务器受影响,建议您尽快完成漏洞修补,修复方法如下:

漏洞检测方法

可以使用如下命令来检查系统存在此漏洞:

env -i  X='() { (a)=>\' bash -c 'echo date'; cat echo
修复前输出:当前系统时间

使用修补方案修复后

date

特别提示:该修复不会有任何影响,如果您的脚本使用以上方式定义环境变量,修复后您的脚本执行会报错。输出结果中包含date字符串就修复成功了。

修补方案

centos:

yum clean all
yum makecache
yum -y update bash

ubuntu:

apt-cache gencaches
apt-get -y install --only-upgrade bash

debian 7.5 64bit && 32bit :

apt-cache gencaches
apt-get -y install --only-upgrade bash

debian 6.0.x 64bit

wget http://mirrors.aliyun.com/debian/pool/main/b/bash/bash_4.1-3+deb6u2_amd64.deb &&  dpkg -i bash_4.1-3+deb6u2_amd64.deb

debian 6.0.x 32bit

wget http://mirrors.aliyun.com/debian/pool/main/b/bash/bash_4.1-3+deb6u2_i386.deb &&  dpkg -i bash_4.1-3+deb6u2_i386.deb

opensuse:

13.1 64bit 
wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.x86_64.rpm && rpm -Uvh bash-4.2-68.4.1.x86_64.rpm 

13.1 32bit 
wget http://mirrors.aliyun.com/fix_stuff/bash-4.2-68.4.1.i586.rpm && rpm -Uvh bash-4.2-68.4.1.i586.rpm 

aliyun linux:

5.x 64bit 
wget http://mirrors.aliyun.com/centos/5/updates/x86_64/RPMS/bash-3.2-33.el5.1.x86_64.rpm && rpm -Uvh bash-3.2-33.el5.1.x86_64.rpm

5.x 32bit 
wget http://mirrors.aliyun.com/centos/5/updates/i386/RPMS/bash-3.2-33.el5.1.i386.rpm && rpm -Uvh bash-3.2-33.el5.1.i386.rpm
版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權
轉載事宜:如需轉載需徵得應允,轉載必須注明來源於本站的信息。
文章名称:《Linux系统升级bash》
文章链接:https://www.thefreesky.com/blog/24717.html
本站資源僅供個人學習交流,請於下載後24小時內刪除,不允許用於商業用途,否則法律問題自行承擔。

評論 抢沙发