RedHat 6.0 (64-bit) How to use the CentOS Yum Source Update method

Source: Internet
Author: User
Tags gpg mkdir

Due to Redhat Yum online update is charged, if not registered words can not be used, if you want to use, you need to redhat yum Uninstall, restart the installation, and then configure other sources, the following is a detailed process:  
1. Delete Redhat original Yum &NBSP
Rpm-aq|grep Yum|xargs rpm-e--nodeps 
2. Download yum installation file  
wget http://mirrors.163.com/centos/6/ OS/X86_64/PACKAGES/YUM-3.2.27-14.EL6.CENTOS.NOARCH.RPM&NBSP
Wget http://mirrors.163.com/centos/6/os/x86_64/ PACKAGES/YUM-METADATA-PARSER-1.1.2-14.1.EL6.X86_64.RPM&NBSP
Wget http://mirrors.163.com/centos/6/os/x86_64/ PACKAGES/YUM-PLUGIN-FASTESTMIRROR-1.1.26-11.EL6.NOARCH.RPM&NBSP
Wget http://mirrors.163.com/centos/6/os/x86 _64/PACKAGES/PYTHON-INIPARSE-0.3.1-2.1.EL6.NOARCH.RPM&NBSP
3. To install yum 
Rpm-ivh PYTHON-INIPARSE-0.3.1-2.1.EL6.NOARCH.RPM&NBSP
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 &NBSP
4. Update 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

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


"Set local mirror as yum source"

1, Mkdir/mnt/cdrom

2 Mount/dev/cdrom/mnt/cdrom #挂着镜像, CD-ROM

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 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 little information about Yum."

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


Ii. Characteristics of Yum
* Multiple resource pools can be configured at the same time (Repository)
* Concise configuration file (files under/ETC/YUM.CONF,/ETC/YUM.REPOS.D)
* Automatically resolve the dependency problems encountered when adding or removing RPM packages
* Easy to use
* Maintain consistency with the 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
Yum All configuration information is stored in a configuration file called yum.conf, usually located in the/etc directory, which is the most important of the entire Yum system, so it is necessary to explain in detail. Here is a Yum.con file from 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 for Yum.) The default generally does not have to change. )
[Main]
Cachedir:yum Cache directory, YUM this store to download the RPM package and database, generally/var/cache/yum.
DebugLevel: Debug level, 0-10, default is 2.
Logfile:yum log file, default is/var/log/yum.log.
Pkgpolicy: Package policy. A total of two options, newest and last, is that if you set up multiple repository, and the same software exists in different repository, Yum should install which, and if it is newest, yum installs the latest version. If this is last, then Yum sorts the server IDs alphabetically and selects the software installation on the final server. Newest is usually chosen.
DISTROVERPKG: Specify a package, Yum will judge your release based on this package, default is Redhat-release, or any RPM package that is installed for your own release version.
Exactarch, there are two options 1 and 0, whether to upgrade only and you install the package CPU system consistent package, if set to 1, if you install a i386 rpm, then Yum will not use 1686 of the package to upgrade.
Retries, the number of retries after a network connection error occurs, and if set to 0, it will be retried indefinitely.
Tolerent, there are also 1 and 2 options that indicate whether Yum tolerate a package-related error with the command line, such as installing 1,2,3 three packages, 3 of which have already been installed, and if you set 1, Yum will not receive an error message. The default is 0.
In addition to the above, there are some options that can be added, such as
Exclude=, excluding some software from the upgrade list, you can use wildcard characters, the list of items to be separated by spaces, this for the installation of such as landscaping package, Chinese patches of friends particularly useful.
Gpgchkeck= has 1 and 2 choices, representing whether or not a GPG check is performed, and if not, the default seems to be checked.
Part II:
Configure Repository server, this is the most exciting, with a good repository, such as the door opened a big store, what things to run a little errands on the line, the right this is a free shopping 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 differentiate between different repository, there must be a unique name.
Name, which is a description of the repository, supports variables such as the $releasever $basearch;
BaseURL is the most important part of the server Setup, and only the correct settings can 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/
One of the protocols supported by the URL is http://ftp://file://three species. BaseURL can be followed by multiple URLs, you can change yourself 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 to which the URL points must be the upper level of this repository header directory, and it also supports variables such as $releasever $basearch.
URLs can be followed by 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
Where the meaning of gpgcheck,exclude is the same as in the [main] section, but only for this server, Failovermethode has two options roundrobin and priority, meaning that there are multiple URLs to choose from, yum the order of selection, Roundrobin is a random selection, if the connection fails, the next one is used, followed by loops, and priority begins with the first order of the URL. If not indicated, the default is Roundrobin.
Several variables
$releasever, the release version is obtained from DISTROVERPKG in the [main] section, if not, based on the Redhat-release package.
$arch, CPU system, such as I686,athlon, etc.
$basearch, the basic system groups of CPUs, such as i686 and Athlon, belong to I386,alpha and alphaev6 with Alpha.
The yum.conf setting is complete, we can experience the convenience of Yum.
V. Yum Source of Rhel/centos
1, modify the configuration file
2, Import GPG KEY
Import each reposity gpg key, said earlier, Yum can use the GPG to check the package, to ensure the integrity of the download package, so we have to go to each repository site to find GPG key, generally will be placed in the home page 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 distribution from Gpg-key also imported. RPM--import/usr/share/doc/redhat-release-*/rpm-gpg-key official software upgrades for use.
Six, expand your RPM package
1, Rpmforge
Centos/rhel the default Yum software warehouse is very limited, only limited to the release version of the regular packages and some software package updates, using Rpmforge, can add a lot of third-party rpm software packages.
Get
http://dag.wieers.com/rpm/packages/rpmforge-release/
Find the Rpmforge package installation that matches the system platform architecture. After installation. The default will 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, accelerate the Yum update speed
Install Yum Fast Mirror plug-in, can speed up Centos/rhel yum speed and improve 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 an update is used for the first time using the Yum or Yum Repository, Yum automatically downloads 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 on a daily basis
1. #chkconfig YUM on
2. #service YUM Start
Update of *RPM Package
Check for updatable RPM packages
1. #YUM check-update
Update all RPM Packages
1. #YUM Update
Update the specified RPM package, such as update 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 deletion of *rpm packages
Install RPM packages, such as Xmms-mp3
1. #YUM Install Xmms-mp3
Delete the RPM package, including the package that is dependent on the package
1. #YUM Remove Licq
Note: You will also be prompted to delete Licq-gnome,licq-qt,licq-text
*yum (/var/cache/yum/) Related parameters
Clear staging of the RPM package file
1. #YUM Clean Packages
Clear staging of the RPM header file
1. #YUM Clean Headers
Clear the old RPM header files in the staging
1. #YUM Clean oldheaders
Clears the old RPM header files and package files in the 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
List specific available RPM packages in the repository that can be installed or updated and installed
1. #YUM list Mozilla
2. #YUM List mozilla*
Note: You can use matching characters in the RPM package name, such as listing all RPM packages that start with Mozilla
List all the RPM packages in the repository that can be updated
1. #YUM list Updates
List all the RPM packages that have been installed
1. #YUM List installed
List the RPM packages that have been installed but not included in the repository
1. #YUM List Extras
Note: Download the installed RPM package through other websites
*RPM Packet Information display (info parameter same list)
Lists 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 installed RPM packages
1. #YUM info Mozilla
2. #YUM Info mozilla*
Note: You can use matching characters in the RPM package name, such as listing all the RPM packages that start with Mozilla
List all the RPM packages in the repository that can be updated
1. #YUM Info Updates
List all the RPM packages that have been installed
1. #YUM Info installed
List information about the RPM packages that have been installed but 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 an RPM package that contains a specific filename
1. #YUM provides Realplay
Eight, yum common problem solving
1, if the speed is slow, you can increase the Yum timeout, so you will not always quit because of time out.
1. #vi/etc/yum.conf
2. #加上这么一句
3. timeout=120
2, YUM Existing lock Error Solution
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 solution:
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, just turn it off.

Related Article

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.