Install and configure yum commands in rhel system

Source: Internet
Author: User
Knowledge Structure: 1. understanding YUM2. introducing the experiment Environment 3. how to configure the YUM local update source 4. how to configure the YUM client. how to use YUM to maintain the software package 6. conclusion 7. lab questions --------------------------------------------------------------------------- 1. know YUMYellowdo

Knowledge structure:

1. know YUM

2. introduce the experiment environment

3. how to configure the YUM local update source

4. how to configure the YUM client

5. how to use YUM to maintain the software package

6. Summary

7. lab questions

---------------------------------------------------------------------------

1. know YUM

Yellow dog Updater, Modified. it is an RPM-based toolkit management tool that perfectly implements the RPM software dependency and allows the system administrator to manage software packages in RHEL more easily.

This tool has been integrated into the system since RHEL5. we can use it for software package installation, removal, upgrade, maintenance, query, and other functions. Of course, what needs to be declared again is that it will automatically analyze the dependency of the software, which is more convenient and reliable than rpm * -- aid.

The yum tool supports the following three installation methods:

Ftp -----> use ftp to connect to the update source and install software

Http -----> use http to connect to the update source and install software

File -----> use file, that is, the form of a local file. this method is insufficient because the source cannot be shared and is only used by the local machine.

---------------------------------------------------------------------------

2. Experiment environment introduction

* VMware 6.5 + RHEL5

* Host A: server.benet.edu will be deployed as the YUM update source.

* Host C: client02.benet.edu will be used as the YUM client for testing.

* Nic connection mode. use host-only to keep them in the same network for testing.

Note: Host A is also a dhcp server, and host C obtains IP addresses through DHCP to ensure connectivity.

3. how to configure the YUM local update source

In this example, we use ftp to update the installation source. that is to say, we need to place the yum software library in the ftp directory, we need two tools to complete this task. both tools can be conveniently obtained from the CD:

* Vsftpd-2.0.5-12.el5.i386.rpm ------> ftp software package

* Createrepo-0.4.11-3.el5.noarch.rpm ------> used to generate cost ground

A. install vsftpd and create the most basic ftp server (because the ftp tool is used in this example. if other methods are used, you can install other tools)

# Rpm-ivh/misc/cd/Server/vsftpd-2.0.5-12.el5.i386.rpm

After the installation is complete, you only need to enable the service for normal use. here, you only need to know how to use the ftp directory to store data. other ftp control is not considered for the moment.

# Service vsftpd start -------> start the vsftpd service

# Chkconfig vsftpd on -------> enable the service to take effect at next startup

B. install the createrepo tool so that you can use it later to create an update source (this step can be omitted in versions later than rhel5.1 (excluding 5.1), but is not recommended to be omitted !)

# Rpm-ivh/misc/cd/Server/createrepo-0.4.11-3.el5.noarch.rpm

C. copy the content of the CD to the ftp directory:

# Cp-R/mnt/*/var/ftp/pub

Here we are mainly concerned about the access control of folders and ftp servers due to SELinux and folder permissions. Therefore, we use-R recursion to change the permissions to the corresponding

D. use a tool to create an update source.

# Createrepo-g/mnt/Server/repodata/comps-rhel5-server-core.xml/var/ftp/pub/Server

# Createrepo-g/mnt/VT/repodata/comps-rhel5-vt.xml/var/ftp/pub/VT

# Createrepo-g/mnt/Cluster/repodata/comps-rhel5-cluster.xml/var/ftp/pub/Cluster

# Createrepo-g/mnt/ClusterStorage/repodata/comps-rhel5-cluster-st.xml/var/ftp/pub/ClusterStorage

The execution of these four steps will take you some time. most of the length depends on the performance of your machine. if there is no advanced application, it is recommended that you only perform the first step, the rest of the software involved in virtualization, clustering, and storage can be ignored for the time being. However, these steps only differ in operation, and the principle is the same, they all depend on the following descriptions ........

Note: The-g parameter specifies a group dependency File (comps *. xml), the dependence of the restructured software package on the location after replication. As mentioned earlier, RHEL5.1 is an essential step. As for the later RHEL system version, if you do not perform the preceding step d, it is OK.

After the vsftpd service is started, YUM completes the server configuration!

-----------------------------------------------------------------------------

4. configure the YUM client file ----->/etc/yum. repos. d/*. repo

In RHEL5, all are in/etc/yum. repos. d/in this directory. all files ending with repo are called yum to update the configuration file (note here why we didn't say the extension is repo)

Note that we can regard the rhel-debuginfo.repo as a template file, copy a server. repo for specific settings can be

The following source definition indicates that, based on the architecture of the CD directory, the four sources are the four software package directories in the CD. In this example, the ftp method is used as the object to introduce, and other methods are changed accordingly:

[Server] -----------------------------------------> update the source name

Name = Red Hat Enterprise Linux 5 Server -----------------> equivalent to comment

Baseurl = ftp: // 192.168.5.254/pub/Server -----------------> This keyword specifies the specific source location

Enabled = 1 -----------------> 0 | 1 whether to enable Source 0, disable 1, enable

Gpgcheck = 1 -----------------> whether to perform the gpg check

Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release ---> The gpg-key referenced in the gpg check

If you only perform one operation on the Server directory when creating the installation source, you do not need to add the following operations.

[VT]

Name = Red Hat Enterprise Linux 5 VT

Baseurl = ftp: // 192.168.5.254/pub/VT

Enabled = 1

Gpgcheck = 1

Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Cluster]

Name = Red Hat Enterprise Linux 5 Cluster

Baseurl = ftp: // 192.168.5.254/pub/Cluster

Enabled = 1

Gpgcheck = 1

Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]

Name = Red Hat Enterprise Linux 5 ClusterStorage

Baseurl = ftp: // 192.168.5.254/pub/ClusterStorage

Enabled = 1

Gpgcheck = 1

Gpgkey = file: // etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

---------------------------------------------------------------------------------

5. YUM usage

A. install

# Yum install package name ------> install the software package, for example, install dovecot

B. remove

# Yum remove package name -------> remove a specified package

C. Update

# Yum update [package name] --------> update a specified software package. If no software package is specified, all installed software in the system will be updated. the specified software package must be installed, otherwise, it will not be installed, unlike the update tool (-U) in rpm)

D. query

# Yum list package name ---------> list specified packages, including installed or not installed

# Yum whatprovides file name --------> query which package provides the given file, similar to rpm-qf .....

E. others

There are many other parameters and usage methods. you can refer to man yum for help. you must develop the habit of reading man frequently!

----------------------------------------------------------------------------------

6. summary of this module

A. understand the functions and features of yum

B. Learn to configure the YUM local update source

C. Learn to configure the YUM client

D. learn to use YUM tools to install and maintain software

----------------------------------------------------------------------------------

7. lab questions

Create a YUM update source on the local server, and update and maintain the software in http mode on the client.


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.