如何一步步使用国内yum源一键安装openstack-ocata版本基于centos7

写在前面的话,在网上看了一个国外的一键安装视频,我也照着做,结果出现很多错误,现在把坑解决了,照着做肯定能安装成功的

环境

  virtualhost 下的centos7

配置

  双网卡 一个10网段,nat通信用 一个192网段 和宿主机通信使用

  2c 这个测试部署的话,不是强要求,我部署后CPU也就占20%

  5.4G内存 我的宿主机也就8G内存 配到这个数据已经很卡了 再次PS 

  安装完成要占用约5G左右的内存

部署

  由于我的是nat 网络,所以先配置双网卡,否则部署后,不能正常访问openstack的管理网页,因为需要修改到这个参数,这个到后面再说

  双网卡配置略过,自己在网上查吧很多的。实在找不到就留言

正式开始

  1-设置yum源01_setyum.sh(非常重要,虽然出了openstack 专用的yum源,但那不是咱们能用的),我做成了脚本样子的,直接拷贝拿去用,镜像源用的是清华源,因为阿里源有的包跳转到404的链接还在上面,后面一键安装的时候就会坑哭你,亲测。。都是泪。脚本正文如下

复制代码

#创建备份路径
mkdir -p /etc/yum.repos.d/bak_tmp/
#移走当前的所有源,为什么?因为一键安装会乱跳,跳到不能用的就报错,然后你就安装失败
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak_tmp/
#创建yum 文件
touch /etc/yum.repos.d/centos-tuna.repo
#导入镜像内容到yum文件中
cat   >>/etc/yum.repos.d/centos-tuna.repo << EOF
#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-\$releasever - Base
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/os/\$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=os
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-\$releasever - Updates
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/updates/\$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=updates
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[centosplus]
name=CentOS-\$releasever - Plus
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/centosplus/\$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=\$releasever&arch=\$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[cloud]
name=CentOS-\$releasever - Cloud
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/cloud/\$basearch/openstack-ocata/
enabled=1
gpgcheck=0
[paas]
name=CentOS-\$releasever - paas
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/paas/\$basearch/openshift-origin13/
enabled=1
gpgcheck=0
[kvm]
name=CentOS-\$releasever - kvm
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/\$releasever/virt/\$basearch/kvm-common/
enabled=1
gpgcheck=0

EOF
#清除yum缓存
yum clean all
#重新做yum 缓存
yum makecache

复制代码

  2-配置环境 02_setenv.sh

复制代码

cat >/etc/environment <<EOF
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
EOF

systemctl disable firewalld
systemctl stop firewalld
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network
systemctl restart network

复制代码

  3-安装一键部署包 03_set_openstack-packstack.sh

复制代码

yum -y update
yum install -y openstack-packstack
#报错无法安装openstack-selinux 没有相关依赖包,通过增加paas 镜像源解决
yum install -y openstack-selinux
yum -y install wget
#--提示缺少libLibev.so.4()(64bit)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install libev
#有可能yum源混乱了,所以重新执行yibian
mkdir -p /etc/yum.repos.d/bak_tmp_1
mv /etc/yum.repos.d/*.repo /etc/yum.repo.d/bak_tmp_1/
mv /etc/yum.repos.d/bak_tmp_1/centos-tuna.repo /etc/yum.repos.d/
yum clean all
yum makecache

#解决python-werkzeug 不在cloud源,在virt里面,所以找不到此包
wget -O /root/python-werkzeug-0.9.1-1.el7.noarch.rpm https://mirrors.tuna.tsinghua.edu.cn/centos/7/virt/x86_64/ovirt-4.3/common/python-werkzeug-0.9.1-1.el7.noarch.rpm
rpm -ivh /root/python-werkzeug-0.9.1-1.el7.noarch.rpm

复制代码

  执行到这里才完成一点点,为了保险。重新进入到yum文件夹

cd /etc/yum.repos.d/
ll
#确认当前只有一个centos-tuna.repo

  确认完成执行最后一步安装操作,也就是出错最多的操作

#-d 表示debug 日志级别
packstack --allinone -d

  安装成功的样例如下

  比较长,就不展开了 

 View Code

  失败的案例如下

 View Code

  部署成功后验证登陆,ip 为你自己虚拟机的ip,主要看

more /etc/httpd/15-hrion*.conf #记不清全拼了,找到这个文件
增加一个serveralias 192.168.x。x #宿主机和虚拟机能正常通信的IP
#重启
systemctl restart httpd

  千辛万苦就是要看到这么一个图。爬坑也是花时间的,现在总结在这里。祝你们测试部署成功

    登陆的账号密码在

--密码文件在root用户目录下
cat /root/keystonerc_admin
复制OS_USERNAME=admin
     OS_PASSWORD=XXXX

  结束语

  这次的部署获益良多,要感谢阿里云yum源的一个功能,就是在页面可以支持搜索包,这样我就知道这个包在哪个文件夹下,也是感谢清华yum源的给力,通过在阿里yum搜索到的包,去清华yum源找到对应的页面 ,一步步配置到第一步设置的yum中。才能正常的安装这个一键安装包。否则在vpn的龟速下是很难正常完成一键部署的安装,这个一键部署的openstack 主要还是用来体会一下openstack是一个怎么样使用的。自己装一次,比看10次文档还印象深刻。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值