RedHat 7.X Yum源配置

本地光盘源配置

mkdir -p /iso
mount /dev/cdrom /iso
cp -rf /etc/yum.repos.d /etc/yum.repos.d_$(date '+%Y%m%d_%H%M%S')
rm -rf /etc/yum.repos.d/*
vi /etc/yum.repos.d/local.repo
填入如下内容:

[local]
name=local
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

清除Yum缓存
yum clean all
yum makecache
yum list

网络源:

vi /etc/yum.repos.d/local.repo
添加内容如下

[base]
name= yum repo
baseurl=http://mirrors.aliyun.com/centos/7/os/$basearch/
enabled=1
gpgcheck=0

FTP源:

vi /etc/yum.repos.d/local.repo
添加内容如下

[linux]
name=base
baseurl=http://10.10.10.10/RedHat/rhel7.5x86_64 #这是企业内部搭建的http yum服务
enabled=1
gpgcheck=0

网络历史源:

目前RedHat历史版本的源只能从归档源中获取了,另外RedHat 新版本的源没有redhat用户是用不了的。

1.首先删除redhat原有的yum ,因为redhat 原本的yum 没有注册为redhat用户是用不了的。
rpm -aq|grep yum|xargs rpm -e --nodeps
2.下载归档的yum 安装包,下面以7.6为例
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
vi /etc/yum.repos.d/local.repo
在文件中写入

[local]
name=local
baseurl=file:///iso
gpgcheck=1
enabled=1
gpgkey=file:///iso/RPM-GPG-KEY-redhat-release
[base]
name=CentOS-$releasever - Base
baseurl=http://linuxsoft.cern.ch/centos-vault/7.6.1810/os/$basearch/
gpgcheck=1
gpgkey=http://linuxsoft.cern.ch/centos-vault/7.6.1810/os/x86_64/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=http://linuxsoft.cern.ch/centos-vault/7.6.1810/updates/$basearch/
gpgcheck=1
gpgkey=http://linuxsoft.cern.ch/centos-vault/7.6.1810/os/x86_64/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://linuxsoft.cern.ch/centos-vault/7.6.1810/extras//$basearch/
gpgcheck=1
gpgkey=http://linuxsoft.cern.ch/centos-vault/7.6.1810/os/x86_64/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://linuxsoft.cern.ch/centos-vault/7.6.1810/centosplus//$basearch/
gpgcheck=1
enabled=0

清除缓存并更新
yum clean all
yum update
安装epel
yum install epel-release

RedHat 8.x Ali源可以参考如下写法

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.aliyun.com/centos/7.5.1804/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.aliyun.com/centos/7.5.1804/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.aliyun.com/centos/7.5.1804/extras//$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.aliyun.com/centos/7.5.1804/centosplus//$basearch/
gpgcheck=1
enabled=0

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

mandarin_meng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值