Red Hat Enterprise Linux 7 / 8 / 9 更换 Centos 源镜像

这篇具有很好参考价值的文章主要介绍了Red Hat Enterprise Linux 7 / 8 / 9 更换 Centos 源镜像。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

Red Hat  YUM 源是需要注册付费的,如果要使用 Red Hat 系统安装软件,需要将Red Hat 源替换为CentOS对应的源,在替换 YUM 源的过程以及所遇到的问题;如不一定要使用 Red Hat 系统,建议直接下载使用 CentOS 

redhat.repo编辑,linux,运维,服务器

当前Red Hat 版本 测试环境三台,分别为  Red Hat 7 /8 9.2 / 

[root@localhost ~]# vi /etc/hosts  修改计算机名称
[root@localhost ~]# nmcli general hostname xx 修改计算机名称
[root@localhost ~]# cat /etc/redhat-release  查看系统版本信息

Red Hat Enterprise Linux Server release 7.9 (Maipo)

Red Hat Enterprise Linux release 8.8 (Ootpa)

Red Hat Enterprise Linux release 9.2 (Plow) 

一、Red Hat Enterprise Linux 7 更换方式:

This system is not registered with an entitlement server. You can use subscription-manager to register.

redhat.repo编辑,linux,运维,服务器

1.1  先删除系统自带的 yum 软件包

[root@redHatEnterpriseLinux7 ~]# rpm -qa |grep yum

redhat.repo编辑,linux,运维,服务器

[root@redHatEnterpriseLinux7 ~]# rpm -qa|grep yum|xargs rpm -e --nodeps
[root@redHatEnterpriseLinux7 ~]# rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps

1.2 . 下载 centos7  6个相关的软件包

http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
http://mirrors.163.com/centos/7/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm

redhat.repo编辑,linux,运维,服务器

1.3  将 rmp 6个包上传到 opt 的目录 需要注意安装顺序:

----安装顺序:
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
----这两个要一起安装
rpm -ivh yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm yum-3.4.3-168.el7.centos.noarch.rpm
----最后安装 wget
[root@redHatEnterpriseLinux7 opt]# rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm 

redhat.repo编辑,linux,运维,服务器

1.4 通过 wget 下载配置文件 Centos

[root@redHatEnterpriseLinux7 opt]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

redhat.repo编辑,linux,运维,服务器

1.5 修改 刚刚 wget 下载来的 CentOS-Base.repo 配置 文件 位于 /etc/yum.repos.d 目录

# 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-7 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
        http://mirrors.aliyuncs.com/centos/7/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-7 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/7/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/7/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/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-7 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/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-7 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[root@redHatEnterpriseLinux7 yum.repos.d]# vi CentOS-Base.repo
[root@redHatEnterpriseLinux7 yum.repos.d]# mv CentOS-Base.repo redhat.repo
[root@redHatEnterpriseLinux7 ~]# yum clean all 
[root@redHatEnterpriseLinux7 ~]# yum makecache

redhat.repo编辑,linux,运维,服务器

1.6  清理一下缓存 和 生成一下 缓存  yum clean all  &  yum makecache

redhat.repo编辑,linux,运维,服务器 1.7  测试 yum 安装 yum install -y lrzsz   yum -y install vim*   和 yum update 是否安装成功

[root@redHatEnterpriseLinux7 ~]# yum repolist

redhat.repo编辑,linux,运维,服务器

redhat.repo编辑,linux,运维,服务器

redhat.repo编辑,linux,运维,服务器

redhat.repo编辑,linux,运维,服务器

二、Red Hat Enterprise Linux 8 更换方式:

2.1 在配置文件中关闭这个官方的订阅  编辑配置文件“  更改参数“ enabled = 1”到“ enabled = 0”

vi /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0

2.2 将 Red Hat  官方订阅删除

yum remove subscription-manager

redhat.repo编辑,linux,运维,服务器

2.3 red hat 8 更换 Centos 8 阿里云镜像源;

备份一下 redhat.repo 文件
mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.bak

获取新的 CentOS-Base.repo 到 /etc/yum.repos.d/ 
curl -o /etc/yum.repos.d/redhat.repo http://mirrors.aliyun.com/repo/Centos-8.repo

也可以使用 wget -O 来获取,但需要手动下在 rpm -ivh wget-1.14-18.el7_6.1.x86_64 来安装 
wget -O /etc/yum.repos.d/redhat.repo http://mirrors.aliyun.com/repo/Centos-8.repo

下载新的CentOS-Base.repo 到 /etc/yum.repos.d/ (这里用的CentOS 8.0)

redhat.repo编辑,linux,运维,服务器

2.4 更换完成之后要 进行清除缓存,生成缓存;

[root@redHatEnterpriseLinux8 ~]# yum clean all
[root@redHatEnterpriseLinux8 ~]# yum makecache

redhat.repo编辑,linux,运维,服务器

2.5  测试 yum 安装 yum -y install wget  &  yum install -y lrzsz   看看能否安装成功;

redhat.repo编辑,linux,运维,服务器

redhat.repo编辑,linux,运维,服务器

三、Red Hat Enterprise Linux 9 更换方式:

redhat.repo编辑,linux,运维,服务器3.1  修改红帽的订阅管理配置文件  vi subscription-manager.conf
       把enabled的置改成0,然后保存  , 再删除 官方订阅  yum remove subscription-manager

[root@RedHatEnterpriseLinux9 ~]# cd /etc/yum/pluginconf.d/
[root@RedHatEnterpriseLinux9 ~]# vi subscription-manager.conf 
[root@RedHatEnterpriseLinux9 ~]# yum remove subscription-manager

redhat.repo编辑,linux,运维,服务器

redhat.repo编辑,linux,运维,服务器

3.2 再删除 cd /etc/yum.repos.d 目录下的 redhat.repo 文件 ,   rm -rf  redhat.repo 
      如没有 redhat.repo 这个文件了,就不用管:

3.3  使用 vi  redhat.repo 编辑一个新的配置文件:

vi  redhat.repo  添加如下内容:

[AppStream]
name=AppStream
baseurl=http://mirrors.aliyun.com/almalinux/9.2/AppStream/x86_64/os/
gpgcheck=0
enabled=1

[BaseOS]
name=BaseOS
baseurl=http://mirrors.aliyun.com/almalinux/9.2/BaseOS/x86_64/os/
gpgcheck=0
enabled=1

[extras]
name=extras
baseurl=http://mirrors.aliyun.com/almalinux/9.2/extras/x86_64/os/
gpgcheck=0
enabled=1

[plus]
name=plus
baseurl=http://mirrors.aliyun.com/almalinux/9.2/plus/x86_64/os/
gpgcheck=0
enabled=1

[devel]
name=devel
baseurl=http://mirrors.aliyun.com/almalinux/9.2/devel/x86_64/os/
gpgcheck=0
enabled=1

[NFV]
name=NFV
baseurl=https://mirrors.aliyun.com/almalinux/9.2/NFV/x86_64/os/
gpgcheck=0
enabled=1

[CRB]
name=CRB
baseurl=https://mirrors.aliyun.com/almalinux/9.2/CRB/x86_64/os/
gpgcheck=0
enabled=1

[HighAvailability]
name=HighAvailability
baseurl=https://mirrors.aliyun.com/almalinux/9.2/HighAvailability/x86_64/os/
gpgcheck=0
enabled=1

3.4  执行  yum clean all  &  yum makecache

[root@RedHatEnterpriseLinux9 ~]# yum clean all  
[root@RedHatEnterpriseLinux9 ~]# yum makecache

redhat.repo编辑,linux,运维,服务器

3.5 测试 dnf 安装 yum install wget  &  yum install lrzsz  &  yum update 看看能否安装成功; 

redhat.repo编辑,linux,运维,服务器redhat.repo编辑,linux,运维,服务器

redhat.repo编辑,linux,运维,服务器文章来源地址https://www.toymoban.com/news/detail-776647.html

到了这里,关于Red Hat Enterprise Linux 7 / 8 / 9 更换 Centos 源镜像的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • VMware安装Red Hat7.9及Red Hat Enterprise Linux7.9下载

    【百度网盘下载】 链接:https://pan.baidu.com/s/1567NfZRF48PBXfUqxumvDA 提取码:bm7u 【点击创建虚拟机】 【自定义高级】 【选择光盘映像安装】 全名自定义即可 【虚拟机命名+处理器配置】 【内存配置+网络类型】 【I/O控制器+磁盘类型】 【磁盘选择+磁盘容量】 【磁盘文件+完成创建

    2024年04月17日
    浏览(33)
  • Red Hat Enterprise Linux 7.9 安装图解

    风险告知 本人及本篇博文不为任何人及任何行为的任何风险承担责任,图解仅供参考,请悉知! 本次安装图解是在一个全新的演示环境下进行的,演示环境中没有任何有价值的数据,但这并不代表摆在你面前的环境也是如此。 生产环境全新安装或者自行测试都可放心参考该

    2024年01月23日
    浏览(33)
  • Red Hat Enterprise Linux 9.3 安装图解

    风险告知 本人及本篇博文不为任何人及任何行为的任何风险承担责任,图解仅供参考,请悉知! 本次安装图解是在一个全新的演示环境下进行的,演示环境中没有任何有价值的数据,但这并不代表摆在你面前的环境也是如此。 生产环境全新安装或者自行测试都可放心参考该

    2024年01月23日
    浏览(32)
  • Red Hat Enterprise Linux 6.10 安装图解

    风险告知 本人及本篇博文不为任何人及任何行为的任何风险承担责任,图解仅供参考,请悉知! 本次安装图解是在一个全新的演示环境下进行的,演示环境中没有任何有价值的数据,但这并不代表摆在你面前的环境也是如此。 生产环境全新安装或者自行测试都可放心参考该

    2024年01月20日
    浏览(30)
  • Red Hat Enterprise Linux 9/8/7/6合集下载

    各位朋友: 大家好!小武studio带大家了解一下红帽系统: 红帽公司成立于1993年,是全球首家收入超10亿美元的开源公司,总部位于美国,分支机构遍布全球。红帽公司作为全球领先的开源和Linux系统提供商,其产品已被业界广泛认可并使用,尤其是RHEL系统在业内拥有超高的

    2024年04月27日
    浏览(32)
  • Red Hat Enterprise Linux (RHEL) 9.2 (x86_64, aarch64) - 红帽企业 Linux 9.2 发布

    Red Hat Enterprise Linux (RHEL) 9.2 (x86_64, aarch64) 红帽企业 Linux 9.2 请访问原文链接:https://sysin.org/blog/rhel-9/,查看最新版。原创作品,转载请保留出处。 作者主页:sysin.org 红帽企业 Linux 9 红帽 2023-05-11 12:10 发表于北京 红帽企业 Linux 9.2 和 8.8 推动混合云中更大规模的 Linux 自动化,有

    2024年02月04日
    浏览(38)
  • 在 CentOS 或 Red Hat 系统上安装 Citus 组件

    要在 CentOS 或 Red Hat 系统上安装 Citus 组件,你可以按照以下步骤操作: 首先,使用 curl 命令下载 Citus 社区版的安装脚本: 接着,使用 sudo 权限运行这个脚本来添加 Citus 的仓库: 安装 Citus。这里的示例是安装 citus121_16 ,但你应该根据你的 PostgreSQL 版本和需求选择合适的版本

    2024年02月04日
    浏览(39)
  • 如何将 ONLYOFFICE 桌面版编辑器 7.5 安装到 Red Hat、CentOS 及衍生产品上

     使用桌面版的 ONLYOFFICE 在线编辑器,您可使用本地文件操作,无需保持互联网连接状态。 ONLYOFFICE 桌面编辑器 是一款全面的办公工具,提供了文本文档、电子表格、演示文稿、可填写表单和 PDF 查看和编辑功能。它高度兼容微软 Office 格式,包括 .docx、.xlsx 和 .pptx 等文件格

    2024年02月07日
    浏览(37)
  • Linux Red Hat 9.0使用源代码编译安装Nginx

    目录 前言 编译安装Nginx源代码 下载安装必须的依赖项(GCC编译器,GNU make工具,PCRE库和zlib库) 创建nginx组和用户账户 进入浏览器,拉取nginx源码(Nginx 1.20.2版本) 上传到Red Hat(此处上传在/home/zyz下) 移动源码到root用户下 解压 进入nginx-1.20.2目录下 检查平台安装环境 执行

    2024年03月10日
    浏览(43)
  • RedHat Enterprise Linux8如何重置root密码

    本博客将提供两种方式来更改root用户密码,按需取用~ 目录 方法一: 1.启动系统进入GRUB2界面 2.找到以Liunx开头的那一行使用init=/bin/bash替换末尾的rhgb quiet 3.按Ctrl+X键启动系统 4.执行passwd root修改密码 5.执行touch /.autorelabel用于重新标记SELinux环境值 6.执行exec /sbin/init命令启动系

    2024年04月25日
    浏览(25)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包