首页 > 系统相关 >解决Centos无法yum源的问题

解决Centos无法yum源的问题

时间:2024-07-03 17:57:33浏览次数:1  
标签:Centos repo etc Base yum aliyun 无法

1、安装yum依赖包,出现报错could not resolve host :mirrorlist.centos.org:unknown error

此时 #ping mirrors.aliyun.com 不通

一般是由于dns解析存在问题,cd /etc/resolv.conf  修改nameserver 改为114.114.114.114。

重启网卡:systemctl restart network

再次 #ping mirrors.aliyun.com 通了

 2、再次安装yum依赖包,如果还出现could not resolve host :mirrorlist.centos.org:unknown error

mirrorlist.centos.org无法访问,尝试切换到其他可用的镜像源

阿里云Centos镜像源地址:https://mirrors.aliyun.com/repo/

修改/etc/yum.repos.d/Centos-Base.repo文件

1)进入到如下目录

#cd /etc/yum.repos.d/

2)备份CentOS-Base.repo 。

#mv CentOS-Base.repo CentOS-Base.repo.bak

3)下载yum源 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

结合自己的Centos版本选择合适的yum源(查看Centos版本命令:Cat /etc/Centos-release)

4)清楚以前所有的过时的yum缓存

#yum clean all

5)重新生成yum缓存

#yum makecache

6)测试,yum install vim OK

 

标签:Centos,repo,etc,Base,yum,aliyun,无法
From: https://www.cnblogs.com/leeona/p/18282312

相关文章

  • CentOS+LAMP
    LAMP环境搭建与配置软件包下载在:/usr/local/src/使用前请安装yum-yinstallwgetbzip2gccvimnet-tools1.安装与配置MySQL1.1安装MySQLMySQL版本为:5.6.50cd/usr/local/src/wgethttp://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.50-linux-glibc2.12......
  • 成功解决CentOS7中yum能ping通外网,但是无法下载问题
    今天安装完centos7后,使用yum安装vim时出现连接国外源超时情况,想通过yumupdate来解决问题,但是出现以下情况:通过pingwww.baidu.com,网络是通的。怀疑是CentOS-Base.repo文件出了问题。通过命令将该文件备份:mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base......
  • centos系统构建安装john导致的编译问题error: size of array element is not a multip
    blake2.h:112:5:error:sizeofarrayelementisnotamultipleofitsalignment112|blake2b_stateS[4][1];|^~~~~~~~~~~~~blake2.h:113:5:error:sizeofarrayelementisnotamultipleofitsalignment113|blake2b_stateR[1];......
  • Centos7下安装Redis
    1.安装依赖redis是由C语言开发,因此安装之前必须要确保服务器已经安装了gcc,可以通过如下命令查看机器是否安装:gcc-v如果没有安装则通过以下命令安装:yuminstall-ygcc2.下载redis安装包并解压#下载,我是在root下执行的下载,所以我的下载目录为:/root/redis-6.2.6,这里......
  • centos7下载关联centos镜像文件
    1.CentOS在官网上直接下载网址:https://www.centos.org/download/我选择在这里下载https://mirrors.aliyun.com/centos/7/isos/x86_64/ 感觉还是慢直接网盘下载了 centos7.9:链接: https://pan.baidu.com/s/13BAfdn1-T5YkxLJ1IpwQyw提取码: bqyg2. 3. 4, 5. ......
  • centos7定时检测磁盘大小,并输出为csv格式
    脚本:!/bin/bash定义输出文件名OUTPUT_FILE="/path/to/output.csv"获取当前日期时间,为CSV文件名添加时间戳TIMESTAMP=$(date+"%Y%m%d%H%M%S")OUTPUT_FILE_WITH_TIMESTAMP="${OUTPUT_FILE}_${TIMESTAMP}.csv"检测磁盘空间并输出到CSV文件df-h|awk-vOFS=','&#......
  • linux_centos镜像下载及百度网盘分享链接
    1.Centos镜像国内最全下载地址CentOS官方下载地址:https://www.centos.org/download/Centos国内下载源http://man.linuxde.net/download/CentOShttp://mirrors.btte.net/centoshttp://mirrors.cn99.com/centos (希网)http://mirrors.sohu.com/centos (搜狐)http://mirrors.aliyun.......
  • CentOS Stream 8 发布.net 8 webapi
    参考资料https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-rhel#where-is-centos-linux 微软好像不持支.net7所以把demo换成.net8sudodnfinstalldotnet-sdk-8.0 然后就开始报错,大致意思就是无法解析,找不到地址资源进入yum的repos目录cd/etc/yum.rep......
  • 在vmare中创建centos虚拟机
    1,环境window11vmareworkstation172. 3, 4这里是因为一会儿可以使用自己下载的镜像文件 5.选择用户操作系统linux  6. 7. 8. 9. 10. 11. 12, 13. 14. 15 ......
  • yum安装中关于Base.repo的报错问题
     用yum安装出现以下问题: 确认自己的DNS配置正确,而且可以用连接公网,测试如下: 查看repolist:是否为0,是的话继续下面操作yumrepolist备份原来的Base.repomv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup 下载阿里的yum安装的Bas......