Three ways to install packages
1.RPM Tools
2.yum tool (can install dependent packages automatically)
3. Source code Package
Introduction and use of RPM tools
1. First mount the optical drive:
which-2.20-7.el7.x86_64.rpm #包含包名,版本号,发布版本号,平台whois-5.1.1-2.el7.x86_64.rpmwireshark-1.10.14-14.el7.x86_64.rpmwireshark-gnome-1.10.14-14.el7.x86_64.rpmwodim-1.1.11-23.el7.x86_64.rpm
2. Installation:-IVH
[[email protected] Packages]# rpm -ivh zsh-5.0.2-28.el7.x86_64.rpm准备中... ################################# [100%]正在升级/安装... 1:zsh-5.0.2-28.el7 ################################# [100%]
3. Upgrade:-UVH
[[email protected] Packages]# rpm -Uvh zsh-5.0.2-28.el7.x86_64.rpm准备中... ################################# [100%] 软件包 zsh-5.0.2-28.el7.x86_64 已经安装
4. Uninstall:-E
[[email protected] Packages]# rpm -e zsh
5. Query all installed packages:-QA
[[email protected] Packages]# rpm -qaopen-vm-tools-10.1.5-3.el7.x86_64grub2-common-2.02-0.64.el7.centos.noarchkexec-tools-2.0.14-17.el7.x86_64setup-2.8.71-7.el7.noarchNetworkManager-tui-1.8.0-9.el7.x86_64basesystem-10.0-7.el7.centos.noarchNetworkManager-wifi-1.8.0-9.el7.x86_64
6. Query whether the specified package is installed:-Q
[[email protected] Packages]# rpm -q zshzsh-5.0.2-28.el7.x86_64
7. Query the specified package information:-qi
[[email protected] Packages]# rpm -qi vim-enhancedName : vim-enhancedEpoch : 2Version : 7.4.160Release : 2.el7Architecture: x86_64Install Date: 2018年01月03日 星期三 15时24分46秒
8. list files for package installation:-QL
[root[email protected] Packages]# rpm -ql vim-enhanced/etc/profile.d/vim.csh/etc/profile.d/vim.sh/usr/bin/rvim/usr/bin/vim/usr/bin/vimdiff/usr/bin/vimtutor
9. Query which package the file was installed by:-QF
[[email protected] Packages]# rpm -qf /usr/bin/vimvim-enhanced-7.4.160-2.el7.x86_64
[[email protected] Packages]# rpm -qf `which cd` #可以先查询命令,在查询由哪个安装的,反引号bash-4.2.46-28.el7.x86_64
Yum Tool usage
1.yum can automatically install dependent packages
2. List available packages: Yum List
[[email protected] Packages]# yum listzenity.x86_64 3.22.0-1.el7 base zlib.i686 1.2.7-17.el7 base zlib-devel.i686 1.2.7-17.el7 base zlib-devel.x86_64 1.2.7-17.el7 base zlib-static.i686 1.2.7-17.el7 base zlib-static.x86_64 1.2.7-17.el7 base zsh.x86_64 5.0.2-28.el7 base zsh-html.x86_64 5.0.2-28.el7 base zziplib.i686 0.13.62-5.el7 base zziplib.x86_64 0.13.62-5.el7 base
3. Search for a package:
[[email protected] Packages]# yum search vim已加载插件:fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.163.com * updates: mirrors.tuna.tsinghua.edu.cn============================ N/S matched: vim ============================protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers : descriptionsvim-X11.x86_64 : The VIM version of the vi editor for the X Window Systemvim-common.x86_64 : The common files needed by any version of the VIM : editorvim-enhanced.x86_64 : A version of the VIM editor which includes recent : enhancementsvim-filesystem.x86_64 : VIM filesystem layoutvim-minimal.x86_64 : A minimal version of the VIM editor 名称和简介匹配 only,使用“search all”试试。
A relatively accurate search:
[[email protected] Packages]# yum list |grep ‘vim‘vim-minimal.x86_64 2:7.4.160-2.el7 @anacondaprotobuf-vim.x86_64 2.5.0-8.el7 base vim-X11.x86_64 2:7.4.160-2.el7 base vim-common.x86_64 2:7.4.160-2.el7 base vim-enhanced.x86_64 2:7.4.160-2.el7 base vim-filesystem.x86_64 2:7.4.160-2.el7 base
4. Install a package: Yum install-y #-y not asked to install, install directly
5. Group Display:
[[email protected] Packages]# yum grouplist已加载插件:fastestmirror没有安装组信息文件Maybe run: yum groups mark convert (see man yum)Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.163.com * updates: mirrors.tuna.tsinghua.edu.cn可用的环境分组: 最小安装 基础设施服务器 计算节点 文件及打印服务器 基本网页服务器 虚拟化主机 带 GUI 的服务器 GNOME 桌面 KDE Plasma Workspaces 开发及生成工作站可用组: 传统 UNIX 兼容性 兼容性程序库 图形管理工具 安全性工具 开发工具 控制台互联网工具 智能卡支持 科学记数法支持 系统管理 系统管理工具完成
6. Group Installation: Yum groupinstall-y
7. Uninstall: Yum remove-y
8. Upgrade a package: Yum update-y #如果不加包名, everything is upgraded
9. Search for the required package for this command: Yum provides
[[email protected] packages]# yum provides "/*/vim" loaded plugin: fastestmirrorloading mirror speeds from cached Hostfile * b ase:mirrors.tuna.tsinghua.edu.cn * extras:mirrors.163.com * updates:mirrors.tuna.tsinghua.edu.cnbase/7/x86_64/ filelists_db | 6.7 MB 01:46 extras/7/x86_64/filelists_db | 528 KB 00:18 updates/7/x86_64/filelists_db | 3.0 MB 00:41 Cmake-2.8.12.2-2.el7.x86_64:cross-platform make system Source: Base Matching Source: file name:/usr/share/cmake/edito Rs/vim2:docker-unit-test-1.12.6-48.git0fdc778.el7.centos.x86_64:automates: Deployment of containerized Applicat Ions-for Running unit ...: Tests Source: Extras match Source: File name:/var/lib/docker-unit-test/docker-novolume-plugin-385ec70baa C3ef356f868f391c8d7818140fbd44/godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim file name:/var/lib/ Docker-unit-test/contrib/syntax/vim file name:/var/lib/docker-unit-test/v1.10-migrator-c417a6a022c5023c111662e8280f885f6ac259be/godeps/_workspace/src/github.com/docker/docker/contrib/syntax/vim file name:/var/lib/ docker-unit-test/runc-79c3939053c870fbb4de5484d98640d5ba028ef4/godeps/_workspace/src/github.com/docker/docker/ Contrib/syntax/vim
Yum builds local warehouses
1. Mount the optical drive
2. Backup Files directory:
[[email protected] ~]# cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
3. Delete the original:
[[email protected] yum.repos.d]# rm -rf ./*
4. Create a new warehouse, add content, and then clear the cache:
[[email protected] yum.repos.d]# vi dvd.repo[[email protected] yum.repos.d]# yum clean all已加载插件:fastestmirror正在清理软件源: dvdCleaning up everythingMaybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed reposCleaning up list of fastest mirrors
5. Once again Yum list finds the Yum warehouse as DVD:
cdparanoia-libs.x86_64 10.2-17.el7 dvd cdrdao.x86_64 1.2.3-20.el7 dvd celt051.x86_64 0.5.1.3-8.el7 dvd centos-bookmarks.noarch 7-1.el7 dvd centos-indexhtml.noarch 7-9.el7.centos dvd certmonger.x86_64 0.78.4-3.el7 dvd cgdcbxd.x86_64 1.0.2-7.el7 dvd check.x86_64 0.9.9-5.el7 dvd
Two errors in the diagram
Gpgcheck=0
Yum Clean All
How to install packages under Linux system (top)