前言

参考文章:https://linux.cn/article-7937-1.html

在参考文章的基础上进行总结。

使用download-only插件实现

首先我们可以使用downloadonly插件来实现这个目标,但是前提我们需要先安装这个插件:

yum install yum-plugin-downloadonly

备注:安装这个插件的时候,请注意CentOS-Base.repo不要移除,如果将CentOS-Base.repo移除,使用CentOS-Media.repo这个挂载的镜像仓库文件,那么就会无法搜索到这个插件,因为这个插件应该是从网络上下载下来的。

接下来就可以使用如下命令下载rpm包而不安装:

yum install --downloadonly

使用上述命令,会默认将rpm下载到/var/cache/yum/目录下,具体参数参见/etc/yum.conf文件:

[root@ambari1 hzhiping]# cat /etc/yum.conf

[main]

cachedir=/var/cache/yum/$basearch/$releasever # 默认保存rpm的地址

keepcache=1 # 是否开启保存?1为开启,0为关闭

debuglevel=

logfile=/var/log/yum.log

exactarch=

obsoletes=

gpgcheck=

plugins=

installonly_limit=

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

# This is the default, if you make this bigger yum won't see if the metadata

# is newer on the remote and so you'll "gain" the bandwidth of not having to

# download the new metadata and "pay" for it by yum not having correct

# information.

# It is esp. important, to have correct metadata, for distributions like

# Fedora which don't keep old packages around. If you don't like this checking

# interupting your command line usage, it's much better to have something

# manually check the metadata once an hour (yum-updatesd will do this).

# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo

# in /etc/yum.repos.d

当然,可以指定目录,如下所示:

yum install --downloadonly --downloaddir=/tmp

这样子在/tmp目录下就会看到了,如果不加/表示的是相对路径,会在当前目录创建一个tmp目录,然后保存在tmp目录下。

另外也可以一次性下载多个包,格式如下:

yum install --downloadonly --downloaddir=/tmp

使用yumdownloader实现

“yumdownloader” 是一款简单,但是却十分有用的命令行工具,它可以一次性下载任何 RPM 软件包及其所有依赖包。

要使用这款工具,首先我们需要安装yum-utils,命令如下:

yum install -y yum-utils

一旦下载好了,我们就能够使用yumdownloader命令去下载相关的rpm包了,以下是yumdownloader命令的帮助文档:

[root@ambari1 hzhiping]# yumdownloader --help

Loaded plugins: fastestmirror

Usage: "yumdownloader [options] package1 [package2] [package..]

Options:

Plugin Options:

Yum Base Options:

-h, --help show this help message and exit

-t, --tolerant be tolerant of errors

-C, --cacheonly run entirely from system cache, don't update cache

-c [config file], --config=[config file]

config file location

-R [minutes], --randomwait=[minutes]

maximum command wait time

-d [debug level], --debuglevel=[debug level]

debugging output level

--showduplicates show duplicates, in repos, in list/search commands

-e [error level], --errorlevel=[error level]

error output level

--rpmverbosity=[debug level name]

debugging output level for rpm

-q, --quiet quiet operation

-v, --verbose verbose operation

-y, --assumeyes answer yes for all questions

--assumeno answer no for all questions

--version show Yum version and exit

--installroot=[path]

set install root

--enablerepo=[repo]

enable one or more repositories (wildcards allowed)

--disablerepo=[repo]

disable one or more repositories (wildcards allowed)

-x [package], --exclude=[package]

exclude package(s) by name or glob

--disableexcludes=[repo]

disable exclude from main, for a repo or for

everything

--disableincludes=[repo]

disable includepkgs for a repo or for everything

--obsoletes enable obsoletes processing during updates

--noplugins disable Yum plugins

--nogpgcheck disable gpg signature checking

--disableplugin=[plugin]

disable plugins by name

--enableplugin=[plugin]

enable plugins by name

--skip-broken skip packages with depsolving problems

--color=COLOR control whether color is used

--releasever=RELEASEVER

set value of $releasever in yum config and repo files

--downloadonly don't update, just download

--downloaddir=DLDIR

specifies an alternate directory to store packages

--setopt=SETOPTS set arbitrary config and repo options

--bugfix Include bugfix relevant packages, in updates

--security Include security relevant packages, in updates

--advisory=ADVS, --advisories=ADVS

Include packages needed to fix the given advisory, in

updates

--bzs=BZS Include packages needed to fix the given BZ, in

updates

--cves=CVES Include packages needed to fix the given CVE, in

updates

--sec-severity=SEVS, --secseverity=SEVS

Include security relevant packages matching the

severity, in updates

yumdownloader options:

--destdir=DESTDIR destination directory (defaults to current directory) # 指定下载的目录

--urls just list the urls it would download instead of

downloading

--resolve resolve dependencies and download required packages # 下载该rpm相关的依赖包

--source operate on source packages

--archlist=ARCHLIST

only download packages of certain architecture(s)

[root@ambari1 hzhiping]#

比如我们下载vim-enhanced及其依赖包:

坚壁清野

如何使用yum来下载RPM包而不进行安装

如何使用yum来下载RPM包而不进行安装 2015-03-23 13:15 theo-l译 linux.cn 字号:T | T yum是基于Red Hat的系统(如CentOS.Fedora.RHEl ...

【转】用yum只下载rpm包而不安装

转自:http://liucheng.name/1950/ CentOS用yum安装软件是非常方便的,有时,我们只需要下载其中的rpm包,而不直接安装时咋办呢? 一般情况下,yum是不提供只下载的功能 ...

Yum自动下载RPM包及其所有依赖的包

前几天我尝试去创建一个仅包含我们经常在 CentOS 7 下使用的软件的本地仓库.当然,我们可以使用 curl 或者 wget 下载任何软件包,然而这些命令并不能下载要求的依赖软件包.你必须去花一些时 ...

Linux yum如何下载rpm包到本地

下载前先安装一个小插件 [root@wang yum.repos.d]# yum install -y yum-plugin-downloadonly 安装一个包的同时 加上 yum install ...

使用yum来下载RPM包而不进行安装

1. 安装yum-downloadonly. yum-utils 或 yum-plugin-downloadonly 软件包 (RHEL5) # yum install yum-downloadonl ...

yum 下载rpm包 安装rpm包依赖关系

方法一:yumdownloader 工具 1.安装工具包 yum install yum-utils -y 2.下载一个RPM包 yumdownloader  ...

centos7用rpm安装mysql5.7【初始用yum安装发现下载非常慢,就考虑本地用迅雷下载rpm方式安装】

1.下载 4个rpm包 mysql-community-client-5.7.26-1.el7.x86_64.rpmmysql-community-common-5.7.26-1.el7.x86_64 ...

yum仅下载RPM包不安装

http://www.ttlsa.com/linux/howto-yum-download-rpm-without-install/

yum只下载软件不安装的两种方法

1 通过yum自带一个工具:yumdownloader rpm -qa |grep yum-utils yum -y install yum-utils* rpm -ql yum-utils 安装好后 ...

随机推荐

各种Android手机Root方法

Root的介绍  谷歌的android系统管理员用户就叫做root,该帐户拥有整个系统至高无上的权利,它可以访问和修改你手机几乎所有的文件,只有root才具备最高级别的管理权限.我们root手机的过程 ...

Echarts事件

Echart饼图.柱状图.折线图(pie.bar.line)添加点击事件发布日期:2014年08月10日   来源:PHP1.CN     点击:250638摘要:var myChart= echar ...

面试题:m个长度为n的ordered array,求top k 个 数字

package com.sinaWeibo.interview; import java.util.Comparator; import java.util.Iterator; import java ...

Xcode断点的一些黑魔法

转自 只会左键断点?是时候试试这样那样断点了 编码不能没调试,调试不能没断点(Break Point).XCode的断点功能也是越来越强大. 基本断点 如下图,这种是最常用的断点,也是最容易设置.左键 ...

通过 yum update 将系统从CentOS 6.2 升级到 CentOS 6.6 及升级过程中的简单排错

本文说明 本文写于2014年的WP中,后WP停止维护,今天翻到此记录整理下,记录于此,方便日后查看. 话说那时候写博客真是认真啊~哈哈~ 升级前的系统信息 [root@thatsit ~]# unam ...

iOS - UIImageView 动画

1.UIImageView 动画 1.1 播放图片集 播放图片集 @property (nonatomic, strong) UIImageView *playImageView; self.play ...

redis学习 (key)键,Python操作redis 键 (二)

# -*- coding: utf-8 -*- import redis #这个redis 连接不能用,请根据自己的需要修改 r =redis.Redis(host=") 1. delete ...

(拼接SQL语句)mysql中date类型,datetime类型

: , . _ - /  %  &  # @ ! * | [ ] { }   ;  + = update ky set date = '18,9-2'  where id  = 1  // 2 ...

从输入URL到页面加载发生了什么

大体过程 浏览器的地址栏输入URL并按下回车 浏览器检查当前URL是否存在缓存,并比较缓存是否过期 DNS解析URL对应的IP 根据IP建立TCP连接(三次握手) HTTP发起请求 服务器处理请求,浏 ...

Android Studio多Module使用 aar 依赖包 丢包解决

FAQ: AAR打包引用丢包问题, jar, aar, dependency 嵌套层级依赖的丢失 问: aar包中,如何包含第三方依赖库? 如果直接作为module 依赖是没有问题的,但是如果打包成a ...

linux yum下载不安装,CentOS 7设置yum仅仅下载rpm不安装总结相关推荐

  1. CentOS7挂载CentOS7 everything安装光盘和设置yum源为挂载的光盘

    CentOS7挂载CentOS7 everything安装光盘和设置yum源为挂载的光盘 一,挂载光盘 首先需要将光盘放入光驱.挂载将使用/dev下的设备文件cdrom: [root@localhos ...

  2. Minimal安装CentOS 7使用yum报This system is not registered to Red Hat Subscription Management.

    问题描述 最小化安装CentOS 7的Linux系统后,发现yum安装任何工具,都报This system is not registered to Red Hat Subscription Mana ...

  3. linux 6 yum配置,redhat 6(centos 6)配置 yum 源的两种方法

    由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源. 本文包括配置本地源及第三方源.第三方源包括:网易,epel, ...

  4. linux配置ip地址 routes,CentOS 7 设置网络IP地址(示例代码)

    CentOS 7 设置网络IP地址 自动获得IP地址 1,CentOS 7自动获得一个IP地址 [[email protected] ~]# dhclient 2,查看网卡信息,会发现有一个ens33 ...

  5. VM安装centos时设置基础软件仓库时出错(设置镜像后依旧出错)

    是因为阿里云镜像用不了了,具体可去镜像仓库里看readme文件. 解决方法是把镜像地址改为如下即可(http),版本自行修改: vault.centos.org/8.2.2004/BaseOS/x86 ...

  6. linux7编译mysql5.7安装,CentOS 7.4 使用源码包编译安装MySQL 5.7.20

    使用yum安装的MySQL一般版本比较旧,但是运行稳定.如果想要尝试最新的功能或者需要指定特殊的功能的话,就需要手工进行编译安装了. 一.下载安装包 (一).先下载MySQL源码,网址为:https: ...

  7. python 系统策略禁止这个安装_电脑无法安装软件提示设置了系统策略禁止此项安装怎么办?...

    Win7系统安装软件提示系统管理员设置系统策略禁止此项安装怎么办?最近有用户在安装office2003时,就遇到了提示禁止此项安装的问题,那么电脑不能安装某些软件该如何解决呢?请看下文介绍. 解决方法 ...

  8. linux 卸载32位rar,让CentOS能用yum自动安装rar和unrar

    目的:让CentOS能用yum自动安装rar和unrar 系统环境: CentOS 7.0 具体操作步骤如下: 1.编辑文件 编辑dag.repo文件,或者说是新建一个dag.repo文件. vi / ...

  9. linux Centos 配置本地yum源

    yum安装源配置 两种yum安装源的配置 1.操作系统无法联网情况下 #mkdir /yum #cd /media/CentOS_5.8_Final/ (进入到系统安装光盘下) #cp * /yum  ...

  10. centos 7 通过yum安装mysql教程

    一.查看是否安装过 1.以下指令查看是否安装过 rpm -qa | grep -i mysql 如果发现已经安装,需要卸载了再安装(据说,这样的卸载是不彻底的.) rpm -e mysql 二.下载和 ...

最新文章

  1. 计算机组成的基本硬件设备
  2. rust如何在木板上上传图片_通过编写一个简单的游戏来学习 Rust | Linux 中国
  3. qemu搭建arm运行linux内核,centos使用qemu搭建ARM64运行环境
  4. AI+服务 阿里巴巴如何做智能服务转型?
  5. BugkuCTF-Crypto题小山丘的秘密
  6. html5中音频、视频标签、自定义播放器常用属性及方法、全屏操作、新增属性兼容问题
  7. python paramiko 模块简介(SSH2协议)
  8. python numpy 生成矩阵_Python numpy生成矩阵、串联矩阵代码分享
  9. C++中头文件和实现文件分离进行编译
  10. 【转】电脑显示有软驱
  11. 证件OCR识别360度全面解析
  12. Google 因果推断的CausalImpact 贝叶斯结构时间序列模型(二十二)
  13. 关于getc与fgetc和getchar的本质区别
  14. web前端入门到实战:CSS实现平行四边形布局效果
  15. 计算机二级c语言程序设计改错,2017年计算机二级C语言上机改错题考点总结
  16. 打印信息无法连接服务器,打印机无法连接服务器
  17. php 跨站脚本,Piwigo register.php页面多个跨站脚本漏洞
  18. Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspectivewith Transformers
  19. ISO_16750-1/2/3/4/5标准各部分修订状态汇总(Road vehicles-Environmental conditions and testing for EE equipment)
  20. c# 小票打印机打条形码_C#调用CODESOFT打印条码标签的关键代码

热门文章

  1. 【笔记】QQ输入法手写识别汉字web版
  2. 游戏《我的世界》马怎么繁殖?如何驯化?
  3. 微信小程序服务端调用--小程序码 wxacode.getUnlimited 接口调用,实现微信扫码直接跳转小程序页面
  4. python 转盘 圆形,用python实现一个转盘
  5. LOGO特训营 第一节 鉴别Logo与Logo设计思路
  6. 国产麒麟操作系统kylin V10 sp2操作系统安装openldap和kerberos
  7. jw实验二:配置VLAN Trunks
  8. Java实现指数运算
  9. 将CD转MP3工具(WIN7以上可以使用)
  10. 田刚:庞加莱猜想与几何