首页 > 系统相关 >centos7中安装了centos-release-scl后,之前的yum源变为不可用 解决方案

centos7中安装了centos-release-scl后,之前的yum源变为不可用 解决方案

时间:2024-08-11 15:16:12浏览次数:6  
标签:scl centos CentOS repo centos7 yum release

centos7中安装了centos-release-scl后,之前的yum源变为不可用 解决方案

1. 前言

今天遇到了一个奇奇怪怪的事情,我自己在自己的服务器(centos7)上安装了centos-release-scl后,之前运行正常的yum命令竟然变得不可用。

2. 场景重现

执行下面这条命令后,再次使用yum报错。

yum install centos-release-scl -y

报错信息如下:

[root@localhost ~]# sudo yum install devtoolset-11
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh error was
14: curl#7 - "Failed to connect to 2a05:d012:8b5:6503:9efb:5cad:348f:e826: 网络不可达"


 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. Disable the repository, 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>

     4. 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

3. 什么是SCL?

SCL项目主页:https://www.softwarecollections.org/

SCL(Software Collections)可以让你在同一个操作系统上安装和使用多个版本的软件,而不会影响整个系统的安装包。SCL为社区的以下需求而设计:创建和使用软件集合生产系统、概念验证系统、开发测试平台。SCL目前已经支持Fedora和RHEL(衍生版本如CentOS也包含在内)。

SCL的创建就是为了给RHEL/CentOS用户提供一种以方便、安全地安装和使用应用程序和运行时环境的多个(而且可能是更新的)版本的方式,同时避免把系统搞乱。与之相对的是第三方源,它们可能会在已安装的包之间引起冲突。

现在有以下软件选集可供CentOS 6.5或以上版本应用。

Ruby 1.9.3 (ruby193)
Python 2.7 (python27)
Python 3.3 (python33)
PHP 5.4 (php54)
Perl 5.16.3 (perl516)
Node.js 0.10 (nodejs010)
MariaDB 5.5 (mariadb55)
MySQL 5.5 (mysql55)
PostgreSQL 9.2 (postgresql92)

更多的软件集可参看这里:https://www.softwarecollections.org/en/scls/。

3.1 安装SCL

在CentOS下访问SCL,需要安装CentOS Software Collections。它是CentOS Extras软件库的一部份,并可通过以下指命进行安装。

Centos 7
$ yum install centos-release-scl

Centos 6
$ yum install centos-release-SCL

注意:Centos6和Centos7的包名是区分大小写的!

4. 问题分析

可能的原因是在安装 centos-release-scl 后,系统软件包管理器 yum 可能遇到了问题。centos-release-scl 是用于安装 Software Collections 的软件包,它提供了一种在 CentOS 系统上安装和管理多个软件版本的方法。

在安装 centos-release-scl 后,可能会导致系统的软件仓库配置发生变化,或者出现与旧有软件包版本冲突的情况。这可能会影响 yum 命令的正常运行,因为它依赖于正确的软件包仓库配置和软件包版本管理。

5. 解决方案

进入/etc/yum.repos.d下查看文件。发现有三个yum配置文件。

cd /etc/yum.reps.d
ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo     CentOS-SCLo-scl-rh.repo  CentOS-Vault.repo CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-SCLo-scl.repo  CentOS-Sources.repo

CentOS-Base.repo / CentOS-SCLo-scl-rh.repo /CentOS-SCLo-scl.repo

需要在这三个文件中配置yum源,但是查看发现CentOS-Base.repo配置了阿里云镜像,因此需要修改其他两个文件。配置yum的镜像源。首先对CentOS-SCLo-scl-rh.repo进行修改。

vi CentOS-SCLo-scl-rh.repo
# 修改后
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=http://vault.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

修改后发现依旧无法使用,将CentOS-SCLo-scl.repoyum源进行修改。

vi CentOS-SCLo-scl.repo
# 修改后
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=http://vault.centos.org/centos/7/sclo/$basearch/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

修改之后yum即可正常使用。

yum clean all
yum makecache

参考文献:https://blog.csdn.net/m0_63303316/article/details/140200199

标签:scl,centos,CentOS,repo,centos7,yum,release
From: https://www.cnblogs.com/zreo2home/p/18353396

相关文章

  • Centos7安装Java8
    1.查看目前环境rpm-qa|grepjdk原有系统安装有jdk,如果对于jdk有要求,我们就需要重新安装jdk2.卸载原有jdk环境rpm-e--nodeps上面显示的东西这里,我们就需要一个一个去卸载如果有感觉麻烦,可以使用如下命令yumremove*openjdk*3.重新检查java-versionrpm-qa|grep......
  • 源是什么、怎么换源、Centos7停止维护后如何更换源
    目录源的介绍与更换1.什么是软件源?2.为什么要更换软件源?2.1提高下载速度:2.2获得最新的软件版本:2.3解决源不可用或不稳定的问题:2.4获取特定的软件包:2.5系统兼容性和需求:3.如何更换软件源:Ubuntu和CentOS的步骤为例3.1Ubuntu3.1.1备份当前的源列表3.1.2编辑源列表文件......
  • linux系统CENTOS 7安装docker
    前言:使用阿里云镜像,在CENTOS7版本上安装docker容器,方便使用docker容器安装其他软件。前置准备如果已经安装了docker,先将其卸载。yumremovedocker安装docker安装docker依赖的软件包。sudoyuminstall-yyum-utilsdevice-mapper-persistent-datalvm2添加阿里......
  • Linux:@2024-08-10 最新的Openssl-3.3.1 Openssh-9.8p1 Centos7上的编译后二进制 一键
     附件:Portable_Openssl-Openssh9.8p1-bin-el7.v1.2.1.tgz.zip特点:适用于centos7.x 已经编译为二进制对老版本的关键二进制文件sshd、sftp、scp、openssl进行了备份升级前,自动打开一个端口为2222的老版本的sshd服务,你可以连接那个2222的服务,以防死翘翘。对sshd_config进......
  • centos7 yum安装php5.6以及扩展
    1.启用Remi仓库sudoyuminstall-yhttp://rpms.remirepo.net/enterprise/remi-release-7.rpm2.使用yum-config-manager来启用PHP5.6存储库。yuminstall-yyum-utilssudoyum-config-manager--enableremi-php563.安装PHP5.6及其模块sudoyuminstall-yph......
  • CentOS编译安装R
    文章目录R语言简介yum安装编译安装下载源码包解压缩并configure编译安装R语言简介R语言是一种广泛用于统计计算和图形绘制的编程语言和软件环境。以下是R语言的一些主要特点和用途:统计分析:R语言为各种统计和数据分析提供了丰富的工具和函数。图形功能:R拥有强大......
  • CentOS使用ClamAV查杀木马病毒
    相对Windows来说,CentOS是很少有病毒和木马的,但是随着挖矿行为的兴起,服务器也越来越容易成为黑客的攻击目标,一方面我们需要加强安全防护,另外如果已经中毒,则需要使用专业工具进行查杀。ClamAV是开源的专业病毒、木马、恶意软件的查杀工具,支持多种Linux发行版,包括CentOS。安装Cla......
  • CentOS修改系统默认语言与编码
    有时候在安装CentOS无意中把默认语言设置为中文,而部分SSH软件不支持中文编码,所以在远程管理的时候会出现些乱码的现象。如何修改CentOS的默认语言呢?请先使用root权限帐户登陆一、进入语言配置文件vi /etc/sysconfig/i18n用SSH执行以上命令,用vi编辑器修改/etc/sysconfig/i1......
  • CentOS 6.X配置本地yum源
    当你想一键安装软件及其配套软件的时候,是否在为键入一个一个命令而头疼呢? 当你想使用yum命令安装软件发现及其不能连接网络的时候,是否在苦恼啊?试试下面的配置吧,很方便。 一、挂载本地光盘到系统:把Cent6.2安装光盘放入光驱,在终端命令行下操作   mkdir/mnt/cdrom #......
  • centos6.5下安装配置Bind DNS服务器
    前言:了解named 如果说我们安装的rpm包不符合我们的要求怎么办、比如说我们想起用named的线程模式、比如说我想让他禁用IPv6、比如说我们想启用某种特性、而rpm在编译时没有提供、那这时我们只能去手动编译安装了,那如何去编译安装named:   编译安装named有一个麻烦之处、......