linux rhel7 yum源配置

本文详细介绍了如何在RHEL7系统中配置yum源,包括使用本地光盘作为源的具体步骤,以及如何通过创建repo文件来指定源的位置。文中还讲解了如何设置挂载点并实现永久挂载。

1、yum源作为rhel7的下载源仓库在应用时至关重要,用于软件包安装

2、RHEL7中yum源默认放在 /etc/yum.repos.d 目录下,且以 .repo 结尾
使用本地光盘做为YUM源
(1)在目录下创建 XXX.repo文件用来存储yum源配置信息
[XXX] yum源唯一标识符,避免与其他yum仓库重名,默认建议使用文件名来作为此处标识
name = XXXXXXXXXXXXXXX yum仓库描述信息,用来清楚明了的知道yum用处
baseurl = file:///mnt/cdrom yum源本地存放位置

此外,yum源亦可以使用网上的epel源

 

enable = 1 是否开启yum仓库
gpgcheck = 0 设置此yum仓库是否需要校验信息(1需要,0不要)
gpgkey = 校验文件url gpgcheck=1时需要此信息

3、做完之后,创建挂载点(临时挂载)
# mkdir /mnt/cdrom
# mount /dev/sr0 /mnt/cdrom (rhel7 本地镜像对应文件/dev/sr0)

4、永久挂载(写入/etc/fstab文件)
(1)/dev/sr0 /mnt/cdrom iso9660 ro(只读) 0 0 (镜像默认文件系统 iso9660)
(2)挂载文件 /mnt/cdrom iso9660 loop,ro 0 0 以回环的方式挂载
 

redhat 7.2 可用的yum源, 亲自测试可以使用 ,使用过程: 1.卸载已经存在的yum: rpm -qa | grep yum | xargs rpm -e --nodeps 2.将yum 文件放到server中 3.执行rpm -ivh yum-* 4.创建repo文件: #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 - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$7 - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 5.测试是否安装成功 yum -y install tree
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Star星屹程序设计

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

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

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

打赏作者

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

抵扣说明:

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

余额充值