linux配置centos的yum源本地仓库搭建
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux配置centos的yum源本地仓库搭建相关的知识,希望对你有一定的参考价值。
1.放置iso文件,并挂载iso文件,永久挂载,修改/etc/fstab
参考:https://blog.csdn.net/qq_36119192/article/details/82222175#%E4%B8%80%EF%BC%9A%E9%85%8D%E7%BD%AE%E6%9C%AC%E5%9C%B0yum%E6%BA%90
或者搜索:Linux配置yum源(本地源和网络源) - 谢公子的博客
2.到该目录/etc/yum.repos.d删除所有文件rm -rf *,并创建base.repo
[bash]
name=my new repo
baseurl=file:///Archive/RedHat-Enterprise-Linux/7.4
enabled=1
gpgcheck=0
解读如下
[name] #括号中的名称为仓库源名称,要对应上,通常为字母和数字,必须填写
name=my new repo #对yum的描述,可写可不写
baseurl=file:///mnt/cdrom #baseurl表示声明yum可以管理并使用的rpm包路径,必须填写
enabled=1 #enabled表示当前仓库是否开启,1为开启,0为关闭,此项不写默认为开启
gpgcheck=0 #gpgcheck表示安装rpm包时,是否基于公私钥对匹配包的安全信息,1表示开启,
#0表示关闭,此项不写默认为验证
下面每一步都要做
3.清空
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Cleaning repos: base
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
4.查看一下repolist
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 4.1 kB 00:00
(1/2): base/group_gz | 137 kB 00:00
(2/2): base/primary_db | 4.0 MB 00:00
repo id repo name status
base Base 4,986
repolist: 4,986
5.yum包存储到本地
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 4.1 kB 00:00
Metadata Cache Created
6.列出yum包
[root@localhost yum.repos.d]# yum list |wc -l
5096
以上是关于linux配置centos的yum源本地仓库搭建的主要内容,如果未能解决你的问题,请参考以下文章