Use yum to automatically update linux servers

Source: Internet
Author: User
Use yum to automatically update linux Server-Linux Enterprise Application-Linux server application information. The following is a detailed description. YUM (Yellow dog Updater, Modified) is used to automatically connect to the yum source, check and update software packages, security patches, and check and update the Linux system core (if needed ).

1. Download yum Software

Note the yum software version and yum source applicability.
Yum download page http://linux.duke.edu/projects/yum/download.ptml
Yum2.0.X is applicable to CentOS3.X, RHEL AS3, etc.
Yum2.4.X is applicable to CentOS4.X, RHEL AS3, FC3, FC4, etc.

Red Hat does not provide the yum source, but fortunately CentOS is based on the rhel rebuild version, its directory structure, file name, and all software packages are fully compatible with rhel. Therefore, in Red Hat Enterprise Linux, we can use centos yum sources for system and software updates. Note the corresponding version:

RedHat AS3 can use the yum source of CentOS3.X (I used the yum source of CentOS3.6 in this article and passed the test)
RedHat AS4 can use the yum source of CentOS4

2. install and configure yum
For example, install and configure yum2.0.8 on RedHat AS3, and update the AS3 system and software using the yum source of CentOS3.6.

Rpm-ivh yum2.0.8-noarch. rpm
Rpm -- import http://mirror.be10.com/centos/3.6/ OS /i386/RPM-GPG-KEY-CentOS-3

Note: http://mirror.be10.com/centos is an image from CentOS yum source in Fujian, China, where we import the GPG key file. The GPG key is used to verify whether the upgrade package has been securely certified.

Modify the/etc/yum. conf file

[Main]
Cachedir =/var/cache/yum
Debuglevel = 2
Logfile =/var/log/yum. log
Pkgpolicy = newest
Distroverpkg = redhat-release
Tolerant = 1
Exactarch = 1


[Base]
Name = RHEL-$ releasever-Base
Baseurl = http://developer.be10.com/centos/3.6/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.be10.com/centos/3.6/ OS /i386/RPM-GPG-KEY-CentOS-3
# Released updates

[Update]
Name = RHEL-$ releasever-Updates
Baseurl = http://developer.be10.com/centos/3.6/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.be10.com/centos/3.6/ OS /i386/RPM-GPG-KEY-CentOS-3


If you do not want to upgrade the core,
Add in [main]
Exclude = kernel-source


3. Use yum to check for updates

# Yum check-update (when a non-root user runs su-c "yum check-update", enter the password of the root account when prompted)

Update all software in the system to the latest version.
# Yum update

The files downloaded in this step are cached, And the yum tool retains the downloaded data files and software packages for reuse. If necessary, you can copy the software package from the repository cache directory under/var/cache/yum for use elsewhere.


4. yum command usage

Yum update mysql (update mysql to the latest version)
Each completed transaction records the affected software packages in the log file/var/log/yum. log.

Yum remove Software
Yum list View Software list

If you do not know the software name, you can use the search or provides function. In addition, wildcards and regular expressions can be used in any yum search option to expand the search range. The provides function checks the files contained in the software package and the functions provided by the software. Compared with search, this option requires yum to download and read a large index file.

Use a standard wildcard character with a word or name segment to search :? Represents any single character. * represents 0 or multiple characters. Use the Escape Character () before the wildcard ().

Example: yum list mysq *

5. Run yum automatically

Chkconfig -- list yum
Chkconfig -- level 3 yum on

Control script/etc/rc. d/init. d/yum, the control script activates/etc/cron. daily/yum. cron, which enables the cron service to automatically update the system at every day.
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.