CentOS uses yum to update the software package and system, centosyum

Source: Internet
Author: User
Tags ftp protocol

CentOS uses yum to update the software package and system, centosyum

1. CentOS update source configuration file description
CentOS 6.5 update source profile/etc/yum. repos. d/CentOS-Base.repo Fragment
[Base]
Name = CentOS-$ releasever-Base
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
# Baseurl = http://developer.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
Using list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
# Baseurl = http://developer.centos.org/centos/?releasever/updates/?basearch/
Gpgcheck = 1
Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Explanation
In the. repo file, the configuration syntax is segmented. Each segment is configured with a software repository. The configuration syntax is as follows:
[Repositoryid]
Name = Some name for this repository
Baseurl = url: // server1/path/to/repository/
Url: // server2/path/to/repository/
Url: // server3/path/to/repository/
Upload list = url: // path/to/upload list/repository/
Enabled = 0/1
Gpgcheck= 0/1
Gpgkey = a url pointing to the ASCII-armored GPG key file for the repository

Where:
Repositoryid: used to specify a repository, for example, [base]
Name: Specifies the name of a readable repository.
Baseurl: used to specify the URL of the Repository. It can be of the following three types:
Http: Specifies the source of the remote HTTP protocol.
Ftp-used to specify the source of the remote FTP protocol
File-used to mount a local image or NFS file System
Repository list: Specifies the image site of the repository.
Enabled: used to specify whether to use the repository. The default value is 1.
Gpgcheck: used to specify whether to check the GPG signature of the software package
Gpgkey: used to specify the URL of the GPG signature file

The following variables are often used in name baseurl:
$ Releasever-Current System Version Number
$ Basearch-Current System Platform Architecture
If the repository list is specified, the system selects the repository closest to you from the CentOS image site. Not all domestic images are in the CentOS image site list, so we can directly use baseurl to specify the repository closest to you. Baseurl can specify multiple URLs. The system will check the repositories you listed in sequence so that another server can be used when a server goes down. To speed up the update, you can specify only one URL in the baseurl when the Update Server and line are good.

2. Use the update source of the domestic Image
After CentOS is installed, you must first modify the update source and upgrade it to the latest system.
Frequently Used update sources in China with fast speed:
Http://centos.ustc.edu.cn/centos/ University of Science and Technology, Education Network recommendation
Http://mirrors.163.com/centos/ Netease

Back up the configuration file
Cd/etc/yum. repos. d/
Cp CentOS-Base.repo CentOS-Base.repo.bak

Modify the update source as follows:
[Base]
Name = CentOS-$ releasever-Base
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = OS
# Baseurl = http://developer.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
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = updates
# Baseurl = http://developer.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 but not released
[Addons]
Name = CentOS-$ releasever-Addons
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = addons
# Baseurl = http://developer.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 may be useful
[Extras]
Name = CentOS-$ releasever-Extras
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = extras
# Baseurl = http://developer.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
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = centosplus
# Baseurl = http://developer.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
# Items list = http://mirrorlist.centos.org /? Release = $ releasever & arch = $ basearch & repo = contrib
# Baseurl = http://developer.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

You only need to select the configuration items [base] [updates] [addons] [extras] [centosplus] based on the source information. For each item, you only need to modify the baseurl and gpgkey as the corresponding source address. After the configuration is complete, clear the yum cache and recreate 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
The speed of some mirror in yum is very slow. If yum chooses this mirror, yum will be very slow at this time. For this reason, you can download the fastestmirror plug-in, it automatically selects the fastest mirror:
# Yum install yum-fastestmirror
Configuration File: (do not change)/etc/yum/pluginconf. d/fastestmirror. conf
Yum image speed test record file:/var/cache/yum/timedhosts.txt

4. Use the yum
If the yum of the command line is inconvenient, you can use the graphical yumex, which looks more convenient, because you can freely choose the software Repository:
# Yum install yumex

Then you can see yum extender in the system tool. In fact, the system's built-in "Add/delete programs" can also achieve graphical software installation, but some yumex features it does not.

5. yum command Introduction
Yum check-update checks all software packages that can be updated
Yum update: Download and update all software packages installed in the system.
Yum upgrade has a large-scale version upgrade. Different from yum update, the old version is also upgraded.
Yum install <packages> install new software package
Yum update <packages> updates the specified software package.
Yum remove <packages> uninstall the specified Software Package
Yum groupinstall <groupnames> install software packages in the specified Software Group
Yum groupupdate <groupnames> updates software packages in a specified Software Group
Yum groupremove <groupnames> uninstall the software package in the specified Software Group
Yum grouplist view installed and available software GROUPS IN THE SYSTEM
Yum list lists all the rpm packages that can be installed, updated, and installed in the resource library.
Yum list <regex> lists the rpm packages that can be installed, updated, and installed that match the regular expression in the resource library.
Yum list available lists all the rpm packages that can be installed in the resource library
Yum list available <regex> lists all the rpm packages that can be installed in the resource library that match the regular expression.
Yum list updates lists all the rpm packages that can be updated in the resource library
Yum list updates <regex> lists all updatable rpm packages that match the regular expression in the resource library.
Yum list installed list all installed rpm packages in the resource library
Yum list installed <regex> lists all installed rpm packages that match the regular expression in the resource library.
Yum list extras lists the rpm packages installed but not included in the resource library
Yum list extras <regex> lists the installed rpm packages that match the regular expression but are not included in the resource library
Yum list recent list software packages recently added to the resource library
Yum search <regex> checks the names, descriptions, overview, and listed maintainers of all available software and finds values that match regular expressions.
Yum provides <regex> checks the files contained in the software package and the functions provided by the software to find the values that match the regular expression.
Yum clean headers clear cache rpm header files
Yum clean packages clear cached rpm package files
Yum clean all clear cache rpm header files and package files
Yum deplist <packages> displays the dependency information of the software package.
Yum info list package information
When you use the yum or yum resource library for updates 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.
The yum command can use the-y parameter to answer the question raised during the command running with yes.

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.