#! /bin/bash
wget -qO- http://10.68.100.85/prod/prod-rhel-server.repo >/etc/yum.repos.d/prod-rhel-server.repo
yum clean all >/dev/null 2>&1 && yum makecache >/dev/null 2>&1
os=`cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'`
if [ $os == 7 ]; then
yum update sudo vim wget -y >/dev/null 2>&1
fi
查看软件版本
[root@prod-ecs-sync-nfs-server01 ~]# rpm -qa sudo bash wget
bash-4.2.46-28.el7.x86_64
sudo-1.8.19p2-10.el7.x86_64
wget-1.14-15.el7.x86_64
验证脚本:
[root@prod-ecs-sync-nfs-server01 ~]# curl http://10.68.100.85/prod/sudo-bash-wget-update.sh
#! /bin/bash
wget -qO- http://10.68.100.85/prod/prod-rhel-server.repo >/etc/yum.repos.d/prod-rhel-server.repo
yum clean all >/dev/null 2>&1 && yum makecache >/dev/null 2>&1
os=`cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'`
if [ $os == 7 ]; then
yum update sudo vim wget -y >/dev/null 2>&1
fi
升级:
[root@prod-ecs-sync-nfs-server01 ~]# wget -qO- http://10.68.100.85/prod/sudo-bash-wget-update.sh |bash
软件版本验证:
[root@prod-ecs-sync-nfs-server01 ~]# rpm -qa sudo bash wget
bash-4.2.46-28.el7.x86_64
wget-1.14-18.el7_6.1.x86_64
sudo-1.9.5-3.el7.x86_64