Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build YUM local warehouse in CentOS7

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to build a local YUM warehouse in CentOS7. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Detailed steps of building YUM local warehouse under CentOS 7

Use CentOS7.iso to build a local warehouse

(1) copy the CentOS7.iso file to the user's home directory: ~

Cp CentOS7.iso ~

(2) create the directory where the iso file will be hung

Mkdir-p / mnt/cdrom

(3) hang the iso file in the directory you just created

Mount-o loop CentOS7.iso / mnt/cdrom

(4) create the repo file Local.repo, and add the following to it

Vim / etc/yum.repos.d/Local.repo [Local] name=Local Yum baseurl= file:///mnt/cdrom gpgcheck=1 gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1

PS: this way you do not need to use createrepo to create an index file, because the index file is already created in the ISO file and is located in the repodata folder

Create a custom local YUM source

This method is mainly aimed at our usual collection of some RPM software packages, we want to collect the RPM packages into their own YUM warehouse, so that it is easy to install offline, very flexible and convenient.

(1) create a directory for the local warehouse. For example, I (root) create it under the local directory under the home directory.

Mkdir / root/local

(2) move all the sorted RPM packages to this directory

Mv * .rpm / root/local

(3) install createrepo

Yum-y install createrepo

(3) use createrepo to create index

Createrepo / root/local

(4) create repo file

Vim / etc/yum.repos.d/Local.repo enter the following content [Local] name=Local Yum baseurl= file:///root/local gpgcheck=1 gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1

So far, the above two methods have been successful in creating local repositories. You only need to update the cache below.

This is the end of yum makecache's article on "how to build a local YUM warehouse in CentOS7". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report