In the maintenance of Linux systems, dependency between Linux software packages is a headache. For example, if you want to install software package A, you are prompted to install software package B before installing software package A. When you install software package B, prompt that you must install the C library first... to solve this problem...
In the maintenance of Linux systems, dependency between Linux software packages is a headache. For example, if you want to install software package A, you are prompted to install software package B before installing software package A. When you install software package B, prompt that you must install the C library first... to solve this problem, we need to use the yum (Yellow dog Updater, Modified) tool under Linxu. The yum tool can automatically install dependent packages based on the various headers of rpm packages in the repository (software warehouse) to solve the dependency problem. In linux, it is very convenient to use yum to add, delete, or change the rpm Package!
The following is a simple yum configuration and usage process in linux:
1. Experiment environment
Operating system: Red Hat Enterprise Linux AS 5
Kernel version: 2.6.18-8. el5
CPU architecture: i386 SMP
Attachment software: Red Hat Enterprise Linux AS 5 dvd iso file
2. install yum in linux and create a repository (software repository)
# Mount the rhel 5.0 dvd iso file in linux
Mkdir-p/mnt/iso
Mount-o loop/opt/rhel5.0.iso/mnt/iso
# Install the yum and createrepo packages in linux
RPMs-ivh/mnt/ISO/Server/yum-3.0.1-5.el5.noarch.rpm
RPMs-ivh/mnt/ISO/Server/yum-metadata-parser-1.0-8.fc6.i386.rpm
RPMs-ivh/mnt/ISO/Server/yum-rhn-plugin-0.4.3-1.el5.noarch.rpm
RPMs-ivh/mnt/ISO/Server/yum-updatesd-3.0.1-5.el5.noarch.rpm
RPMs-ivh/mnt/ISO/Server/createrepo-0.4.4-2.fc6.noarch.rpm
# Copy the files in the mounted iso file to the/opt/rhel5.0 directory.
Mkdir/opt/rhel5.0
Cp-R/mnt/ISO/*/opt/rhel5.0
# Regenerate the repository (software repository) related files. the generated files are in the "repodata" folder of the current directory.
Cd/opt/rhel5.0/Server/
Rm-rf repodata
Createrepo-g/mnt/ISO/Server/repodata/comps-rhel5-server-core.xml ./
3. configure yum in linux
In/etc/yum. repos. d/create a suffix under the Directory. repo configuration file, such as: rhel_yum.repo (other files under this directory can be deleted), rhel_yum.repo content is as follows: This article from: http://www.aiezu.com/
[Server]
Name = Server
Baseurl = file: // opt/rhel5.0/Server/
# Note that baseurl points to our repository (software repository)/opt/rhel5.0/Server directory
Enable = 1
Gpgcheck = 0
This article from: http://www.aiezu.com/
4. test the yum in rhel5.0 linux
# Clear yum settings cache
Yum clean all
# View installed and uninstalled software package groups
Yum grouplist
# Install a Web Server package Group
Yum groupinstall "Web Server"
# View group information
Yum groupinfo "Web Server"
This article from: http://www.aiezu.com/
# Delete "MySQL Database"
Yum groupremove "MySQL Database"
# Upgrade "MySQL Database"
Yum groupupdate "MySQL Database"
5. FAQs about yum installation in linux
①. Q: Why Should I copy the files in the mounted ISO image to a local disk instead of using them directly in the mounted iso file system?
A: The repository configuration file must be regenerated, and the mounted iso file system cannot be written. Therefore, it must be copied to a local disk.
②. Q: the following error is reported when we execute "yum groupinstall 'MySQL database'" after Configuration. what is the problem?
Yum groupinstall "MySQL Database"
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process this article from: http://www.aiezu.com/
Setting up repositories
Setting up repositories
Reading repository metadata in from local files
Primary.xml.gz 100% | =======================| 663 kB
######################################## ######## 2113/2113
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mysql to pack into transaction set.
Media: // 1170972069.396645% 232/mysql-5.0.22-2.1.i386.rpm: [Errno 4] IOError:
This article from: http://www.aiezu.com/
Trying other mirror.
Error: failed to retrieve mysql-5.0.22-2.1.i386.rpm from s
Error was [Errno 4] IOError:
A: Please confirm "/etc/yum. repos. the "baseurl" in the d/rhel_yum.repo "file points not to the mounted iso file system path, but to the local disk file system Path. The third line in step 3 of this article. Make sure that the repository configuration file is regenerated using the ninth line of step 2. In fact, "media: // 1170972069.396645 #1" is the configuration value of the Server/repodata/repomd. xml file in rhel 5.0 dvd iso. This article from: http://www.aiezu.com/
③. Q: Why is no package group information listed after I run the "yum grouplist" command? As follows:
# Yum grouplist
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process
Setting up repositories
Server 100% | =================================| 951 B
Done
A: Are you sure you have run the createrepo command to regenerate the repository configuration file, and the command includes the "-g" option, as shown in step 2, line 19th. The "Server/repodata/comps-rhel5-serer-core.xml" in rhel 5.0 dvd iso contains the group information for the rpm package.