Install and uninstall the rpm package in linux, the yum method, and the rpmyum

Source: Internet
Author: User

Install and uninstall the rpm package in linux, the yum method, and the rpmyum

There are three methods for installing software in linux:

Install the rpm package, use the rpm tool to install the software package yum, use the yum command to automatically install the software package source code package, download the source code package, and compile and install the software

Rpm tool usage

1. Check whether the rpm is installed: rpm-qa | grep lvm (lvm is the rpm package name to be queried)

[Root @ hzclov51 ~] # Rpm-qa | grep lvm

Mesa-private-llvm-3.3-0.3.rc3.el6.x86_64

Lvm2-libs-2.02.100-8.el6.x86_64

Lvm2-2.02.100-8.el6.x86_64

System-config-lvm-1.1.12-16.el6.noarch

2. query the files contained in an rpm:

[Root @ hzclov51 ~] # Rpm-ql lvm2-2.02.100-8.el6.x86_64.

/Etc/lvm

/Etc/lvm/archive

/Etc/lvm/backup

/Etc/lvm/cache

/Etc/lvm/cache/. cache

3. query which rpm package a file belongs:

[Root @ hzclov51 ~] # Rpm-qf/etc/lvm

Lvm2-2.02.100-8.el6.x86_64

4. query which packages are dependent on an rpm package.

[Root @ hzclov51 ~] # Rpm-q -- whatrequires device-mapper-persistent-data

Lvm2-2.02.100-8.el6.x86_64

5. query the content on which an rpm package depends

[Root @ hzclov51 ~] # Rpm-qR lvm2-2.02.100-8.el6.x86_64.

/Bin/bash

/Bin/sh

/Bin/sh

Bash >=4.0

Chkconfig

Chkconfig

Config (lvm2) = 2.02.100-8. el6

Device-mapper-persistent-data> = 0.2.8-2

Libc. so.6 () (64bit)

Libc. so.6 (GLIBC_2.2.5) (64bit)

Libc. so.6 (GLIBC_2.3) (64bit)

Libc. so.6 (GLIBC_2.3.4) (64bit)

Libc. so.6 (GLIBC_2.4) (64bit)

Libdevmapper-event.so.1.02 () (64bit)

Libdevmapper-event.so.1.02 (Base) (64bit)

6. query rpm package information

[Root @ hzclov51 ~] # Rpm-qi lvm2-2.02.100-8.el6.x86_64

Name: lvm2 Relocations: (not relocatable)

Version: 2.02.100 Vendor: Red Hat, Inc.

Release: 8. el6 Build Date: Wed 30 Oct 2013 04:10:56 HKT

Install Date: Tue 07 Mar 2017 11:36:37 pm hkt Build Host: x86-028.build.eng.bos.redhat.com

Group: System Environment/Base Source RPM: lvm2-2.02.100-8.el6.src.rpm

Size: 1561629 License: GPLv2

Signature: RSA/8, Wed 30 Oct 2013 09:42:09 HKT, Key ID 199e2f91fd431d51

Packager: Red Hat, Inc.

URL: http://sources.redhat.com/lvm2

Summary: Userland logical volume management tools

Description:

LVM2 primary des all of the support for handling read/write operations on

Physical volumes (hard disks, RAID-Systems, magneto optical, etc .,

Multiple devices (MD), see mdadd (8) or even loop devices, see

Losetup (8), creating volume groups (kind of virtual disks) from one

Or more physical volumes and creating one or more logical volumes

(Kind of logical partitions) in volume groups.

7. Check the installation location of a document that has installed the software.

[Root @ hzclov51 ~] # Rpm-qd lvm2-2.02.100-8.el6.x86_64.

/Usr/share/doc/lvm2-2.02.100/COPYING

/Usr/share/doc/lvm2-2.02.100/COPYING. LIB

/Usr/share/doc/lvm2-2.02.100/INSTALL

/Usr/share/doc/lvm2-2.02.100/README

/Usr/share/doc/lvm2-2.02.100/VERSION

/Usr/share/doc/lvm2-2.02.100/WHATS_NEW

/Usr/share/man/man5/lvm.conf.5.gz

/Usr/share/man/man8/blkdeactivate.8.gz

/Usr/share/man/man8/fsadm.8.gz

/Usr/share/man/man8/lvchange.8.gz

/Usr/share/man/man8/lvconvert.8.gz

/Usr/share/man/man8/lvcreate.8.gz

8. Install rpm

Rpm-ivh xxx. rpm (the rpm package exists locally)

9. Uninstall rpm

Rpm-e xxx. rpm

Usage of yum Tool

1. Basic yum commands

Yum list # list all available software packages

Yum install # install the software package

Yum grouplist # list all software groups

Yum groupinstall # Install software group

Yum remove # uninstall software

Yum update # Upgrade the software. If the package name is not added, all the software in the system will be upgraded, including the system

Yum provides "/*/vim" # search for software packages using vim commands

2. configuration file of yum Source

[Root @ localhost ~] # Ls/etc/yum. repos. d/# store the yum configuration file in this directory

CentOS-Base.repoCentOS-Debuginfo.repoCentOS-Media.repoCentOS-Vault.repo

CentOS-CR.repoCentOS-fasttrack.repoCentOS-Sources.repo

3. yum search software package

[Root @ localhost ~] # Yum search vim # search for vim-related software packages

Loaded plug-in: fastestmirror

Loading mirror speeds from cached hostfile

* Base: mirrors.zju.edu.cn

* Extras: mirrors.zju.edu.cn

* Updates: mirrors.zju.edu.cn

============================================ N/S matched: vim ============================================

Protobuf-vim.x86_64: Vim syntax highlighting for Google Protocol Buffers descriptions

The vim-X11.x86_64: the VIM version of the vi editor for The X Window System

The vim-common.x86_64: the common files needed by any version of The VIM editor

Vim-enhanced.x86_64: A version of the VIM editor which has des recent enhancements

Vim-filesystem.x86_64: VIM filesystem layout.

Vim-minimal.x86_64: A minimal version of the VIM editor

The name matches the description only. Use "search all" to try.

4. yum list | grep search software package, more accurate

[Root @ localhost ~] # Yum list | grep vim

Vim-common.x86_642: 7.4.160-2. el7 @ base

Vim-enhanced.x86_642: 7.4.160-2. el7 @ base

Vim-filesystem.x86_642: 7.4.160-2. el7 @ base

Vim-minimal.x86_642: 7.4.160-2. el7 @ anaconda.

Protobuf-vim.x86_642.5.0-8.el7base

Vim-X11.x86_642: 7.4.160-2. el7base.

Build a local repository using yum

1. Mount the optical drive to the mnt directory.

2. First back up the yum configuration file cp-r/etc/yum. repos. d/etc/yum. repos. d. bak/

3. Go to the yum. repos. d directory and delete all files. [root @ localhost ~] # Cd/etc/yum. repos. d # Enter yum. repos. d directory [root @ localhost yum. repos. d] # lsCentOS-Base.repoCentOS-Debuginfo.repoCentOS-Media.repoCentOS-Vault.repoCentOS-CR.repoCentOS-fasttrack.repoCentOS-Sources.repo [root @ localhost yum. repos. d] # rm-rf. /* # delete all objects

4. Create a file dev. repo [root @ localhost yum. repos. d] # vim dev. repo

# Write the following content into dev. repo: [dvd] # repository name = install dvd # customize a description string baseurl = file: /// mnt # rpm position enable = 1 # available gpcheck = 0 # detect

5. Clear the previous yum cache, yum clean all [root @ localhost yum. repos. d] # yum clean all

6. You can use yum to install the local software package.

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.