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