openstack 离线YUM源搭建
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack 离线YUM源搭建相关的知识,希望对你有一定的参考价值。
服务器IP地址:192.168.0.213Openstack yum源的安装和部署说明书
对于企业的openstack私有云,出于安全和某些因素的考虑,有些服务器无法访问公网,导致服务器无法更新某些RPM包,同时内部常有openstack新特性开发需求,版本的维护与升级,因此非常有必要构建企业私有的openstack yum源,构建openstack yum源有两个步骤:1.同步(下载)官方的源至企业yum服务器中;2.重新创建repo并通过(apache)发布。
我们这里采用这2中方法,根据openstack官网安装手册为例。
构建本地源的步骤
1.yum源文件下载
(1)下载必要工具:
[[email protected] ]# yum -y install wget
[[email protected] ]# yum -y install createrepo
(2)下载yum源到本地:
[[email protected] ~]# mkdir -p /wget-yum
[[email protected] ~]# cd /wget-yum/
下载centos源:
[[email protected] wget-yum]# wget -S -c -r -np -L http://mirrors.sohu.com/centos/7/
下载foreman源:
[[email protected] wget-yum]# wget -S -c -r -np -L?http://yum.theforeman.org/plugins/1.5/el6/
下载epel源:
[[email protected] wget-yum]# wget -S -c -r -np -L?http://mirrors.yun-idc.com/epel/7/
下载puppetlabs源:
[[email protected] wget-yum]# wget -S -c -r -np -L?https://yum.puppetlabs.com/el/7
下载openstack源:
[[email protected] wget-yum]# https://repos.fedorapeople.org/repos/openstack/openstack-ocata/
(3)删除不需要的软件包和文件:
[[email protected] wget-yum]# find ./ -name index.html* | xargs rm -rf
[[email protected] wget-yum]# find ./ -name i386 | xargs rm -rf
(4)调整目录结构:
[[email protected] wget-yum]# mkdir foreman
[[email protected] wget-yum]# mv yum.theforeman.org/plugins/ foreman/
[[email protected] wget-yum]# mv yum.theforeman.org/releases/ foreman/
[[email protected] wget-yum]# rm -rf yum.theforeman.org/
[[email protected] wget-yum]# mv mirrors.yun-idc.com/epel/ ./
[[email protected] wget-yum]# rm -rf mirrors.yun-idc.com/
[[email protected] wget-yum]# mkdir puppetlabs
[[email protected] wget-yum]# mv yum.puppetlabs.com/el/ puppetlabs/
[[email protected] wget-yum]# rm -rf yum.puppetlabs.com/
[[email protected] wget-yum]# mv repos.fedorapeople.org/repos/openstack/ ./
[[email protected] wget-yum]# rm -rf repos.fedorapeople.org/
2.http安装和配置:
[[email protected] ]# yum -y install httpd
[[email protected] ]# /etc/init.d/httpd start
[[email protected] ]# cd /var/www/html/
[[email protected] html]# ln -s /wget-yum/ /var/www/html/
[[email protected] html]# createrepo /var/www/html/
测试
用浏览器进行访问http://192.168.0.213/wget-yum/ 由于我这边用的内网服务器为192.168.0.213
3.编写repo文件
[[email protected] html]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# vi centos.repo
[openstack]
name=CentOS-openstack
baseurl=file:///wget-yum/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[[email protected] yum.repos.d]# yum clean all 清除yum缓存
[[email protected] yum.repos.d]# yum repolist 重新获取yum源的列表
Loaded plugins: fastestmirror, refresh-packagekit
Determining fastest mirrors
openstack | 3.0 kB 00:00 ...
openstack/primary_db | 54 MB 00:06 ...
repo id repo name status
openstack CentOS-openstack 86,519
repolist: 86,519
客户端配置yum源
1.配置repo文件
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# vi centos.repo
[openstack]
name=CentOS-openstack
baseurl=http://192.168.0.213/wget-yum/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
~
[[email protected] yum.repos.d]# yum clean all 清除yum缓存
[[email protected] yum.repos.d]# yum repolist 重新获取yum源的数据
以上是关于openstack 离线YUM源搭建的主要内容,如果未能解决你的问题,请参考以下文章