动态 版块 发帖 消息 我的
Loading...
小绿叶技术博客
小绿叶技术博客
小绿叶技术Lv153   
linux centos 6 无法使用系统命令yum命令命令没有找到 command not found     

#!/bin/bash

folder="/eisc/yum"          # 定义下载目录

mkdir -p $folder            # 创建下载目录


wgetfile=(

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/python-2.6.6-66.el6_8.x86_64.rpm

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/python-libs-2.6.6-66.el6_8.i686.rpm

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/python-pycurl-7.19.0-9.el6.x86_64.rpm

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

https://mirrors.aliyun.com/centos-vault/6.10/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

)


iffile="$folder/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm"

                            # 定义已经存在的文件

if [ ! -e $iffile ]         # 判断文件 ! 不存在,then 开始

  then

       for ((i=0;i<${#wgetfile[*]};i++))

                         # i初始为0 数组角标从0开始

                                       # i 范围为 0 到  小于数组个数值,这个区间自增加

                                       # 数组 [*] 符号*指定所有,可以改为0从第一个角标,1表示第二个

                                       # 不加#号表示展示数组元素

          do

             wget -P $folder  ${wgetfile[$i]} 

                                # wget -P 文件夹   被下载的文件

       done

  else

        echo "安装文件已经下载!"

fi


#------- 安装 -------#

rpmfile=(

`ls $folder`

)


for((i=0;i<${#rpmfile[*]};i++  ))

 do

rpm -ivh --force --nodeps $folder/${rpmfile[$i]}

done



centos7 下载链接:https://mirrors.aliyun.com/centos-vault/7.0.1406/os/x86_64/Packages/



脚本执行:wget www.eisc.cn/file/shell/yumnocommand6.sh ; sh yumnocommand6.sh

 1  已被阅读了1299次  楼主 2021-09-28 06:37:47
回复列表

回复:linux centos 6 无法使用系统命令yum命令命令没有找到 command not found

guest
登录之后更精彩~
Powered by HadSky 7.12.10
© 2015-2023 PuYueTian
您的IP:8.219.134.200,2023-10-04 00:18:20,Processed in 0.04488 second(s).
Powered by HadSky
小绿叶技术博客