2018-1-8 Linux Learning Notes

Source: Internet
Author: User

7.1 Three ways to install packages

(1) RPM tool
(2) Yum tools
(3) Source code package

7.2 RPM Package Introduction

RPM is the abbreviation for "Redhat Package Manager", which is a database record that installs the packages you need into a set of hypervisor for your Linux hosts. In other words, there is a database on RPM in your Linux system that records the installed packages and dependencies between packages and packages.

RPM packages are pre-compiled and packaged files on Linux machines that are fast to install. However, there are some shortcomings, such as the installation of the environment must be consistent with the environment or equivalent, the package and the package is dependent on the situation, the package needs to unload the dependencies, if the dependent package is required by the system, you can not unload the package, otherwise it will cause the system to crash.

If there is a system installation disk in your optical drive, we can mount the optical drive to the/MNT directory via the mount/dev/cdrom/mnt command, then you will see a lot of. rpm files in the/mnt/packages directory, which is the RPM package.
Mount/dev/cdrom/mnt #挂载光驱
RPM Package Format:
Package name, version number, release version number, platform, for example:
python-2.7.5-58.el7.x86_64.rpm

7.3 RPM Tool Usage

RPM-IVH RPM Package File//Installation
RPM-UVH RPM Package File//Upgrade
RPM-E Package name//Uninstall
RPM-QA//Query installed packages
RPM-Q Package name//query whether the specified package is installed
RPM-QI Package name//Query Specify package information
RPM-QL Package name//list package installed files
RPM-QF file Absolute path//view which package the file was installed by
<------------------------------------------------------------------------------------->
[Email protected] mnt]# RPM-IVH packages/zsh-5.0.2-28.el7.x86_64.rpm
In preparation ... ################################# [100%]
Upgrading/installing ...
1:zsh-5.0.2-28.el7 ################################# [100%]
[Email protected] mnt]# rpm-e zsh
[Email protected] mnt]# Rpm-qa | grep zip
Zip-3.0-11.el7.x86_64
Gzip-1.5-9.el7.x86_64
Bzip2-libs-1.0.6-13.el7.x86_64
Bzip2-1.0.6-13.el7.x86_64
Unzip-6.0-16.el7.x86_64
[[email protected] mnt]# rpm-q zip
Zip-3.0-11.el7.x86_64
[[email protected] mnt]# Rpm-qi zip
Name:zip
version:3.0
Release:11.el7
Architecture:x86_64
Install date:2018 January 06 Saturday 21:24 51 seconds
Group:applications/archiving
size:815173
License:bsd
signature:rsa/sha256, November 21, 2016 Monday 05:04 58 seconds, Key ID 24c6a8a7f4a80eb5
Source rpm:zip-3.0-11.el7.src.rpm
Build date:2016 November 06 Sunday 00:49 55 seconds
Build Host:worker1.bsys.centos.org
Relocations: (Not relocatable)
Packager:centos Buildsystem Vendor:centos
Url:http://www.info-zip.org/zip.html
Summary:a file compression and packaging utility compatible with PKZIP
Description:
The ZIP program is a compression and file packaging utility. Zip is
Analogous to a combination of the UNIX tar and compress commands and
is compatible with PKZIP (a compression and file packaging utility for
MS-DOS systems).

Install the ZIP package if you need to compress files using the zip
Program.
[[email protected] mnt]# rpm-ql zip
/usr/bin/zip
/usr/bin/zipcloak
/usr/bin/zipnote
/usr/bin/zipsplit
/usr/share/doc/zip-3.0
/usr/share/doc/zip-3.0/changes
/usr/share/doc/zip-3.0/license
/usr/share/doc/zip-3.0/readme
/usr/share/doc/zip-3.0/readme. CR
/usr/share/doc/zip-3.0/todo
/usr/share/doc/zip-3.0/whatsnew
/usr/share/doc/zip-3.0/where
/usr/share/doc/zip-3.0/algorith.txt
/usr/share/man/man1/zip.1.gz
/usr/share/man/man1/zipcloak.1.gz
/usr/share/man/man1/zipnote.1.gz
/usr/share/man/man1/zipsplit.1.gz
[Email protected] mnt]# Rpm-qf/usr/bin/ls
Coreutils-8.22-18.el7.x86_64
[Email protected] mnt]#
[Email protected] mnt]# RPM-QFwhich cd#先查询cd的绝对路径然后将查询到的结果传给rpm去查询, here ' is the anti-quote
Bash-4.2.46-28.el7.x86_64
[Email protected] mnt]#
<------------------------------------------------------------------------------------->

7.4 Yum Tool usage

Yum differs from the RPM tool in that yum automatically resolves package dependencies , unlike RPM, which requires manual installation of dependent packages.
Yum list//list RPM packages available in the system
Yum list | grep ' vim '//Search for the package name containing VIM
ls/etc/yum.repos.d///view yum related configuration file, more importantly/etc/ Yum.repos.d/centos-base.repo
Yum Search package name/search for a package
yum install [-y]//Install a package
Yum remove [-y]//unload a package ( more dangerous, use with caution! )
Yum grouplist//lists the groups available on the system
Yum Groupinstall [-y] #安装组 (All packages in)
Yum Update [-y] #升级一个包
Yum provides "/*/vim" #搜索 Package shout All packages of the command
<------------------------------------------------------------------------------------;
[[email protected] yum.repos.d]# yum grouplist
Loaded plug-in: Fastestmirror
No setup group information file
maybe Run:yum groups mark CONVERT (see mans yum)
Loading mirror speeds from cached hostfile

    • base:mirrors.cqu.edu.cn
    • Extras:mirrors.cn99.com
    • Updates:mirrors.cn99.com
      Groups of available environments:
      Minimum installation
      Infrastructure server
      COMPUTE nodes
      File and print server
      Basic Web Server
      Virtualization Host
      A server with a GUI
      GNOME Desktop
      KDE Plasma Workspaces
      Development and generation of workstations
      Available Groups:
      Traditional UNIX compatibility
      Compatibility Program Library
      Graphical management tools
      Security Tools
      Development tools
      Console Internet Tools
      Smart card support
      Scientific notation Support
      System Management
      System Administration Tools
      Complete
      [Email protected] yum.repos.d]#
      <------------------------------------------------------------------------------------>

7.5 Yum to build a local warehouse

When we install a package through Yum, Yum will connect to the remote repository by default to download and install it in/etc/yum.repos.d/centos-base.repo

If you can't access the network and want to use Yum, you can build a local yum repository, as follows:
(1) First, you need to have a disc image to use (provide these packages AH)
(2) Mount the image to the/MNT directory
(3) First back up the Yum configuration directory/etc/yum.repos.d/
Cp-r/etc/yum.repos.d/etc/yum.repos.d.bak
(4) Delete all configuration files under Yum configuration directory/ETC/YUM.REPOS.D
Rm-f/etc/yum.repos.d/*
(5) Vim/etc/yum.repos.d/dvd.repo//contents are as follows:
[DVD]
Name=install DVD
Baseurl=file:///mnt
Enable=1
Gpgcheck=0
(6) Yum Clean all #清除yum历史信息
(7) Yum list #查看新的可用的包

2018-1-8 Linux Learning Notes

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.