In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
The editor will share with you the example analysis of YUM source configuration and related problems under Centos. I hope you will gain something after reading this article. Let's discuss it together.
Application of YUM Source configuration and related problems under Centos
Yum source configuration is often used in work, especially when installing databases, it is time-consuming to install dependency packages one by one, so just configure yum installation directly.
1. Yum configuration instructions (this part is reproduced)
The configuration file for yum is divided into two parts: main and repository
The global configuration options are defined in the main section, and the entire yum configuration file should have only one main. Often located in / etc/yum.conf.
The repository section defines the specific configuration of each source / server, which can have one or more. It is often located in the files in the / etc/yum.repo.d directory.
The yum.conf file is generally located in the / etc directory and generally contains only the configuration options for the main section.
# cat / etc/yum.conf
[main] cachedir=/var/cache/yum / / yum cache directory where yum stores downloaded rpm packages and databases. The default setting is whether to keep the software package after installation, 0 is not retained (default is 0), 1 is reserved debuglevel=2 / / Debug information output level, range is 0-10, default is 2logfile=/var/log/yum.log / / yum log file location. Users can check the / var/log/yum.log file for past updates. The policy of pkgpolicy=newest / / package. There are two options, newest and last, this function is that if you set up multiple repository and the same software exists in different repository at the same time, which yum should install, and if it is newest, yum will install the latest version. In the case of last, yum alphabetically sorts the server id and selects the software installation on the last server. Newest is usually chosen. Distroverpkg=redhat-release / / specify a package based on which yum will determine your distribution. The default is redhat-release, or it can be any rpm package installed for your own distribution. Tolerant=1 / / has two options 1 and 0, indicating whether yum tolerates errors related to software packages on the command line. For example, if you want to install three packages, 3 of which have already been installed, if you set it to 1, yum will not have an error message. The default is 0. Exactarch=1 / / has options 1 and 0, and if set to 1, yum will only install packages that match the system architecture. For example, yum will not install packages for i686 on systems that are suitable for i386. The default is 1. The number of retries after a retries=6 / / network connection error. If set to 0, it will be retried indefinitely. The default value is 6.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. Plugins=1 / / whether to enable the plug-in. Default 1 is allowed, and 0 means disallowed. We usually use the plug-in yum-fastestmirror. Bugtracker_url= http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum# Note: yum-RHN-plugin doesn't honor this.metadata_expire=1hinstallonly_limit = PUT YOUR REPOS HERE OR IN separate files named file.repo# in / etc/yum.repos.d
II. Local yum source configuration
# cd / etc/yum.repos.d/
Ls will see four repo files
CentOS-Base.repo is the configuration file for the yum network source
CentOS-Media.repo is the configuration file for the local source of yum
Modify the CentOS-Base.repo name, the system will first load the network source, when using the local source, you need to change its name. The remaining two can be backed up or deleted.
Modify CentOS-Media.repo, change the second path in baseurl to / mnt/cdrom (that is, the CD mount point) as shown below, and change enabled=0 to 1
After the configuration is completed, execute yum celan all to clear the cache, and then execute yum makecache. As shown in the figure below, two errors were reported because two other useless baseurl were executed, which can be deleted in the actual application.
III. Network YUM source configuration
Compared with the local yum source configuration, the network yum source does not need to mount the iso image file, so it is easier to configure.
CentOS-Base.repo is the configuration file of yum network source. Vi this file to configure, comment mirrolist, and modify baseurl as follows
[base] name=CentOS-$releasever-Base#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osbaseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates [updates] name=CentOS-$releasever-Updates#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesbaseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm- Gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be [extras] name=CentOS-$releasever-Extras#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasbaseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever-Plus#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusbaseurl=http://mirrors .163.com / centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib-packages by Centos users [contrib] name=CentOS-$releasever-Contrib#mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribbaseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
After configuring according to the above script, execute yum clean all to clear the cache, and then install the vim test. No problem.
The following are the real problems encountered and the validated solutions found by the network
1. The error log is as follows
File:///mnt/cdrom/LinuxSrc/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory:'/ mnt/cdrom/LinuxSrc/repodata/repomd.xml'Trying other mirror.Error: Cannot retrieve repository metadata (repomd.xml) for repository: media. Please verify its path and try again
The root cause of this error is that the rpm package storage paths for RHEL version 5.x and RHEL version 6.x are different:
RHEL 5.x:.. / Server for example: my case environment is under / mnt/cdrom/LinuxSrc/Server.
RHEL 6.x:.. / Packages
After reading this article, I believe you have some understanding of "sample Analysis of YUM Source configuration and related problems under Centos". If you want to know more about it, please follow the industry information channel. Thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.