centos7 curl#6 - Could not resolve host mirrorlist.centos.org; 未知的错误 解决方案

问题描述

centos7系统安装完成后,yum安装软件时报错“curl#6 - “Could not resolve host: mirrorlist.centos.org; 未知的错误””

[root@192 ~]# yum install vim -y
已加载插件:fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

解决方案

1)执行如下命令:

vi /etc/yum.repos.d/CentOS-Base.repo

2)修改如下:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

3)配置成阿里云镜像

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

4)执行如下命令

yum repolist
yum clean all
yum makecache

Centos7安装gcc8

方法 1:使用 devtoolset安装 GCC 8(推荐)

1)安装 centos-release-scl

sudo yum install -y centos-release-scl

2)安装gcc 8

sudo yum install -y devtoolset-8

报错如下:

[root@192 yum.repos.d]# sudo yum install -y devtoolset-8
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64

解决方案:

修改CentOS-SCLo-scl.repo:

vi /etc/yum.repos.d/CentOS-SCLo-scl.repo

修改如下:

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

修改CentOS-SCLo-scl-rh.repo:

vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

修改如下:

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

执行如下命令:

yum repolist
yum clean all
yum makecache

3)重新执行命令

sudo yum install -y devtoolset-8

4)每次使用 GCC 8 时,需要运行:

scl enable devtoolset-8 bash

或者执行:

source /opt/rh/devtoolset-8/enable

5)如需永久启动gcc 8,执行如下命令:

echo "source /opt/rh/devtoolset-8/enable" >> ~/.bashrc
source ~/.bashrc

方法 2:使用 yum 直接安装 GCC 8(可能需要额外配置)

1)启用 EPELSCLo 仓库

sudo yum install -y epel-release
sudo yum install -y centos-release-scl

2)安装 GCC 8

sudo yum install -y gcc-toolset-8

3)启用 GCC 8

scl enable gcc-toolset-8 bash

4)检查 GCC 版本

gcc --version

方法 3:手动编译 GCC 8(适用于特殊需求)

1)安装依赖

sudo yum groupinstall -y "Development Tools"
sudo yum install -y gcc gcc-c++ make wget bzip2

2)下载 GCC 8 源码

wget http://ftp.gnu.org/gnu/gcc/gcc-8.5.0/gcc-8.5.0.tar.xz
tar -xf gcc-8.5.0.tar.xz
cd gcc-8.5.0

3)下载依赖库

./contrib/download_prerequisites

4)编译安装

mkdir build && cd build
../configure --enable-languages=c,c++ --disable-multilib
make -j$(nproc)
sudo make install

5)检查 GCC 版本

gcc --version

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/966842.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

CSS基本语法和常用属性

目录 一、CSS二、CSS基本语法三、CSS的三种形式1、行内样式2、内部样式3、外部样式4、三者的优先级问题5、代码演示 四、选择器1 基础选择器1.1标签选择器1.2 ID选择器1.3 Class选择器1.4 属性选择器 2. 组合选择器2.1 层次选择器4.2.2 并列选择器 3. 伪类选择器4、选择器的优先…

白嫖RTX 4090?Stable Diffusion:如何给线稿人物快速上色?

大家都知道&#xff0c;在设计的初期&#xff0c;我们通常会先绘制草图&#xff0c;然后再进行上色处理&#xff0c;最终才开始进行最终的设计工作。在这个上色的过程中&#xff0c;配色是至关重要的一环。这不仅方便了内部同事的评审&#xff0c;也让产品方和客户可以直观地了…

在CT107D单片机综合训练平台上,8个数码管分别单独依次显示0~9的值,然后所有数码管一起同时显示0~F的值,如此往复。

题目&#xff1a;在CT107D单片机综合训练平台上&#xff0c;8个数码管分别单独依次显示0~9的值&#xff0c;然后所有数码管一起同时显示0~F的值&#xff0c;如此往复。 延时函数分析LED首先实现8个数码管单独依次显示0~9的数字所有数码管一起同时显示0~F的值&#xff0c;如此往…

手动配置IP

手动配置IP&#xff0c;需要考虑四个配置项&#xff1a; 四个配置项 IP地址、子网掩码、默认网关、DNS服务器 IP地址&#xff1a;格式表现为点分十进制&#xff0c;如192.168.254.1 子网掩码&#xff1a;用于区分网络位和主机位 【子网掩码的二进制表达式一定是连续的&#…

2025年知识竞赛活动怎样办才有新意

2025年的知识竞赛活动要怎样举办才有新意。首先&#xff0c;我们需要理解用户的需求。他们可能是在策划一个活动&#xff0c;想要区别于传统的知识竞赛&#xff0c;吸引更多人参与&#xff0c;尤其是在2025年这样的未来时间点&#xff0c;科技发展可能更快&#xff0c;所以需要…

Chirpy3D:用于创意 3D 鸟类生成的连续部分潜在特征

Chirpy3D框架可以将细粒度的2D图像理解提升至3D生成的全新境界。当前的3D生成方法往往只关注于重构简单的对象&#xff0c;缺乏细致的特征和创造性。Chirpy3D通过结合多视角扩散模型和连续的部件潜在空间&#xff0c;能够生成全新且合理的3D鸟类模型。该系统不仅能够保持细致的…

【Git】ssh如何配置gitlab+github

当我们工作项目在gitlab上&#xff0c;又希望同时能更新自己个人的github项目时&#xff0c;可能因为隐私问题&#xff0c;不能使用同一′密钥。就需要在本地电脑上分别配置两次ssh。 1、分别创建ssh key 在用户主目录下&#xff0c;查询是否存在“.ssh”文件&#xff1a; 如…

用python获取AH股股票列表并且输出-附源代码

用python 获取在A股和香港上市的公司和在A股和香港上市的公司股票代码和名称 import akshare as akdef get_ah_stocks():# 获取A股股票列表a_stock_list ak.stock_zh_a_spot_em()a_stock_list a_stock_list[["代码", "名称"]]# 获取港股股票列表h_stock…

继承QLineEdit类实现自动补全功能

QlineEdit类本身是没有自动补全功能的&#xff0c;可以使用QCompleter配合实现功能。 但是在开发过程中发现&#xff0c;输入的字符串如果匹配那么QCompleter类会弹窗显示匹配项&#xff0c;如果输入的字符串不匹配则QCompleter类会关闭弹出(这点我也倒是能理解&#xff0c;没有…

VMware Workstation Pro 免注册下载链接

VMware Workstation Prohttps://softwareupdate.vmware.com/cds/vmw-desktop/ws/https://softwareupdate.vmware.com/cds/vmw-desktop/ws/ 访问不了或下载速度慢挂VNP

【如何掌握CSP-J 信奥赛中的深搜算法】

CSP-J 信奥赛中的深搜&#xff08;深度优先搜索&#xff09;算法是一个重要知识点&#xff0c;以下是一些学习深搜算法的建议&#xff1a; 理解基础概念 定义与原理&#xff1a;深度优先搜索是一种用于遍历或搜索图、树等数据结构的算法。它从起始节点开始&#xff0c;沿着一条…

BFS解决拓扑排序(3题)

目录 拓扑排序 1.如何排序&#xff1f; 2.如何形成拓扑排序 3.如何建图 1.看数据稠密度 2. 根据算法流程灵活建图 1.课程表 2.课程表2 3.火星词典 拓扑排序 找到做事情的先后顺序&#xff0c;拓扑排序的结果可能不是唯一的 1.如何排序&#xff1f; 1.找出图中入度为…

区块链技术:Facebook 重塑社交媒体信任的新篇章

在这个信息爆炸的时代&#xff0c;社交媒体已经成为我们生活中不可或缺的一部分。然而&#xff0c;随着社交平台的快速发展&#xff0c;隐私泄露、数据滥用和虚假信息等问题也日益凸显。这些问题的核心在于传统社交媒体依赖于中心化服务器存储和管理用户数据&#xff0c;这种模…

机器学习-关于线性回归的表示方式和矩阵的基本运算规则

最近在学习机器学习的过程中&#xff0c;发现关于线性回归的表示和矩阵的运算容易费解&#xff0c;而且随着学习的深入容易搞混&#xff0c;因此特意做了一些研究&#xff0c;并且记录下来和大家分享。 一、线性模型有哪些表示方式&#xff1f; 器学习中&#xff0c;线性模型…

安宝特方案 | AR助力制造业安全巡检智能化革命!

引言&#xff1a; 在制造业中&#xff0c;传统巡检常面临流程繁琐、质量波动、数据难以追溯等问题。安宝特AR工作流程标准化解决方案&#xff0c;通过增强现实AR技术&#xff0c;重塑制造业安全巡检模式&#xff0c;以标准化作业流程为核心&#xff0c;全面提升效率、质量与…

【deepseek】利用deepseek+cherry构建高效本地知识库

项目简介 本项目旨在开发一个高效、准确且用户友好的智能问答系统。该系统利用先进的向量化技术和深度学习模型来理解和回答用户的提问。通过整合多个模块的功能&#xff0c;系统能够从大量结构化或非结构化的数据中快速找到相关信息&#xff0c;并以自然语言的形式提供答案。…

小程序实现消息订阅通知完整实践及踩坑记录

1. 实现效果预览 2. 实现步骤 2.1 模版配置 进入小程序后端,选用一次性订阅模版,没有关键字的需要进行2-5天审核,提前进行 2.2 后端核心代码实现 import com.alibaba.fastjson2.JSONObject

vue学习4

1.自定义创建项目 2.ESlint代码规范 正规的团队需要统一的编码风格 JavaScript Standard Style 规范说明&#xff1a;https://standardjs.com/rules-zhcn.html 规则中的一部分&#xff1a; (1)字符串使用单引号 ‘aabc’ (2)无分号 const name ‘zs’ (3)关键字后加空格 if(n…

基于改进型灰狼优化算法(GWO)的无人机路径规划

内容&#xff1a; 基于改进型灰狼优化算法的无人机轨迹规划 GWO是一种群体智能优化算法&#xff0c;模仿灰狼的社会等级和狩猎行为。原始的GWO有一些局限性&#xff0c;比如容易陷入局部最优&#xff0c;收敛速度慢等&#xff0c;所以改进型的GWO可能通过不同的策略来优化这些…

最短路径问题-------Dijkstra算法

定义&#xff1a; Dijkstra(迪杰斯特拉)算法是计算单源最短路径算法&#xff0c;用于计算一个结点到其他所有结点的最短路径。该算法以源点为起始点&#xff0c;不断更新其他点到已经确定距离结点的距离&#xff0c;选取距离最小的结点加入S集合&#xff0c;直到S集合存放有所…