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 configure yum source for redhat6

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "redhat6 how to configure yum source", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "redhat6 how to configure yum source" bar!

Because redhat's yum online update is free, you can't use it without registration. If you want to use it, you need to uninstall redhat's yum, restart the installation, and then configure other sources.

This article includes configuring local sources and third-party sources. Third-party sources include: NetEase, epel,repoforge, rpmfusion. The following is the detailed process:

1. Delete the original yum of redhat

Rpm-aq | grep yum | xargs rpm-e-nodeps

two。 Download the yum installation file

Note that if you can't find the file when you download it, log in to: http://mirrors.163.com/centos/6/os/x86_64/ to find the appropriate file. And then download it.

Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm

Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm

Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm

Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

3. To install yum

Rpm-ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

Rpm-ivh yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm

Rpm-ivh yum-3.2.27-14.el6.centos.noarch.rpm um-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm

Note that the last two packages must be installed at the same time, otherwise they will depend on each other

-configure NetEase sourc

4. Update repo files

Mv / etc/yum.repos.d/rhel-debuginfo.repo / etc/yum.repos.d/rhel-debuginfo.repo.repo.bak

Vi / etc/yum.repos.d/rhel-debuginfo.repo

The content is:

[base]

Name=CentOS-$releasever-Base

Baseurl= http://mirrors.163.com/centos/6.0/os/$basearch/

Gpgcheck=1

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# released updates

[updates]

Name=CentOS-$releasever-Updates

Baseurl= http://mirrors.163.com/centos/6.0/updates/$basearch/

Gpgcheck=1

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# packages used/produced in the build but not released

# [addons]

# name=CentOS-$releasever-Addons

# baseurl= http://mirrors.163.com/centos/$releasever/addons/$basearch/

# gpgcheck=1

# gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# additional packages that may be useful

[extras]

Name=CentOS-$releasever-Extras

Baseurl= http://mirrors.163.com/centos/6.0/extras/$basearch/

Gpgcheck=1

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# additional packages that extend functionality of existing packages

[centosplus]

Name=CentOS-$releasever-Plus

Baseurl= http://mirrors.163.com/centos/6.0/centosplus/$basearch/

Gpgcheck=1

Enabled=0

5 、 yum clean all

6. Yum install vim # to test whether it can be used.

-- configure epel feeds

Fedora EPEL download: http://mirrors.fedoraproject.org/publiclist/EPEL/

EPEL download address: http://download.fedora.redhat.com/pub/epel/

To access the Internet may not be available, at this point, log in to the following address:

Https://fedoraproject.org/wiki/EPEL

Find: "How can I use these extra packages?"

Can be found in this entry: The newest version of 'epel-release' for (version)

Download the epel package. Perform the installation again.

Please download the appropriate package for different versions.

-- configure repoforge feeds

Rpm-ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpmyum makecache

-- configure rpmfusion feeds

RPMFusion official website: http://rpmfusion.org/

Fedora 13, 14 and 15:

Su-c 'yum localinstall-nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.

Noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm'

RHEL 6/CentOS 6:

Su-c 'rpm-Uvh http://download1.rpmfusion.org/free/el/updates/testing/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/6/i386/rpmfusion-nonfree-release-6-0.1.noarch.rpm'

[set local image as Yum source]

1 、 mkdir / mnt/cdrom

2 mount / dev/cdrom / mnt/cdrom # hanging image, CD

3 mkdir / home/redhat-iso

4 cp-Rf / mnt/cdrom/* / home/redhat-iso # copy the contents of the CD to a certain path

5 vi / etc/yum.repos.d/rhel-debuginfo.repo # Editing the repo file

Add the following:

[rhel_6_iso]

Name=local iso

Baseurl= file:///home/redhat-iso/

Gpgcheck=1

The gpgkey file at gpgkey= file:///home/redhat-iso/RPM-GPG-KEY-CentOS-6 # should be changed to the file name in the iso image

[a little information about yum]

What is YUM

YUM = Yellow dog Updater, Modified

The main function is to make it easier to add / delete / update RPM packages.

It can automatically solve the problem of packet dependence.

It is easy to manage a large number of system update problems.

II. Characteristics of YUM

* multiple repositories can be configured simultaneously (Repository)

* concise configuration file (file under / etc/YUM.conf,/etc/YUM.repos.d)

* automatically resolve dependency issues encountered when adding or deleting rpm packages

* easy to use

* maintain consistency with RPM database

III. YUM installation

Centos/RHEL

1. # rpm-ivh yum-2.4.3-4.el4.centos.noarch.rpm

IV. YUM configuration

Configuration file for YUM

All configuration information for YUM is stored in a configuration file called YUM.conf, which is usually located in the / etc directory, which is the top priority of the entire YUM system, so it is necessary to describe it in detail. The following is a YUM.con file found on the Internet, let's take this as an example to illustrate.

[main]

Cachedir=/var/cache/yum

Debuglevel=2

Logfile=/var/log/yum.log

Pkgpolicy=newest

Distroverpkg=redhat-release

Tolerant=1

Exactarch=1

Retries=1

[base]

Name=Fedora Core $releasever-$basearch-Base

Baseurl= http://download.atrpms.net/mirrors/fedoracore/$releasever/$basearch/os

Http://rpmfind.net/linux/fedora/cor...er/$basearch/os

Http://mirror.clarkson.edu/pub/dist...er/$basearch/os

[updates-released]

Name=Fedora Core $releasever-$basearch-Released Updates

Baseurl= http://download.atrpms.net/mirrors/fedoracore/updates/$releasever/$basearch

Http://redhat.linux.ee/pub/fedora/l...sever/$basearch

Http://fr2.rpmfind.net/linux/fedora...sever/$basearch

[Fedora.us]

Name=Fedora.us-$basearch-Extras

Baseurl= http://fedora.linux.duke.edu/fedorax86_64/fedora.us/$releasever/$basearch/RPMS.stable

[Dag Wieers]

Name=Dag RPM Repository for Fedora Core

Baseurl= http://apt.sw.be/fedora/$releasever/en/$basearch/dag

[Livna]

Name=Livna RPM, Fedora Core $releasever-$basearch

Baseurl= http://rpm.livna.org/fedora/$releasever/$basearch/RPMS.stable

[freshrpms]

Name=FreshRPMs

Baseurl= http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms/

Http://ftp.us2.freshrpms.net/linux/...arch/freshrpms/

The first part (this is the global setting of YUM. The default generally does not need to be changed.)

[main]

The directory of the cachedir:YUM cache, where YUM stores downloaded rpm packages and databases, usually / var/cache/YUM.

Debuglevel: debug level, 0-10, default is 2.

The log file for logfile:YUM. The default is / var/log/YUM.log.

Pkgpolicy: the policy of the 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: 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.

Exactarch, there are two options 1 and 0, indicating whether to upgrade only packages that are consistent with your installation package cpu. If set to 1, then if you install an i386 rpm, YUM will not upgrade with 1686 packages.

Retries, the number of retries after a network connection error. If set to 0, it will be retried indefinitely.

Tolerent, which also has options 1 and 0, indicates 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.

In addition to the above, there are some options that can be added, such as

Exclude=, excludes some software from the upgrade list, you can use wildcards, and the items in the list should be separated by spaces, which is especially useful for friends who have installed patches such as beautification packages and Chinese.

Gpgchkeck= has two choices of 1 and 0, which represent whether or not to perform a gpg check. if not, it seems to be checked by default.

The second part:

Configure the repository server, this is the most exciting, with a good repository, like a big store at home, want something to run errands a little bit, by the way, this is a free mall.

All server settings should follow the following format:

1. [serverid]

2. Name=Some name for this server

3. Baseurl=url://path/to/repository/

Where serverid is used to distinguish between different repository, must have a unique name.

Name, which is a description of repository, supports variables like $releasever $basearch

Baseurl is the most important part of the server setup, and the software can only be obtained from it if it is set correctly. Its format is:

1. Baseurl=url://server1/path/to/repository/

2. Url://server2/path/to/repository/

3. Url://server3/path/to/repository/

Among them, there are three protocols supported by url: http:// ftp:// file://. After baseurl, you can follow multiple url, and you can change it to a faster mirror station, but baseurl can only have one, that is, it cannot be in the following format:

1. Baseurl=url://server1/path/to/repository/

2. Baseurl=url://server2/path/to/repository/

3. Baseurl=url://server3/path/to/repository/

The directory that url points to must be one level above the repository header directory, and it also supports variables such as $releasever $basearch.

After url, you can add several options, such as gpgcheck, exclude, failovermethod, etc., such as:

1. [updates-released]

2. Name=Fedora Core $releasever-$basearch-Released Updates

3. Baseurl= http://download.atrpms.net/mirrors/fedoracore/updates/$releasever/$basearch

4. Http://redhat.linux.ee/pub/fedora/linux/core/updates/$releasever/$basearch

5. Http://fr2.rpmfind.net/linux/fedora/core/updates/$releasever/$basearch

6. Gpgcheck=1

7. Exclude=gaim

8. Failovermethod=priority

The meaning of gpgcheck,exclude is the same as that of [main], but it only works on this server. Failovermethode has two options: roundrobin and priority, which means that when there are multiple url to choose, the order of YUM selection, roundrobin is randomly selected, if the connection fails, use the next one, cycle in turn, and priority starts from the first according to the order of url. If not specified, the default is roundrobin.

Several variables

Releasever, the version of the distribution, is obtained from the distroverpkg in the [main] section. If not, the judgment is based on the redhat-release package.

$arch,cpu system, such as i686 Magi athlon, etc.

The basic system group of $basearch,cpu, such as i686 and athlon belong to i386 and alphaev6 belong to alpha.

After setting up YUM.conf, we can enjoy the convenience of YUM.

5. YUM source of RHEL/CENTOS

1. Modify the configuration file

2. Import GPG KEY

Import the GPG key of each reposity, as mentioned earlier, YUM can use gpg to verify the package to ensure the integrity of the download package, so we have to go to each repository site to find gpg key, usually put in a prominent position on the home page, some plain text files such as RPM-GPG-KEY.txt, download them, and then use the rpm-- import xxx.txt command to import them, preferably the distribution with its own GPG-KEY. Rpm-import / usr/share/doc/redhat-release-*/RPM-GPG-KEY official software upgrade.

Expand your rpm package

1 、 rpmforge

Centos/RHEL 's default yum software repository is very limited, limited to regular packages and some software package updates in the distribution. With RpmForge, you can add a lot of third-party rpm packages.

Get

Http://dag.wieers.com/rpm/packages/rpmforge-release/

Just find the rpmforge package that matches the architecture of the system platform and install it. After installation. By default, two new files, mirrors-rpmforge and rpmforge.repo, will be added under / etc/yum.repos.d/ of the system.

Installation

1. # rpm-ivh rpmforge-release-0.3.6-1.el4.rf.i386.rpm

2. # rpm-- import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

2. Accelerate YUM updates

Install the fast mirror plug-in of YUM, can accelerate the speed of CentOS/RHEL YUM and improve the stability, the effect is remarkable.

Centos5

1. # yum- y install yum-fastestmirror

Centos4

1. Yum- y install yum-plugin-fastestmirror

VII. Use of YUM

Note: when you update the YUM or YUM repository for the first time, YUM will automatically download all the required headers and place them in the / var/cache/YUM directory, which may take a long time.

System updates (update all upgradeable rpm packages, including kernel)

1. # YUM-y update

Perform system updates regularly every day

1. # chkconfig YUM on

2. # service YUM start

* updates to the rpm package

Check for updatable rpm packages

1. # YUM check-update

Update all rpm packages

1. # YUM update

Update specified rpm packages, such as kernel and kernel source

1. # YUM update kernel kernel-source

Large-scale version upgrades, unlike YUM update, even old obsolete packages are upgraded.

1. # YUM upgrade

* installation and removal of rpm packages

Install rpm packages, such as xmms-mp3

1. # YUM install xmms-mp3

Delete the rpm package, including packages that are dependent on the package

1. # YUM remove licq

Note: you will also be prompted to delete licq-gnome,licq-qt,licq-text.

* parameters related to YUM temporary storage (/ var/cache/YUM/)

Clear rpm package files in temporary storage

1. # YUM clean packages

Clear the rpm header file in temporary storage

1. # YUM clean headers

Clear old rpm header files in temporary storage

1. # YUM clean oldheaders

Clear old rpm header files and package files in temporary storage

1. # YUM clean or # YUM clean all

Note: equivalent to YUM clean packages + YUM clean oldheaders

* list of rpm packages

List all rpm packages in the repository that can be installed or updated

1. # YUM list

List the specific rpm packages in the repository that can be installed or updated, as well as which packages have been installed

1. # YUM list mozilla

2. # YUM list mozilla*

Note: you can use matches in rpm package names, such as listing all rpm packages that begin with mozilla

List all updatable rpm packages in the repository

1. # YUM list updates

List all installed rpm packages

1. # YUM list installed

List rpm packages that have been installed but are not included in the repository

1. # YUM list extras

Note: download and install the rpm package through other websites

* display of rpm package information (info parameter is the same as list)

Lists information about all rpm packages in the repository that can be installed or updated

1. # YUM info

Lists specific information in the repository that can be installed or updated, as well as the rpm packages that have been installed

1. # YUM info mozilla

2. # YUM info mozilla*

Note: you can use matches in rpm package names, such as listing information for all rpm packages that begin with mozilla

Lists information about all updatable rpm packages in the repository

1. # YUM info updates

List the information of all installed rpm packages

1. # YUM info installed

Lists information about rpm packages that have been installed but are not included in the repository

1. # YUM info extras

Note: download information about installed rpm packages from other websites

* search for rpm packages

Search for rpm packets that match specific characters

1. # YUM search mozilla

Note: search in rpm package name, package description, etc.

Search for rpm packages that contain specific file names

1. # YUM provides realplay

VIII. Solution to common problems in YUM

1. If the network speed is slow, you can increase the timeout of YUM, so that you will not always exit because of timeout.

1. # vi / etc/YUM.conf

2. # add this sentence

3. Timeout=120

2. Solutions to YUM Existing lock errors

If the system starts up, YUM appears Existing lock / var/run/YUM.pid: another copy is running as pid 3380. Aborting. It can be solved in the following ways:

Method one

1. Etc/init.d/YUM-updatesd stop

Method two

1. # rm-f / var/run/YUM.pid

The main reason is that YUM is updating automatically, just turn it off.

Thank you for reading, the above is the content of "how to configure yum source for redhat6". After the study of this article, I believe you have a deeper understanding of how to configure yum source for redhat6, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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