linux version: CentOS 7.5.1804

#进入仓库配置目录

cd /etc/yum.repo.d/

#批量重命名所有文件

for files in `ls *`; do mv ${files} ${files}.bak; done

#更新仓库文件指引
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

#创建新的仓库文件
vim cloud.repo [cloud]
name=CentOS-7.5. - cloud - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.5.1804/cloud/$basearch/openstack-pike/
http://mirrors.aliyuncs.com/centos/7.5.1804/cloud/$basearch/openstack-pike/
http://mirrors.cloud.aliyuncs.com/centos/7.5.1804/cloud/$basearch/openstack-pike/
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 ------内容说明--------
[标题] 
name=名字 
failovermethode 有两个选项roundrobin和priority,意思分别是有多个url可供选择时,yum选择的次序,roundrobin是随机选择,
          如果连接失 败则使用下一个,依次循环,priority则根据url的次序从第一个开始。如果不指明,默认是roundrobin。
baseurl=所有rpm包所在的路径可以是网站也可以是本地目录分三种格式ftp:// http:// file:// 
enabled=0/1这个源是否启用 0不启用1启用 
gpgcheck=0/1这个包是否做key校验 
gpgkey=file:///etc/pki/rpm-gpg/这个目录下的key文件(如果gpgcheck=0就不需要这一项)
------我是内容说明底线--------- #清空仓库缓存
yum clean all
#强制删除缓存文件索引
rm -rf /var/cache/yum/*
#重新创建新的缓存索引文件
yum makecache #创建后检查如下图

下载所有rpm包及其相关包:

yumdownloader * --destdir=/tmp/rpms/

下载完成后检查是否下载完成。

如果不想下载,在有网的情况下可以使用yum在线安装,如果不想在线安装,需要离线安装,可以将下载下来的rpm包打包成为本地源进行使用。

------------------下面是制作离线yum源-------------------

方式一、将下载下的多个rpm包放置在一个临时目录  如/tmp/rpms

[root@controller yum.repos.d]# cat cloud.repo
[cloud]
name=cloud
baseurl=file:///tmp/rpms/
enabled=
gpgcheck=
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
[root@controller yum.repos.d]# ls
CentOS-Base.repo.bak cloud.repo cloud.repo.bak
#清空仓库缓存
yum clean all
#强制删除缓存文件索引
rm -rf /var/cache/yum/*
#重新创建新的缓存索引文件
yum makecache
上面这个命令可能会出现如下问题:
[root@controller yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
file:///tmp/rpms/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /tmp/rpms/repodata/repomd.xml"
Trying other mirror. One of the configured repositories failed (cloud),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this: . Contact the upstream for the repository and get them to fix the problem. . Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work). . Run the command with the repository temporarily disabled
yum --disablerepo=cloud ... . Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage: yum-config-manager --disable cloud
or
subscription-manager repos --disable=cloud . Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise: yum-config-manager --save --setopt=cloud.skip_if_unavailable=true failure: repodata/repomd.xml from cloud: [Errno ] No more mirrors to try.
file:///tmp/rpms/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /tmp/rpms/repodata/repomd.xml"

问题原因是这个目录下虽然有很多的rpm 包,但是yum工具不会凭空去使用这些rpm包。所以需要使用一个工具createrepo(如果没有默认安装可以下载对应版本安装)

来创建repo索引。

[root@controller yum.repos.d]# createrepo /tmp/rpms/*
Error: Only one directory allowed per run.
Usage: genpkgmetadata.py [options] You have new mail in /var/spool/mail/root
[root@controller yum.repos.d]# createrepo /tmp/rpms/
Spawning worker 0 with 1590 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete

这样就可以使用yum来使用离线仓库了

再试一下:

yum clean all && yum makecache  就可以使用这个离线仓库了(如下)

[root@controller yum.repos.d]# yum clean all && yum makecache
Loaded plugins: fastestmirror, langpacks
Cleaning repos: cloud
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
cloud | 2.9 kB ::
(/): cloud/filelists_db | 1.8 MB ::
(/): cloud/other_db | kB ::
(/): cloud/primary_db | kB ::
Metadata Cache Created
												

[原]获取openstack-pike安装包的更多相关文章

  1. IBM Domino 9 出现 Domino Designer 您正在试图升级多用户安装。请获取正确的安装包以完成升级。 解决方案

    如果网上搜索的其他方法解决不了,那么我的这个方法可以试一下. 出现的场景: 先装好了Notes,后准备装Designer. 在装Designer解压包之后,出现下面的错误,不能安装: 您正在试图升级多 ...

  2. Appium学习笔记1_获取到APK安装包的Package以及Activity属性值

    我们设置DesiredCapabilities属性值得时候需要设置"appPackage"和"appActivity",如何获取到这两个值呢? 这两个值不是随便 ...

  3. 如何获取AppStore软件安装包的路径

    本帖最后由 chinald 于 2015-10-16 13:59 编辑 前言:本文介绍在Mac下如何找到AppStore下载的安装包路径,以及如何提取出来供以后使用,希望对大家有所帮助(前提:想要提取 ...

  4. openstack中安装包与组件

    keystone openstack-keystone:验证服务,openstack 中的所有组件的验证以及用户验证,权限,目录等服务. python-openstackclient:命令行,安装以后 ...

  5. iTunes获取下载的安装包

    打开iTunes, 偏好设置,选择高级,即可找到文件路径

  6. Mac如何找到从AppStore下载的正版Xcode安装包、以及Xcode清理缓存

    前言:本文介绍在Mac下如何找到AppStore下载的安装包路径,以及如何提取出来供以后使用,希望对大家有所帮助(前提:想要提取某个安装包,前提是你正在从AppStore安装这个程序.比如你想提取im ...

  7. Keil MDK5 安装教程(附安装包百度云)

    关注微信公众号"龙行单片机",后台回复"安装包"获取最新安装包百度云链接. 1.MDK5.11a 安装 双击 mdk511a.exe,进行安装.这里我们将其安装 ...

  8. 获取 windows 商店内的 aapx 安装包 并 安装(旁加载)

    这是一篇教程,写在 win10 版<量子破碎>发售近期. 主要原因:windows 商城的应用下载实在难以忍受...... #######2016-4-9更新####### 4-6号通过旁 ...

  9. HOWTO - Basic MSI安装包在安装运行过程中如何获取完整源路径

    有朋友问到如何在一个Windows Installer安装包中获取安装包源路径,就是在安装包运行过程中动态获取*.msi所在完整路径. 这个问题分两类,如果我们的安装包只是一个*.msi安装文件,那么 ...

  10. Installshield获取安装包版本的系统变量是IFX_PRODUCT_VERSION

    原文:Installshield获取安装包版本的系统变量是IFX_PRODUCT_VERSION Installshield获取安装包版本的系统变量为IFX_PRODUCT_VERSION 当笔记记下 ...

随机推荐

  1. 【二分+拓扑排序】Milking Order @USACO 2018 US Open Contest, Gold/upc_exam_6348

    目录 Milking Order @USACO 2018 US Open Contest, Gold/upc_exam_6348 PROBLEM 题目描述 输入 输出 样例输入 样例输出 提示 MEA ...

  2. pygame-KidsCanCode系列jumpy-part8-记录历史最高分

    通常在多玩家的游戏中,每个玩家都会有自己的得分,最高分数会成为该游戏的最佳记录.这一篇,学习下如何记录最高得分:(为了简化代码,本文采用文件方式,仅记录本机得分,明白原理后,可以将得分保存在云端或数据 ...

  3. C# 实现Remoting双向通信

    本篇文章主要介绍了C# 实现Remoting双向通信,.Net Remoting 是由客户端通过Remoting,访问通道以获得服务端对象,再通过代理解析为客户端对象来实现通信的 闲来无事想玩玩双向通 ...

  4. 使用Regsvr32.exe程序注册/注销ActiveX控件

    使用ActiveX控件之前需要注册该控件. 使用Regsvr32.exe程序可以注册.注销ActiveX控件. Regsvr32.exe程序位于Windows目录的system子目录下. 可以在cmd ...

  5. Deepin 15.4 更改为 阿里云源

    自带的 软件包源 不好用,卡顿严重,准备替换它: 方式一:deepin linux 如何更新或者更换软件源(注意:好像不起作用) 方式二:[推荐]利用 阿里云 提供的镜像快速更换本地的 yum 源 ( ...

  6. jvm理论-字节码指令

    Java虚拟机的指令由一个字节长度的.代表着某种特定操作含义的数字(称为操作码,Opcode)以及跟随其后的零至多个代表此操作所需参数(称为操作数,Operands)而构成. 基本数据类型 1.除了l ...

  7. win7&win10 右键添加 cmd

    修改注册表,位置有 3 个,重复即可: 桌面右键: HKEY_CLASSES_ROOT\Directory\Background\shell 文件夹右键:HKEY_CLASSES_ROOT\Direc ...

  8. InfluxDB源码阅读之httpd服务

    操作系统 : CentOS7.3.1611_x64 go语言版本:1.8.3 linux/amd64 InfluxDB版本:1.1.0 服务模块介绍 源码路径: github.com/influxda ...

  9. MVC5 IIS7 403错误

    问题背景 MVC5部署到IIS7中显示403错误. 解决方案 <system.webServer> → <modules> 节点下的 ApplicationInsightsWe ...

  10. Shell脚本编程(三):shell参数传递

    我们可以在执行 Shell 脚本时,向脚本传递参数,脚本内获取参数的格式为:$n.n 代表一个数字,1 为执行脚本的第一个参数,2 为执行脚本的第二个参数,以此类推…… 实例 以下实例我们向脚本传递三 ...