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

Steps to configure a YUM source (principle)

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

There are generally two ways to configure yum:

One is to configure the yum.conf file in the / etc directory directly.

The other is to add a .repo file to the / etc/yum.repos.d directory.

1. Detailed explanation of yum configuration file yum.conf

Whether the cache directory keepcache=0 # cache of the RPM package downloaded by $cat / etc/yum.conf [main] cachedir=/var/cache/yum # yum is saved, 1 is saved, 0 is not saved. Debuglevel=2 # debug level (0-10), default is 2 (I don't know the application of specific debug level). The location of log files for logfile=/var/log/yum.log # yum whether exactarch=1 # allows you to update different versions of RPM packages when updating, such as whether to update i686 RPM packages on i386. Obsoletes=1 # this is a parameter for update, see yum (8), which is simply equivalent to upgrade and allows you to update stale RPM packages. Whether gpgcheck=1 # checks GPG (GNU Private Guard), a key signature. Whether plugins=1 # allows the use of plug-ins or not, the default is 0, but we usually use the plug-in yum-fastestmirror. Installonly_limit=3 # how many kernel packages are allowed to be retained. Exclude=selinux* # shields RPM packages that you do not want to update. Wildcards can be used, and spaces are used to separate multiple RPM packages. # This is the default, if you make this bigger yum won't see if the metadata# is newer on the remote and so you'll "gain" the bandwidth of not having to# download the new metadata and "pay" for it by yum not having correct# information.# It is esp. Important, to have correct metadata, for distributions like# Fedora which don't keep old packages around. If you don't like this checking# interupting your command line usage, it's much better to have something# manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m# PUT YOUR REPOS HERE or IN separate files named file.repo# in / etc/yum.repos.d

2. Detailed explanation of * .repo document

What is a repo file?

Repo file is the configuration file of yum source (software repository) in Fedora. Usually a repo file defines the details of one or more software repositories, such as where we will download software packages that need to be installed or upgraded, and the settings in the repo file will be read and applied by yum!

Let's take a repo file that comes with the system as an example (Fedora and redhat are the same) (the # is followed by a comment I added):

[fedora] # what is in square brackets is the name of the software source, which will be obtained by yum and identified by name=Fedora $releasever-$basearch # the name of the software repository is also defined here, usually in order to facilitate reading the configuration file, which is generally useless. The $releasever variable defines the release version, which is usually a number such as 8jie, 9jie, 10, etc., and the $basearch variable defines the architecture of the system, which can be i386, x86, 64, ppc and so on. These two variables have different values according to the version architecture of the current system, which makes it convenient for yum to choose the software package suitable for the current system when upgrading, as follows. Failovermethod=priority # failovermethod has two values to choose from. Priority is the default value, which means that the image server address is selected sequentially from the listed baseurl. Roundrobin means that exclude=compiz* * compiz* fusion-icon* # exclude is randomly selected among the listed servers. I added this option later to prohibit the installation and update of some software packages in this software repository. Wildcards can be used and separated by spaces. You can add a line of baseurl above # baseurl= http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/# as needed. The first character is'#'to indicate that the line has been commented and will not be read. This line means to specify a baseurl (image server address of the source) # mirrorlist= http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch#. The line above specifies the address list of an image server, which is usually enabled. In this case, the annotation symbol is disabled. We can try to replace $releasever and $basearch with their own corresponding versions and schemas, such as 10 and i386, open in the browser. We can see a long list of mirror server addresses available for mirrors. Choose our own faster access to the image server address to copy and paste into the repo file, we can get a faster update speed The format is as follows: baseurl= ftp://ftp.sfc.wide.ad.jp/pub/Linux/Fedora/releases/10/Everything/i386/oshttp://ftp.chg.ru/pub/Linux/fedora/linux/releases/10/Everything/i386/oshttp://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/10/Everything/i386/oshttp://mirror.nus.edu.sg/fedora/releases/10/Everything/i386/oshttp:// The option mirror.yandex.ru/fedora/linux/releases/10/Everything/i386/os http://ftp.twaren.net/Linux/Fedora/linux/releases/10/Everything/i386/oshttp://ftp.itu.edu.tr/Mirror/Fedora/linux/releases/10/Everything/i386/osenabled=1 # indicates that the source defined in this repo is enabled 0 to disable gpgcheck=1 # this option means that the rpm downloaded in this repo will be verified by gpg. It has been determined that the source of the rpm package is a valid and secure gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch # definition of the gpg key for verification, which is the location of the public key file of the digital signature! # # the following software repositories are basically not needed The meaning of the option is the same as [fedora-debuginfo] name=Fedora $releasever-$basearch-Debugfailovermethod=priority#baseurl= http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearchenabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch[fedora-source]name=Fedora $releasever-Sourcefailovermethod=priority#baseurl= http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/ Mirrorlist= http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearchenabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

Let's take a look at the repo file that comes with rhel5.8

[root@10gasm yum.repos.d] # cat rhel-debuginfo.repo [rhel-debuginfo] name=Red Hat Enterprise Linux $releasever-$basearch-Debugbaseurl= ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

I set up the local yum library myself

[root@10gasm yum.repos.d] # cat dvd.repo [dvd] name=install dvdbaseurl= file:///mnt/Serverenabled=1gpgcheck=0

It's simple.

You can use the following command to check whether all container configurations (Repository) are in effect

Yum repolist all

All container configurations are listed using the all parameter. If only the available Repository is listed without all, the availability depends on the enabled parameter in the repo configuration file. If 0, it is not available, and 1 is available.

For example:

[root@10gasm yum.repos.d] # yum repolist allLoaded plugins: katello, product-id, security Subscription-managerUpdating certificate-based repositories.Unable to read consumer identityrepo id repo name statusdvd install dvd Enabled: 3285rhel-debuginfo Red Hat Enterprise Linux 5Server-x8634-Debug disabledrepolist: 3285

It shows that the dvd repository is available, there are 3285 files, and the rhel-debuginfo library is not available.

If you change the enabled in rhel-debuginfo to 1 and then view it again

[root@10gasm yum.repos.d] # yum repolist allLoaded plugins: katello, product-id, security Subscription-managerUpdating certificate-based repositories.Unable to read consumer identity ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/x86_64/Debuginfo/repodata/repomd.xml: [Errno 4] IOError: Trying other mirror.repo id repo name statusdvd Install dvd enabled: 3285rhel-debuginfo Red Hat Enterprise Linux 5Server-x8634-Debug enabled: 0repolist: 3285

After the configuration is completed, execute yum update. Error: Error performing checksum

[root@web1 yum.repos.d] # yum update

Loaded plugins: katello, product-id,security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Base | 3.7 kB 00:00

Base/primary_db | 4.4 MB 00:02

Http://mirrors.ustc.edu.cn/centos/6.4/os/x86_64/repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2: [Errno-3] Error performingchecksum

Trying other mirror.

Base/primary_db | 4.4 MB 00:02

Http://mirrors.ustc.edu.cn/centos/6.4/os/x86_64/repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2: [Errno-3] Error performing checksum

Trying other mirror.

Error: failure:repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2from base: [Errno 256] No more mirrors to try.

Google said that the repomd.xml file uses sha256 as the hash algorithm in rhel 6 and sha as the hash algorithm by default in rhel 5.

But I use the 5.9 yum on redhat 5.8s. This kind of mistake also made.

# yum clean all clears the registration record of yum.

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