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. ‘百度杯’十月场web ---login

    首先一看的题,既然是是web类的,就要查看源码,一看,最先有一行注释,估摸着是用户名和密码 果然登录上去了,显示一段乱码,源码也没有什么东西, 那就抓一次包吧 发现响应头里边有个show:0的响应,而 ...

  2. python之封装与扩展性

    1.封装与扩展性 封装在于明确区分内外,使得类实现者可以修改封装内的东西而不影响外部调用的代码:而外部使用者只知道一个接口(函数),只要接口(函数)名,参数不变,使用者的代码永远无需改变.这就提供了一 ...

  3. pygame 笔记-4 代码封装&发射子弹

    继续之前的内容,随着游戏的内容越来越复杂,有必要把代码优化一下,可以参考OOP的做法,把人物类抽象出来,弄成一个单独的类,这们便于代码维护,同时我们给小人儿,加个发射子弹的功能,代码如下:(看上去略长 ...

  4. SharePoint Excel Service - Couldn't Open the Workbook.

    Error meesage: "Couldn't Open the Workbook. Wow, That's a big workbook. Unfortunately, we can't ...

  5. java-Freemarker TemplateLoader实现模版

    TemplateLoader的实现 作为一个模板文件加载的抽象,自然不能限制模板来自何方,在FreeMarker中由几个主要的实现类来体现,这些TemplateLoader是可以独立使用的,Webap ...

  6. echarts中tooltip提示框位置控制

    关键代码: position: function(point, params, dom, rect, size) { //其中point为当前鼠标的位置,size中有两个属性:viewSize和con ...

  7. 一步步教你轻松学支持向量机SVM算法之案例篇2

    一步步教你轻松学支持向量机SVM算法之案例篇2 (白宁超 2018年10月22日10:09:07) 摘要:支持向量机即SVM(Support Vector Machine) ,是一种监督学习算法,属于 ...

  8. glog日志库使用笔记

    日志能方便地诊断程序原因.统计程序运行数据,是大型软件系统必不可少的组件之一.glog 是google的开源日志系统,相比较log4系列的日志系统,它更加轻巧灵活. 在Github上下载glog,解压 ...

  9. Android获取通讯录并上传(包含通讯录加密)

    好久没更新文章了,近期在做通讯录上传,把它分享出来,送给需要的朋友. 写了一个通讯录工具类,直接放代码吧,关键位置通过注释来解释. 这个工具类包含通讯录获取,加密,然后上传操作.看不懂的可以留言 im ...

  10. SQL DML 数据操纵语句

    前言 DML(Data Manipulation Language)语句:数据操纵语句,用于添加.删除.更新和查询数据库记录,并检查数据完整性.常用的语句关键字主要包括 insert.delete.u ...