CentOS updates packages and systems using Yum

Source: Internet
Author: User
Tags gpg ftp protocol

Original address: http://m.oschina.net/blog/206760

1. CentOS Update Source configuration file description
CentOS 6.5 Update Source configuration file/etc/yum.repos.d/centos-base.repo fragment
[Base]
name=centos-$releasever-base
mirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=os
#baseurl =http://mirror.centos.org/centos/$releasever/os/$basearch/
Gpgcheck=1
Gpgkey=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=updates
#baseurl =http://mirror.centos.org/centos/$releasever/updates/$basearch/
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

Explain
In the. repo file, the configuration syntax is segmented and each section is configured with a software repository with the following configuration syntax:
[Repositoryid]
Name=some name for this repository
baseurl=url://server1/path/to/repository/
url://server2/path/to/repository/
url://server3/path/to/repository/
mirrorlist=url://path/to/mirrorlist/repository/
Enabled=0/1
Gpgcheck=0/1
Gpgkey=a URL pointing to the ascii-armoured GPG key file for the repository

which
Repositoryid: Used to specify a warehouse, for example [base]
Name: Used to specify the easy-to-read warehouse name
BaseURL: The URL used to specify the repository, which can be three types:
http-used to specify the source of the remote HTTP protocol
ftp-used to specify the source of the remote FTP protocol
file-for local mirroring or NFS mount file systems
Mirrorlist: Mirror site for the specified warehouse
Enabled: Used to specify whether to use this warehouse, the default value is 1, which is available
Gpgcheck: Used to specify whether to check the GPG signature of the software package
Gpgkey: URL to specify GPG signature file

The following variables are often used in name BaseURL:
$releasever-The version number of the current system
$basearch-platform architecture for the current system
If you specify mirrorlist, the system will select the repository closest to you from the CentOS mirror site. Not all of the domestic mirrors are in the CentOS mirror site list, so we can directly use BaseURL directly to specify the nearest warehouse to you. BaseURL can specify multiple URLs, which in turn check the warehouses you list so that you can use a different server when one server goes down. To speed up the update, specify only one URL in BaseURL when you are sure that the server is updated and the line is good.

2, use the update source of the domestic mirror
Once the CentOS installation is complete, you should first modify the update source and upgrade to the latest system.
Frequently used update sources at home:
http://centos.ustc.edu.cn/centos/Zhong Ke, Education network recommendation
http://mirrors.163.com/centos/NetEase

Backup the configuration file first
cd/etc/yum.repos.d/
CP Centos-base.repo Centos-base.repo.bak

Modify the update source as follows:
[Base]
name=centos-$releasever-base
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=os
#baseurl =http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
Gpgcheck=1
Gpgkey=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=updates
#baseurl =http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

#packages used/produced in the build and not released
[Addons]
name=centos-$releasever-addons
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=addons
#baseurl =http://mirror.centos.org/centos/$releasever/addons/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/
Gpgcheck=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

#additional packages that could be useful
[Extras]
name=centos-$releasever-extras
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=extras
#baseurl =http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
Gpgcheck=1
Gpgkey=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=centosplus
#baseurl =http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
Gpgcheck=1
Enabled=0
Gpgkey=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=contrib
#baseurl =http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/
Gpgcheck=1
Enabled=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6

Configuration is only required according to the individual source situation, there is a choice of configuration [base] [updates] [addons] [extras] [centosplus] these items. Each item can be modified as long as the BaseURL and Gpgkey are the corresponding source addresses. After the configuration is complete, to empty the Yum cache and rebuild the Yum cache, the command is as follows:
Yum Clean all && yum clean metadata && yum clean dbcache && yum makecache && Yum Update

3, automatically select the fastest source
Because Yum has mirror speed is very slow, if Yum chooses this mirror, this time Yum will be very slow, in this case, you can download the Fastestmirror plugin, it will automatically select the fastest mirror:
#yum Install Yum-fastestmirror
Configuration file: (generally not moving)/etc/yum/pluginconf.d/fastestmirror.conf
Yum image Speed Test log file:/var/cache/yum/timedhosts.txt

4. Yum with graphical interface
If you feel that the command line Yum is inconvenient, then you can use the graphical Yumex, which looks more convenient because you are free to select repositories:
#yum Install Yumex

The Yum Extender can then be seen in the system tools. In fact, the system comes with the "Add/Remove Programs" can also achieve graphical software installation, but some Yumex features it does not.

5. Introduction to Yum Commands
Yum check-update Check all packages that can be updated
Yum Update downloads all packages installed by the update system
Yum upgrade a large-scale version upgrade, unlike Yum Update, even the old obsolete package is upgraded
Yum Install <packages> new packages
Yum Update <packages> update the specified package
Yum Remove <packages> Uninstall the specified package
Yum Groupinstall <groupnames> Installing packages in a specified software group
Yum groupupdate <groupnames> update packages in a specified software group
Yum Groupremove <groupnames> Uninstalling packages in a specified software group
Yum grouplist view installed and available software groups on your system
Yum list lists all the RPM packages that can be installed or updated and installed in the repository
Yum List <regex> lists the can install or update and installed RPM packages that match regular expressions in the repository
Yum list available Lists all the RPM packages that can be installed in the repository
Yum list available <regex> lists all the RPM packages that can be installed in the repository that match the regular expression
Yum list updates lists all the RPM packages that can be updated in the repository
Yum list Updates <regex> lists all the updatable RPM packages in the repository that match regular expressions
Yum List installed lists all installed RPM packages in the repository
Yum List installed <regex> lists all installed RPM packages in the repository that match regular expressions
Yum List Extras lists the RPM packages that have been installed but are not included in the repository
Yum List Extras <regex> lists installed RPM packages that match the regular expression but are not included in the repository
Yum List recent lists the packages that were recently added to the repository
Yum Search <regex> detect all available software names, descriptions, overviews, and listed maintainers to find values that match regular expressions
Yum provides <regex> detects the files included in the package and the functionality provided by the software to find values that match regular expressions
Yum clean headers clears the RPM header files in the cache
Yum Clean packages clears the cache for RPM package files
Yum Clean all clears the cache of RPM header files and package files
Yum Deplist <packages> display dependency information for packages
Yum Info lists package information
When the first use of the Yum or Yum repositories is updated, yum will automatically download all required headers placed in the/var/cache/yum directory, which may take a long time.
The Yum command can use the-y parameter to answer questions that are raised when the command is run with Yes.

CentOS updates packages and systems using Yum

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.