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 create YUM Software Repository in Centos

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, the editor will share with you the relevant knowledge points about how to create a YUM software warehouse in Centos. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

Create Yum with DVD ISO

We use Centos 7 dvd in this tutorial, and the same process should apply to RHEL 7.

First create a directory called Yum in the root folder

$mkdir / YUM

Then mount the Centos 7 ISO:

$mount-t iso9660-o loop / home/dan/Centos-7-x86_x64-DVD.iso / mnt/iso/

Next, copy the package from the mounted ISO to / YUM. When all the packages are copied to the system, we will install the packages needed to create the Yum. Open / YUM and install the following RPM package:

$rpm-ivh deltarpm$ rpm-ivh python-deltarpm$ rpm-ivh createrepo

After the installation is complete, we will create a file called local.repo in / etc/yum.repos.d that contains all the Yum information.

$vi / etc/yum.repos.d/local.repoLOCAL REPO] Name=Local YUMbaseurl= file:///YUMgpgcheck=0enabled=1

Save and exit the file. Next, we will create the warehouse data by running the following command.

$createrepo-v / YUM

It takes some time to create warehouse data. When you are done, run:

$yum clean all

Clear the cache and run:

$yum repolist

Check all warehouse lists. You should see local.repo in the list.

Create an image Yum repository using an online repository

The process of creating an online Yum is similar to creating a Yum using an ISO image, except that we will get the rpm package from the online repository instead of ISO.

First, we need to find an online repository to get the latest software packages. It is recommended that you find an online Yum repository closest to your location to optimize download speed. We will use the image below. You can select the one closest to you from the CENTOS image list [2].

After selecting a mirror, we will use rsync to synchronize the image with our system, but before you do so, make sure you have enough space on your server.

$rsync-avz rsync://mirror.fibergrid.in/centos/7.2/os/x86_64/Packages/s/ / YUM

Synchronization will take a long time (maybe an hour), depending on the speed of your Internet. After the synchronization is complete, we will update our warehouse data.

$createrepo-v / YUM

Our Yum is ready to use. We can create a cron task to automatically update warehouse data on a daily or weekly basis according to your needs.

To create a cron task for synchronizing the repository, run:

$crontab-e

And add the following lines

30 12 * rsync-avz http://mirror.centos.org/centos/7/os/x86_64/Packages/ / YUM

This synchronizes Yum at 12:30 every night. Also remember to create a warehouse configuration file in / etc/yum.repos.d, as we did above.

That's it. You use your own Yum warehouse now.

These are all the contents of the article "how to create a YUM Software Repository in Centos". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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

Development

Wechat

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

12
Report