三种方法:rpm,yum,源码包
安装rpm包
[root@lizhipeng01 Packages]# rpm -ivh zsh-5.0.2-7.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:zsh-5.0.2-7.el7 ################################# [100%]
升级rpm包
[root@lizhipeng01 Packages]# rpm -Uvh zsh-5.0.2-7.el7.x86_64.rpm
准备中... ################################# [100%]
软件包 zsh-5.0.2-7.el7.x86_64 已经安装
卸载rpm包
[root@lizhipeng01 Packages]# rpm -e zsh
查询一个包是否安装
[root@lizhipeng01 Packages]# rpm -qa 查询当前安装的所有的包
[root@lizhipeng01 Packages]# rpm -e ppp
错误:依赖检测失败:
ppp = 2.4.5 被 (已安裝) NetworkManager-1:1.0.0-14.git20150121.b4ea599c.el7.x86_64 需要
[root@lizhipeng01 Packages]# rpm -q ppp 查看ppp有没有安装
ppp-2.4.5-33.el7.x86_64
[root@lizhipeng01 Packages]# rpm -q ppp1
未安装软件包 ppp1
[root@lizhipeng01 Packages]# rpm -qi vim-enhanced 查询一个包的安装信息,i 就是information
Name : vim-enhanced
Epoch : 2
Version : 7.4.160
Release : 2.el7
Architecture: x86_64
Install Date: 2017年12月02日 星期六 17时28分11秒
Group : Applications/Editors
Size : 2292098
License : Vim
Signature : RSA/SHA256, 2017年08月11日 星期五 04时15分38秒, Key ID 24c6a8a7f4a80eb5
Source RPM : vim-7.4.160-2.el7.src.rpm
Build Date : 2017年08月02日 星期三 08时46分12秒
Build Host : c1bm.rdu2.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.vim.org/
Summary : A version of the VIM editor which includes recent enhancements
Description :
VIM (VIsual editor iMproved) is an updated and improved version of the
vi editor. Vi was the first real screen-based editor for UNIX, and is
still very popular. VIM improves on vi by adding new features:
multiple windows, multi-level undo, block highlighting and more. The
vim-enhanced package contains a version of VIM with extra, recently
introduced features like Python and Perl interpreters.
Install the vim-enhanced package if you‘d like to use a version of the
VIM editor which includes recently added enhancements like
interpreters for the Python and Perl scripting languages. You‘ll also
need to install the vim-common package.
[root@lizhipeng01 Packages]# rpm -ql vim-enhanced 列出一个RPM包的安装文件,下面这几个文件是由vim-enhanced安装得来的
/etc/profile.d/vim.csh
/etc/profile.d/vim.sh
/usr/bin/rvim
/usr/bin/vim
/usr/bin/vimdiff
/usr/bin/vimtutor
[root@lizhipeng01 Packages]# rpm -qf /usr/bin/vim /usr/bin/vim这个文件隶属于下面vim-enhanced-7.4.160-2.el7.x86_64这个包
vim-enhanced-7.4.160-2.el7.x86_64
[root@lizhipeng01 Packages]# rpm -qf `which cd`
bash-4.2.46-12.el7.x86_64
[root@lizhipeng01 Packages]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Vault.repo
[root@lizhipeng01 Packages]# yum search vim 查找vim,但是不够精准
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirror.0x.sg
================================================ N/S matched: vim =================================================
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
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 includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor
名称和简介匹配 only,使用“search all”试试。
[root@lizhipeng01 Packages]# yum list |grep ‘vim‘ 管道符,过滤
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
vim-minimal.x86_64 2:7.4.160-1.el7 @anaconda
protobuf-vim.x86_64 2.5.0-8.el7 base
vim-X11.x86_64 2:7.4.160-2.el7 base
vim-minimal.x86_64 2:7.4.160-2.el7 base
[root@lizhipeng01 Packages]# yum grouplist
已加载插件:fastestmirror
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: centosx4.centos.org
Available environment groups:
最小安装
基础设施服务器
计算节点
文件及打印服务器
基本网页服务器
虚拟化主机
带 GUI 的服务器
GNOME 桌面
KDE Plasma Workspaces
开发及生成工作站
可用组:
传统 UNIX 兼容性
兼容性程序库
图形管理工具
安全性工具
开发工具
控制台互联网工具
智能卡支持
科学记数法支持
系统管理
系统管理工具
完成
[root@lizhipeng01 Packages]# yum remove -y ^C 卸载一个包,危险的操作
[root@lizhipeng01 Packages]# yum update -y ^C 升级一个包,后面跟包名
[root@lizhipeng01 Packages]# yum provides "/*/vim" 搜一个命令可以由哪一个包安装到它,比如vim
yum搭建本地仓库(视频中ppt小错误: gpcheck改为gpgcheck,yum cean 改为 yum clean)
[root@lizhipeng01 Packages]# ls /mnt
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
[root@lizhipeng01 Packages]# cd
[root@lizhipeng01 ~]# cp -r /etc/yum.repos.d /etc/yum/repos.d.bak
[root@lizhipeng01 ~]# cd /etc/yum.repos.d
[root@lizhipeng01 yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Sources.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Vault.repo
[root@lizhipeng01 yum.repos.d]# rm -rf ./*
[root@lizhipeng01 yum.repos.d]# vi dvd.repo
[root@lizhipeng01 yum.repos.d]# yum clean all
已加载插件:fastestmirror
正在清理软件源: dvd
Cleaning up everything
Cleaning up list of fastest mirrors