学习笔记0330----linux软件安装卸载

预习内容

7.1 安装软件包的三种方法
7.2 rpm包介绍
7.3 rpm工具用法
7.4 yum工具用法
7.5 yum搭建本地仓库(视频中ppt小错误: gpcheck改为gpgcheck,yum cean 改为 yum clean)
7.6 yum更换国内源
7.7 yum下载rpm包
7.8/7.9 源码包安装

扩展

1.linux软件安装方法

在Linux下安装软件包,主要有如下三种办法:

(1)rpm工具(redhat package manager,手动安装,难点在于包的依赖关系

rpm包类似于windows下的.exe文件,安装路径和文件名基本都是固定的。

rpm -ivh [rpm完整包名]

(2)yum工具(python开发出来的工具,操作对象rpm包,能自动解决软件包的依赖关系,是最常用的方式

yum install -y 【包名简称】

(3)源码包(需要通过编译器把该源码包编译成可执行的文件)【安装难度大】

./configure---->make---->make install

2. rpm 工具用法

2.1 rpm包的命名格式

例如如下的一个rpm文件
-rw-rw-r–. 1 root root 83872 11月 12 22:49 zziplib-0.13.62-9.el7.x86_64.rpm
zziplib ——软件包名
0.13.62 ——主版本.次版本.修正版本
el7 ——发布版本号,centos7
x86_64 ——软件平台是64位系统软件

2.2 rpm 命令各参数的含义

rpm -ivh file.rpm 安装
rpm -Uvh file.rpm 升级
rpm -e file.rpm 卸载
rpm -qa 查询安装的包
rpm -q file 查询指定包是否安装
rpm -qi file 查询指定包信息
rpm -ql file 列出包的安装文件
rpm -qf 文件绝对路径 查看一个文件是由那个安装包安装的

1.软件包的安装
[root@linux-02 ~]# mount /dev/cdrom  /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@linux-02 ~]# cd /mnt/Packages/
[root@linux-02 Packages]# ll | grep lrzsz
-rw-rw-r--. 1 root root    79376 7月   4 2014 lrzsz-0.12.20-36.el7.x86_64.rpm
[root@linux-02 Packages]# rpm -ivh lrzsz
错误:打开 lrzsz 失败: 没有那个文件或目录
[root@linux-02 Packages]# rpm -ivh  lrzsz-0.12.20-36.el7.x86_64.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:lrzsz-0.12.20-36.el7             ################################# [100%]
[root@linux-02 Packages]# 
2.软件包的升级
rpm -Uvh ***.rpm
3.软件包的卸载
[root@linux-02 Packages]# rpm -e lrzsz
[root@linux-02 Packages]# rpm -q lrzsz
未安装软件包 lrzsz 
4.查询安装的包名称
[root@linux-02 Packages]# rpm -ivh  lrzsz-0.12.20-36.el7.x86_64.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:lrzsz-0.12.20-36.el7             ################################# [100%]
[root@linux-02 Packages]# rpm -qa lrzsz
lrzsz-0.12.20-36.el7.x86_64
[root@linux-02 Packages]# 
5.查询指定包是否安装
[root@linux-02 Packages]# rpm -q lrzsz
lrzsz-0.12.20-36.el7.x86_64
[root@linux-02 Packages]# rpm -q wireshark
未安装软件包 wireshark 
[root@linux-02 Packages]# 
6.rpm -qi file 查询指定包信息
[root@linux-02 Packages]# rpm -qi lrzsz
Name        : lrzsz
Version     : 0.12.20
Release     : 36.el7
Architecture: x86_64
Install Date: 2019年03月29日 星期五 04时31分54秒
Group       : Applications/Communications
Size        : 184846
License     : GPLv2+
Signature   : RSA/SHA256, 2014年07月04日 星期五 11时35分32秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : lrzsz-0.12.20-36.el7.src.rpm
Build Date  : 2014年06月10日 星期二 07时29分11秒
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.ohse.de/uwe/software/lrzsz.html
Summary     : The lrz and lsz modem communications programs
Description :
Lrzsz (consisting of lrz and lsz) is a cosmetically modified
zmodem/ymodem/xmodem package built from the public-domain version of
the rzsz package. Lrzsz was created to provide a working GNU
copylefted Zmodem solution for Linux systems.
[root@linux-02 Packages]# 
7.rpm -ql file 列出包的安装文件
[root@linux-02 Packages]# rpm -ql lrzsz
/usr/bin/rb
/usr/bin/rx
/usr/bin/rz
/usr/bin/sb
/usr/bin/sx
/usr/bin/sz
/usr/share/locale/de/LC_MESSAGES/lrzsz.mo
/usr/share/man/man1/rz.1.gz
/usr/share/man/man1/sz.1.gz
[root@linux-02 Packages]# 
8.rpm -qf 文件绝对路径 查看一个文件是由那个安装包安装的
[root@linux-02 Packages]# rpm -qf `which rz`    //  ` 符号是数字1左边英文状态的字符
lrzsz-0.12.20-36.el7.x86_64
[root@linux-02 Packages]# 

3. yum工具用法

Yum(全称为 Yellow dogUpdater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。

3.1 yum命令的用法

yum list //列出当前所有的软件包
yum search vim //这样搜索回搜索出所有包含vim的包
yum install vim //安装软件
yum grouplist //列举系统中以组安装的包(组安装的包会包括很多,组安装一下就就可以安装很多附在的包。)
yum remove vim // 卸载软件包
yum update // 升级系统软件包
yum provides ‘vim’ //搜索一条命令的软件包

[root@linux-01 nginx] yum list //列出当前所有的软件包

在这里插入图片描述

[root@linux-01 nginx] ll /etc/yum.repos.d/ 查看yum源的配置文件

在这里插入图片描述

[root@linux-01 nginx]# yum search vim //这样搜索回搜索出所有包含vim的包

在这里插入图片描述

[root@linux-02 ~]# yum install vim //安装软件

在这里插入图片描述

[root@linux-01 nginx]# yum grouplist //列举系统中以组安装的包(组安装的包会包括很多,组安装一下就就可以安装很多附在的包。)
因为系统安装时中文字体,若要安装组包,可以使用 LANG=en 修改系统的语言为英文
[root@linux-01 nginx]# yum grouplist
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirrors.huaweicloud.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
可用的环境分组:
   最小安装
   基础设施服务器
   计算节点
   文件及打印服务器
   Cinnamon 桌面环境
   MATE 桌面环境
   基本网页服务器
   虚拟化主机
   带 GUI 的服务器
   GNOME 桌面
   KDE Plasma Workspaces
   开发及生成工作站
可用组:
   Cinnamon
   Fedora Packager
   Haskell
   MATE
   Milkymist
   TurboGears 应用程序构架
   Xfce
   传统 UNIX 兼容性
   兼容性程序库
   图形管理工具
   安全性工具
   开发工具
   控制台互联网工具
   教育软件
   智能卡支持
   电子实验室
   科学记数法支持
   系统管理
   系统管理工具
   通用桌面
完成

[root@linux-02 ~]# yum remove vim // 卸载软件包

在这里插入图片描述

[root@linux-02 ~]# yum update // 升级系统软件包

在这里插入图片描述

[root@linux-02 ~]# yum provides ‘vim’ //搜索一条命令的软件包

在这里插入图片描述

3.2yum配置本地源

配置本地源的思路:
- 需要把centos7的iso镜像加载倒光驱,把光驱挂载到mnt目录下,即可查看;
- 需要把之前电脑的yum源仓库配置文件copy一份,仓库配置文件在 /etc/yum.repo/ ;
- 把源仓库配置文件删除;
- 新建一个dvd.repo仓库的文件,把配置文件写入;
- 使用yum clear all 清除yum源的缓存;
- 之后即可使用本地yum源;

在这里插入图片描述
在这里插入图片描述

[root@linux-01 ~]# mount /dev/cdrom  /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@linux-01 ~]# cp -r /etc/yum.repos.d/     /home/
[root@linux-01 ~]# cd /etc/yum.repos.d/
[root@linux-01 yum.repos.d]# ll
总用量 32
-rw-r--r--. 1 root root 1664 3月  30 02:41 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 3月  30 02:41 CentOS-CR.repo
-rw-r--r--. 1 root root  649 3月  30 02:41 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 3月  30 02:41 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 3月  30 02:41 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 3月  30 02:41 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 3月  30 02:41 CentOS-Vault.repo
[root@linux-01 ~]#rm -rf *
[root@linux-01 ~]#vim  dvd.repo

在这里插入图片描述

[root@linux-01 Packages]#  vim /etc/yum.repos.d/dvd.repo    //需要添加的配置文件如下
[dvd]
name=install dvd
baseurl=file:///mnt
enable=1
gpcheck=0  

在这里插入图片描述

[root@linux-01 yum.repos.d]# yum clean all
已加载插件:fastestmirror
正在清理软件源: dvd
Cleaning up list of fastest mirrors
Other repos take up 140 M of disk space (use --verbose for details)
[root@linux-01 yum.repos.d]# yum list |less

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3.3 yum配置国内阿里云源

配置国内源的思路:
- 把之前copy的源mv回源目录,创建的dvd.repo给删除;
- 我们需要区去阿里云源网站找到centos 7的源文件,http://mirrors.aliyun.com/repo/ ;
- 然后把centos 7的源文件给下载出来,可以使用wget下载,如果wget没有安装,也可以使用curl -O 下载;
	- 我是把刚才的额本地源给删除,清空缓存文件,使用yum安装wget命令下载;
- 可以使用yum list 去查看下源文件列表,通过对比刚才创建的本地源,我们发现这个源比之前的源要多哦。

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

3.4 yum 安装扩展源epel-release

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

[root@linux-01 yum.repos.d]# yum install epel-release
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================
 Package                             架构                          版本                         源                             大小
====================================================================================================================================
正在安装:
 epel-release                        noarch                        7-11                         extras                         15 k

事务概要
====================================================================================================================================
安装  1 软件包

总下载量:15 k
安装大小:24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                 |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : epel-release-7-11.noarch                                                                                        1/1 
  验证中      : epel-release-7-11.noarch                                                                                        1/1 

已安装:
  epel-release.noarch 0:7-11                                                                                                        

完毕!
[root@linux-01 yum.repos.d]# ll
总用量 44
-rw-r--r--. 1 root root 2523 6月  16 2018 Centos-7.repo
-rw-r--r--. 1 root root 1664 3月  30 02:41 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 3月  30 02:41 CentOS-CR.repo
-rw-r--r--. 1 root root  649 3月  30 02:41 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 3月  30 02:41 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 3月  30 02:41 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 3月  30 02:41 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 3月  30 02:41 CentOS-Vault.repo
-rw-r--r--. 1 root root  951 10月  3 2017 epel.repo
-rw-r--r--. 1 root root 1050 10月  3 2017 epel-testing.repo

3.5 yum下载rpm包的方法

3.5.1 yum install 包名 --downloadonly 下载系统中没有安装过的rpm

在这里插入图片描述
在这里插入图片描述

3.5.2 yum install 包名 --downloadonly --downloaddir=//tmp 指定下载rpm包文件的位置

[root@linux-01 ~]# yum install zsh --downloadonly  --downloaddir=/tmp/
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirrors.huaweicloud.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-31.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================
 Package                     架构                           版本                                 源                            大小
====================================================================================================================================
正在安装:
 zsh                         x86_64                         5.0.2-31.el7                         base                         2.4 M

事务概要
====================================================================================================================================
安装  1 软件包

总下载量:2.4 M
安装大小:5.6 M
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@linux-01 ~]# ls /tmp/
1.txt                        vmware-root_5962-726368536   vmware-root_6257-1681855458  yum_save_tx.2019-03-30.04-14.5TmQsX.yumtx
3.txt                        vmware-root_6112-968930924   vmware-root_6475-1681658694  yum_save_tx.2019-03-30.04-22.TFeLI7.yumtx
newdisk                      vmware-root_6247-1714755061  vmware-root_6496-692096812   zsh-5.0.2-31.el7.x86_64.rpm
vmware-root_5773-1681791841  vmware-root_6253-1689653881  xihaji

3.5.2 yum reinstall 包名 --downloadonly --downloaddir=/tmp 下载系统中已经安装过的rpm包

[root@linux-01 ~]# yum reinstall vim-enhance --downloadonly --downloaddir=/tmp
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
参数 vim-enhance 没有匹配
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirrors.huaweicloud.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
错误:无须任何处理
[root@linux-01 ~]# 
[root@linux-01 ~]# yum reinstall vim --downloadonly --downloaddir=/tmp
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * epel: mirrors.huaweicloud.com
 * extras: mirrors.163.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.160-5.el7 将被 已重新安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================
 Package                           架构                        版本                                 源                         大小
====================================================================================================================================
重新安装:
 vim-enhanced                      x86_64                      2:7.4.160-5.el7                      base                      1.0 M

事务概要
====================================================================================================================================
重新安装  1 软件包

总下载量:1.0 M
安装大小:2.2 M
Background downloading packages, then exiting:
vim-enhanced-7.4.160-5.el7.x86_64.rpm                                                                        | 1.0 MB  00:00:00     
exiting because "Download Only" specified
[root@linux-01 ~]# ll /tmp/
总用量 105924
-rw-rw-r--. 1 root   root         933 3月  26 03:00 1.txt
-rw-r--r--. 1 root   root         933 3月  26 23:00 3.txt
-rw-r--r--. 1 root   root   104857600 3月  23 05:15 newdisk
-rw-r--r--. 1 root   root     1087648 11月 12 22:48 vim-enhanced-7.4.160-5.el7.x86_64.rpm
drwx------. 2 root   root           6 3月  23 02:45 vmware-root_5773-1681791841
drwx------. 2 root   root           6 3月  20 18:03 vmware-root_5962-726368536
drwx------. 2 root   root           6 3月  14 01:03 vmware-root_6112-968930924
drwx------. 2 root   root           6 3月  14 22:22 vmware-root_6247-1714755061
drwx------. 2 root   root           6 3月  20 18:02 vmware-root_6253-1689653881
drwx------. 2 root   root           6 3月  14 01:53 vmware-root_6257-1681855458
drwx------. 2 root   root           6 3月  28 03:05 vmware-root_6475-1681658694
drwx------. 2 root   root           6 3月  26 02:59 vmware-root_6496-692096812
drwxrwxr-t. 2 xihaji xihaji         6 3月  19 03:19 xihaji
-rw-------. 1 root   root         235 3月  30 04:14 yum_save_tx.2019-03-30.04-14.5TmQsX.yumtx
-rw-------. 1 root   root         235 3月  30 04:22 yum_save_tx.2019-03-30.04-22.TFeLI7.yumtx
-rw-------. 1 root   root         244 3月  30 04:25 yum_save_tx.2019-03-30.04-25.8U19LD.yumtx
-rw-r--r--. 1 root   root     2496072 11月 12 22:49 zsh-5.0.2-31.el7.x86_64.rpm

4.源码安装软件

  • 下载源码包范围:官方站点、阿铭分享的地址
  • 约定:源码包下载位置放置于/usr/local/src/
  • 源码删除软件,直接删除软件安装位置的目录即可。
  • 源码安装步骤如下: (echo $? 检查上一条的命令是否有错误,如果结果是非0即为错误)
    • ./configure --prefix=【安装位置】
    • make
    • make install
源码安装第一步 ./configure --prefix=/usr/local/nginx

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

源码安装第二步: make

在这里插入图片描述
在这里插入图片描述

源码安装第三步:make install

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

课后总结

1. yum的配置文件 /etc/yum.conf

## yum的配置文件信息 ##
[main]
cachedir=/var/cache/yum/$basearch/$releasever  //仓库的下载地址
keepcache=0  //等于1时表示保存下载的rpm包
debuglevel=2
logfile=/var/log/yum.log   //yum的日志文件
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

2. yum源的配置文件 /etc/yum.repos.d/

在这里插入图片描述

3. yum的插件yum-utils

1. 安装yum-utils插件
[root@linux-02 ~]# yum install yum-utils
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.cn99.com
 * updates: mirrors.163.com
base                                                                                                         | 3.6 kB  00:00:00     
extras                                                                                                       | 3.4 kB  00:00:00     
updates                                                                                                      | 3.4 kB  00:00:00     
正在解决依赖关系
--> 正在检查事务
---> 软件包 yum-utils.noarch.0.1.1.31-50.el7 将被 安装
--> 正在处理依赖关系 python-kitchen,它被软件包 yum-utils-1.1.31-50.el7.noarch 需要
--> 正在处理依赖关系 libxml2-python,它被软件包 yum-utils-1.1.31-50.el7.noarch 需要
--> 正在检查事务
---> 软件包 libxml2-python.x86_64.0.2.9.1-6.el7_2.3 将被 安装
---> 软件包 python-kitchen.noarch.0.1.1.1-5.el7 将被 安装
--> 正在处理依赖关系 python-chardet,它被软件包 python-kitchen-1.1.1-5.el7.noarch 需要
--> 正在检查事务
---> 软件包 python-chardet.noarch.0.2.2.1-1.el7_1 将被 安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================
 Package                            架构                       版本                                  源                        大小
====================================================================================================================================
正在安装:
 yum-utils                          noarch                     1.1.31-50.el7                         base                     121 k
为依赖而安装:
 libxml2-python                     x86_64                     2.9.1-6.el7_2.3                       base                     247 k
 python-chardet                     noarch                     2.2.1-1.el7_1                         base                     227 k
 python-kitchen                     noarch                     1.1.1-5.el7                           base                     267 k

事务概要
====================================================================================================================================
安装  1 软件包 (+3 依赖软件包)

总下载量:861 k
安装大小:4.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                 | 267 kB  00:00:00     
(2/4): python-chardet-2.2.1-1.el7_1.noarch.rpm                                                               | 227 kB  00:00:00     
(3/4): yum-utils-1.1.31-50.el7.noarch.rpm                                                                    | 121 kB  00:00:00     
(4/4): libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm                                                             | 247 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                1.3 MB/s | 861 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : python-chardet-2.2.1-1.el7_1.noarch                                                                             1/4 
  正在安装    : python-kitchen-1.1.1-5.el7.noarch                                                                               2/4 
  正在安装    : libxml2-python-2.9.1-6.el7_2.3.x86_64                                                                           3/4 
  正在安装    : yum-utils-1.1.31-50.el7.noarch                                                                                  4/4 
  验证中      : libxml2-python-2.9.1-6.el7_2.3.x86_64                                                                           1/4 
  验证中      : python-kitchen-1.1.1-5.el7.noarch                                                                               2/4 
  验证中      : yum-utils-1.1.31-50.el7.noarch                                                                                  3/4 
  验证中      : python-chardet-2.2.1-1.el7_1.noarch                                                                             4/4 

已安装:
  yum-utils.noarch 0:1.1.31-50.el7                                                                                                  

作为依赖被安装:
  libxml2-python.x86_64 0:2.9.1-6.el7_2.3      python-chardet.noarch 0:2.2.1-1.el7_1      python-kitchen.noarch 0:1.1.1-5.el7     

完毕!
[root@linux-02 ~]# 
2. 使用命令yumdownloader 来下载rpm包

安装yum-utils插件,之前预习提到的yum下载rpm包,可以使用【 yumdownloader 软件包】来实现。

在这里插入图片描述

3. 使用命令yum localinstill 来安装本地的rpm包
[root@linux-02 ~]# ll
总用量 1068
drwxr-xr-x. 2 root root       6 3月  19 03:04 111
-rw-------. 1 root root    1420 3月  14 01:02 anaconda-ks.cfg
-rw-r--r--. 1 root root 1087648 11月 12 22:48 vim-enhanced-7.4.160-5.el7.x86_64.rpm
[root@linux-02 ~]# yum localinstall  vim-enhanced-7.4.160-5.el7.x86_64.rpm 
已加载插件:fastestmirror
正在检查 vim-enhanced-7.4.160-5.el7.x86_64.rpm: 2:vim-enhanced-7.4.160-5.el7.x86_64
vim-enhanced-7.4.160-5.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.160-5.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

====================================================================================================================================
 Package                   架构                版本                           源                                               大小
====================================================================================================================================
正在安装:
 vim-enhanced              x86_64              2:7.4.160-5.el7                /vim-enhanced-7.4.160-5.el7.x86_64              2.2 M

事务概要
====================================================================================================================================
安装  1 软件包

总计:2.2 M
安装大小:2.2 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 2:vim-enhanced-7.4.160-5.el7.x86_64                                                                             1/1 
  验证中      : 2:vim-enhanced-7.4.160-5.el7.x86_64                                                                             1/1 

已安装:
  vim-enhanced.x86_64 2:7.4.160-5.el7                                                                                               

完毕!
[root@linux-02 ~]# 

扩展阅读

搭建一个局域网的http的yum源

猜你喜欢

转载自blog.csdn.net/u011709380/article/details/88872378