Redhat 6 Two ways to configure Yum sources

Source: Internet
Author: User
Tags gpg

Since Redhat's Yum online update is chargeable and cannot be used if not registered, if you want to use it, you need to uninstall Redhat 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 Redhat's original Yum
Rpm-aq|grep Yum|xargs rpm-e--nodeps

2. Download the Yum installation file

Note that if you cannot find the file when you download it, log on to: http://mirrors.163.com/centos/6/os/x86_64/to find the appropriate file. And then download it again.

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. Install Yum

RPM-IVH python-iniparse-0.3.1-2.1.el6.noarch.rpm

RPM-UVH--nopreun python-urlgrabber-3.9.1-11.el6.noarch.rpm

RPM-IVH yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

[Email protected] ~]# Rpm-qa|grep Yum


Yum-metadata-parser-1.1.2-16.el6.x86_64
Yum-3.2.29-73.el6.centos.noarch
Yum-plugin-fastestmirror-1.1.30-37.el6.noarch


Note that the last two packages must be installed at the same time, otherwise they will depend on each other
----------Configuration NetEase Source
4. Update the Repo file

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 contents are:

[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 and 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 could 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 #测试一下可不可以用

--Configure Epel source

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

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

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

Https://fedoraproject.org/wiki/EPEL

Find: "Howcan I use these extra packages?"

Within this entry you can find: The newest version of ' Epel-release ' for (version)

Download the Epel package. Perform the installation again.

Please download the appropriate packages for different versions.

--Configure Repoforge source

RPM-IVH http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
Yum Makecache

--Configure Rpmfusion source

Rpmfusion Official website: http://rpmfusion.org/

Fedora, 15 and:

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 #挂着镜像, CD

3 Mkdir/home/redhat-iso

4 cp-rf/mnt/cdrom/*/home/redhat-iso #将光盘内的内容copy到某个路径下

5 Vi/etc/yum.repos.d/rhel-debuginfo.repo #编辑repo文件

Add a little bit of content:

[Rhel_6_iso]
Name=local ISO
baseurl=file:///home/redhat-iso/
Gpgcheck=1
Gpgkey=file:///home/redhat-iso/rpm-gpg-key-centos-6 #该处的gpgkey文件应该改成iso镜像中的文件名

"A bit of information on Yum"

First,what is Yum
YUM = Yellow Dog Updater, Modified
The main function is more convenient to add/remove/update RPM packages.
It can automatically solve the dependency problem of the package.
It makes it easy to manage a large number of system update issues


Ii. Features of Yum
* Multiple repositories can be configured at the same time (Repository)
* Concise configuration file (file under/ETC/YUM.CONF,/ETC/YUM.REPOS.D)
* Automatic resolution of dependency issues encountered when adding or removing RPM packages
* Easy to use
* Maintain consistency with RPM database

Third, YUM installation
centos/RHEL
1. #rpm-IVH yum-2.4.3-4.el4.centos.noarch.rpm

Four, yum configuration
Yum configuration file
All of the configuration information for Yum is stored in a configuration file called yum.conf, usually located in the/etc directory, which is the priority of the entire Yum system, so it is necessary to describe it in detail. Here is a Yum.con file from the Internet, let us 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 for Yum.) The default is usually not changed. )

[Main]

Cachedir:yum Cache directory, YUM stores downloaded RPM packages and databases, typically/var/cache/yum.
DebugLevel: Debug level, 0-10, default is 2.
Logfile:yum'sLog file, which is/var/log/yum.log by default.
Pkgpolicy: The policy for the package. A total of two options, newest and last, this function is if you set up multiple repository, and the sameThe software exists at the same time in different repository, which should be installed by Yum, and Yum will install the latest version if it is newest. If it is last, Yum will sort the server ID alphabetically and select theSoftware Installation. Newest is generally chosen.
DISTROVERPKG: Specify a package, Yum will determine your distribution based on this package, default is Redhat-release, it can also be installed in any of the RPM package for its own release version.
Exactarch, there are two options 1 and 0, which represents whether to upgrade only the packages that are consistent with your installation of the package CPU, and if set to 1, if you install a i386 rpm, Yum will not upgrade with a 1686 package.
Retries,The number of retries after a network connection error has occurred, and if set to 0, it will be retried indefinitely.
Tolerent, there are also 1 and 2 options that indicate whether Yum tolerates a package-related error on the command line, such as installing a three-by-five package, where 3 has already been installed, and 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 you can add, such as

Exclude=, excluding some software in the upgrade list, you can use wildcards, the list of items to be separated by a space, which is installed such as beautify the package, Chinese patches of friends especially useful.
The gpgchkeck= has 1 and 2 choices, which represent whether or not GPG verification is performed, and if not, the default seems to be checked.

Part II:

Configure the repository server, this is the most exciting, with a good repository, such as the door opened a large shopping malls, to what a little run errands on the line, this is a free hypermarket.
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 differentiate between different repository, there must be a unique name.
Name, which is a description of repository, supports variables such as the $releasever $basearch;
BaseURL is the most important part of the server Setup and is only set correctly to get the software from above. Its format is:

1. baseurl=url://server1/path/to/repository/
2. url://server2/path/to/repository/
3. url://server3/path/to/repository/

Where the URL supports the protocol has http:/ftp://file://three kinds. After BaseURL can be followed by multiple URLs, you can change to a faster mirror station, but BaseURL can only have one, that is, not like 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 where the URL points to must be the upper level of the Repository header directory, and it also supports variables such as $releasever $basearch.
You can add multiple options after the URL, such as Gpgcheck, Exclude, Failovermethod, and so on, 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

Where the meaning of gpgcheck,exclude is the same as the [main] section, but only for this server, Failovermethode has two options roundrobin and priority, which means that when there are multiple URLs to choose from, Yum chooses the order, The Roundrobin is randomly selected, and if the connection fails, the next is used, looping sequentially, and priority starts with the first order of the URL. If not specified, the default is Roundrobin.

Several variables

$releasever, the release version, obtained from the [main] section of the distroverpkg, if not, according to the Redhat-release package to determine.
$arch, CPU system, such as I686,athlon, etc.
$basearch, the basic system groups of CPUs, such as i686 and Athlon, belong to the same genus I386,alpha and Alphaev6 Alpha.

With the yum.conf set up, we can enjoy the convenience of Yum.

V. Rhel/centos's Yum Source

1. Modify the configuration file

2. Import GPG KEY

Import each reposity GPG key, previously said, 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, will generally be placed on the homepage of the eye-catching position, some names such as Rpm-gpg-key.txt such as plain text files, download them, and then use the RPM--import xxx.txt command to import them, it is best to bring the release of Gpg-key also imported. RPM--import/usr/share/doc/redhat-release-*/rpm-gpg-key official software upgrades are available.

VI. Expand your RPM Package

1, Rpmforge

Centos/rhel The default Yum repositories are very limited and are limited to regular packages and updates to some packages in the release version, and with Rpmforge, you can add very many third-party RPM packages.

Get

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

Locate the Rpmforge package installed that matches the system platform architecture. After installation. The default is to add two files to the system's/etc/yum.repos.d/, Mirrors-rpmforge and Rpmforge.repo

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. Speed up Yum update

Install Yum's fast mirror plug-in to speed up Centos/rhel yum and improve stability with significant results.

Centos5

1. #yum-y Install Yum-fastestmirror

Centos4

1. Yum-y Install Yum-plugin-fastestmirror
Vii. Use of Yum

Note: When using the Yum or Yum repositories for the first time, Yum will automatically download all required headers placed in the/var/cache/yum directory, which may take a long time.

System Update (update all RPM packages that can be upgraded, including kernel)

1. #YUM-y update

Perform periodic system updates daily

1. #chkconfig YUM on
2. #service YUM Start

Update for *RPM Package

Check for updatable RPM packages

1. #YUM check-update

Update all RPM Packages

1. #YUM Update

Update specified RPM packages, such as update kernel and kernel source

1. #YUM Update kernel Kernel-source

A large-scale version upgrade, unlike Yum Update, even the old obsolete package is upgraded

1. #YUM Upgrade

Installation and removal of *rpm packages

Install RPM packages, such as Xmms-mp3

1. #YUM Install Xmms-mp3

Remove RPM packages, 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 of *yum staging (/var/cache/yum/)

Clear the Staging RPM package file

1. #YUM Clean Packages

Purge the RPM header files in the staging

1. #YUM Clean Headers

Clear the old RPM header files in the staging

1. #YUM Clean oldheaders

Purge old RPM header files and package files in staging

1. #YUM clean or #yum clean all

Note: equivalent to yum clean packages + Yum clean oldheaders

*RPM Package List

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

1. #YUM List

Lists the specific RPM packages that can be installed or updated and installed in the repository

1. #YUM list Mozilla
2. #YUM List mozilla*

Note: You can use a match in the RPM package name, such as listing all RPM packages that start with Mozilla

List all RPM packages that can be updated in the repository

1. #YUM list Updates

List all RPM packages that have been installed

1. #YUM List installed

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

1. #YUM List Extras

Note: Download the installed RPM package from other websites

*RPM Package Information Display (info parameter with list)

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

1. #YUM Info

Lists the specific information in the repository that can be installed or updated and the RPM packages that have been installed

1. #YUM info Mozilla
2. #YUM Info mozilla*

Note: You can use a match in the RPM package name, such as listing all the RPM packages that start with Mozilla

List information about all RPM packages that can be updated in the repository

1. #YUM Info Updates

List all the RPM packages that have been installed

1. #YUM Info installed

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

1. #YUM Info Extras

Note: Download the installed RPM package information from other websites

* Search RPM Package

Search for RPM packages that match specific characters

1. #YUM Search Mozilla

Note: Search in RPM Package name, package description, etc.

Search for RPM packages with a specific file name

1. #YUM provides Realplay

Eight, yum common problem solving

1. If the network speed is slow, you can increase the Yum time-out, so that it does not always exit because of timeouts.

1. #vi/etc/yum.conf
2. #加上这么一句
3. timeout=120

2. YUM Existing Lock Error Resolution

If the system starts, YUM appears existing Lock/var/run/yum.pid:another copy is running as PID 3380. Aborting. You can use the following method to solve:

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 automatically updated, as long as you turn it off.

Redhat 6 Two ways to configure Yum sources

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.