在三种方法中,源码包是最难的,yum工具是最简单的
[root@hf-01 mnt]# cd Packages/
[root@hf-01 Packages]# ls
yum-utils-1.1.31-24.el7.noarch.rpm
zenity-3.8.0-4.el7.x86_64.rpm
zip-3.0-10.el7.x86_64.rpm
zlib-1.2.7-13.el7.x86_64.rpm
zlib-devel-1.2.7-13.el7.x86_64.rpm
zsh-5.0.2-7.el7.x86_64.rpm
等等等
yelp-3.8.1-7.el7.x86_64.rpm
yelp-libs-3.8.1-7.el7.x86_64.rpm
[root@localhost Packages]# rpm -ivh zsh-5.0.2-25.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:zsh-5.0.2-25.el7 ################################# [100%]
这个文件在当前路径,可以加 ./zsh-5.0.2-25.el7.x86_64.rpm,或者可以使用相对路径,不用加 ./
安装rpm包的时候,也会存在依赖包
[root@localhost Packages]# rpm -e zsh
[root@localhost Packages]#
直接删除,不会有任何提示。(若是有提示,很有可能是出现什么错误了)
[root@localhost Packages]# rpm -qa 这里截取了前几行代码
trousers-0.3.13-1.el7.x86_64
filesystem-3.2-21.el7.x86_64
bind-license-9.9.4-37.el7.noarch
fxload-2002_04_11-16.el7.x86_64
nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64
libthai-0.1.14-9.el7.x86_64
列出来的都是已经安装好的包,这些都可以直接卸载
[root@localhost Packages]# rpm -q ppp
ppp-2.4.5-33.el7.x86_64
[root@localhost Packages]#
若是已经安装的包,会直接显示出来;
若是未安装的包,则会提示未安装软件包。
[root@localhost Packages]# rpm -qi vim-enhanced
Name : vim-enhanced //包名
Epoch : 2
Version : 7.4.160 //版本
Release : 2.el7 //发布版本
Architecture: x86_64 //架构
Install Date: 2017年11月02日 星期四 11时24分32秒 //安装时间
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@localhost Packages]#
[root@localhost 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
[root@localhost Packages]#
[root@localhost Packages]# rpm -qf /usr/bin/vim 根据文件的绝对路径来查看到是由哪个包安装的
vim-enhanced-7.4.160-2.el7.x86_64
[root@localhost Packages]#
which cd
[root@localhost Packages]# rpm -qf `which cd`
bash-4.2.46-20.el7_2.x86_64
[root@localhost Packages]# which cd
/usr/bin/cd
[root@localhost Packages]#
[root@localhost Packages]# yum list //列出可用的rpm包(这里只截取了一点)
zziplib-devel.i686 0.13.62-5.el7 base
zziplib-devel.x86_64 0.13.62-5.el7 base
zziplib-utils.x86_64 0.13.62-5.el7 base
最左侧是包的名字加相关信息
中间这一列是它的版本号以及平台版本号
最右侧是它仓库的名字
仓库名字的由来,可以从 /etc/yum.repos.d/ 看yum的配置文件,在 /etc/yum.repos.d/中最核心的就是CentOS-Base.repo文件
[root@localhost Packages]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo
[root@localhost Packages]# ls /etc/yum.repos.d/CentOS-Base.repo
/etc/yum.repos.d/CentOS-Base.repo
[root@localhost Packages]# cat !$
cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@localhost Packages]#
会看到其中 方括号中 的就是仓库的名字,把包放进容器中,而容器就是仓库,而仓库的地址上述有链接,rpm包就是在里面寻找
[root@localhost Packages]# yum search vim
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.163.com
=================================== 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@localhost Packages]#
会搜索到与vim相关的包,但也会搜索出来一些说明。(若想只要包,则可以过滤) 如下
[root@hf-01 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@hf-01 Packages]#
只要包名带有vim的,就会显示出来,并且vim还会有颜色显示
[root@hf-01 Packages]# yum grouplist
已加载插件:fastestmirror
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Available environment groups:
最小安装
基础设施服务器
计算节点
文件及打印服务器
基本网页服务器
虚拟化主机
带 GUI 的服务器
GNOME 桌面
KDE Plasma Workspaces
开发及生成工作站
可用组:
传统 UNIX 兼容性
兼容性程序库
图形管理工具
安全性工具
开发工具
控制台互联网工具
智能卡支持
科学记数法支持
系统管理
系统管理工具
完成
[root@hf-01 Packages]#
若选择其中的组就会安装组里面的rpm包,在安装完系统后,进入系统,使用yum工具安装这些组
[root@hf-01 Packages]# yum groupinstall 'Virtualization Host'
在做本地仓库的时候,首先需要一个光驱或光盘(镜像文件)
然后挂载,访问到其中的rpm包
并将一下文件添加到 vi dvd.repo 中去
清除之前的缓存 yum clean all
使用yum list查看,或者翻屏查看命令 yum list |less
yum本地仓库,方便使用本地的光盘作为他的仓库,做为它的依赖的包
[root@hf-01 ~]# vim /etc/yum.conf
[main]
cachedir=/home/soft1/yumcache
keepcache=1
debuglevel=2