如果Centos 默认最小安装的话就没有安装 wget ,需要先输入代码安装
yum -y install wget
清华大学yum源
参考地址:https://mirrors.tuna.tsinghua.edu.cn/help/centos/
网易yum源
参考地址:http://mirrors.163.com/.help/centos.html
yum -y install wget rm -rf /etc/yum.repo.d/* wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo yum clean all && yum makecache
或者:
yum -y install yum-utils yum-config-manager --add-repo http://mirrors.163.com/.help/CentOS7-Base-163.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak mv /etc/yum.repos.d/CentOS7-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo yum clean all && yum makecache yum repolist
阿里云yum源
yum -y install yum-utils yum-config-manager --add-repo http://mirrors.aliyun.com/repo/Centos-7.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak mv /etc/yum.repos.d/Centos-7.repo /etc/yum.repos.d/CentOS-Base.repo yum clean all yum makecache yum repolist
中科大yum源
yum -y install wget rm -rf /etc/yum.repos.d/* wget -O /etc/yum.repos.d/CentOS-Base.repo 'https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3' yum clean all && yum makecache
上海交大yum源
vim /etc/yum.repos.d/CentOS-Base.repo [base] name=CentOS-7- Base baseurl=http://ftp.sjtu.edu.cn/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey= http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-7 [update] name=CentOS-7 - Updates baseurl= http://ftp.sjtu.edu.cn/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey= http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-7 - Extras baseurl= http://ftp.sjtu.edu.cn/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey= http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-7 [centosplus] name=CentOS-7 - Plus baseurl= http://ftp.sjtu.edu.cn/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey= http://ftp.sjtu.edu.cn/centos/RPM-GPG-KEY-CentOS-7 搜狐yum源 vim /etc/yum.repos.d/CentOS-Base.repo [base] name=CentOS-7 - Base baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey= http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-7 [update] name=CentOS-7 - Updates baseurl= http://mirrors.sohu.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey= http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-7 - Extras baseurl= http://mirrors.sohu.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey= http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-7 [centosplus] name=CentOS-7 - Plus baseurl= http://mirrors.sohu.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey= http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-7
其它yum源
北京理工大学: http://mirror.bit.edu.cn 参考地址
兰州大学:http://mirror.lzu.edu.cn
厦门大学:http://mirrors.xmu.edu.cn
中国科学技术大学:http://mirrors.ustc.edu.cn
东北大学:http://mirror.neu.edu.cn
官方yum源
CentOS官方:http://mirror.centos.org/
————————————————
执行yum源更新命令
yum clean all yum makecache yum -y update
试试更新系统 yum -y update (不是root的加 sudo),这回可以顺利安装docker或更新系统了。
yum install docker
systemctl start docker
就可以使用docker了
常用yum命令
常用命令
yum install softwarename #安装
yum remove softwarename #卸载软件
yum list softwarename #查看软件源中是否有此软件
yum list all #列出所有软件名称
yum list installed #列出已经安装的软件名称
yum list available #列出可以用yum安装的软件
yum clean all #清空yum缓存
yum search softwareinfo #根据软件信息搜索软件名字(如,使用search web搜索web浏览器)
yum whatprovides filename #在yum源中查找包含filename文件的软件包(如,whatprovides rm搜索汉含rm的软件,命令实质上是文件)
yum update #更新软件,会存在未知问题,一般不对服务器升降级
yum history #查看系统软件改变历史
yum reinstall softwarename #重新安装
yum info softwarename #查看软件信息
yum groups list #查看软件组信息
yum groups info softwarename #查看软件组内包含的软件
yum groups install softwarename #安装组件
yum groups remove softwarename #卸载组件
yum clean all #清理缓存
————————————————
发表评论