缓存网络yum源为本地yum源,可以统一版本,防止网络yum源升级,导致后期其他机器安装的软件版本和服务器版本不一致。
编辑yum配置文件,设置keepcache=1使用缓存,设置cachedir缓存路径
[root@centos60 ~]# cp /etc/yum.conf /etc/yum.conf.bak
[root@centos60 ~]# vim /etc/yum.conf

开始yum安装软件
[root@centos60 ~]# yum -y install ceph ceph-radosgw
创建目录用来保存rpm安装文件
[root@centos60 ~]# mkdir -p /opt/ceph-10
把yum下载的rpm文件都拷贝到保存安装 rpm目录
[root@centos60 ~]# find /var/cache/yum/ -name *.rpm -type f -exec cp {} /opt/ceph-10/ \;
安装创建yum源索引工具
[root@centos60 ~]# yum -y install createrepo
创建yum源索引
[root@centos60 ~]# createrepo -v /opt/ceph-10/
vim /etc/yum.repos.d/ceph.repo
[ceph]
name=ceph
baseurl=file:///opt/ceph-10
enable=1
gpgcheck=0
复制离线 yum 仓库至 其他机器
[root@centos60 ~]# scp -r /opt/ceph-10/ root@centos70:/opt/
[root@centos60 ~]# scp -r /opt/ceph-10/ root@centos80:/opt/
[root@centos60 ~]# scp -r /opt/ceph-10/ root@centos90:/opt/
[root@centos60 ~]# scp /etc/yum.repos.d/ceph.repo root@centos70:/etc/yum.repos.d/
[root@centos60 ~]# scp /etc/yum.repos.d/ceph.repo root@centos80:/etc/yum.repos.d/
[root@centos60 ~]# scp /etc/yum.repos.d/ceph.repo root@centos90:/etc/yum.repos.d/
[root@centos60 ~]# yum clean all #清空yum缓存,会清空/var/cache/yum/base/packages目录下的rpm包
[root@centos60 ~]# yum makecache #刷新yum缓存