最近部门要搞云计算,正好有两台服务器空闲,让我安装一下openstack作为测试环境,在此将记录一下安装过程,遇到了一些坑,也一一解决了,采用的是RDO的方式安装,openstack的版本选择ocata版本,RDO方式相对来说比手动安装容易点
测试环境服务器配置:
DELL 2950 Intel CPU:Xeon E5405 2.0G1 32G内存 2个网卡 220G硬盘
DELL 2950 Intel CPU:Xeon E5440 2.8G2 32G内存 2个网卡 500G硬盘
安装规划:
控制节点: DELL 2950 Intel CPU:Xeon E5405 2.0G1 32G内存 2个网卡 220G硬盘
计算节点: DELL 2950 Intel CPU:Xeon E5440 2.8G2 32G内存 2个网卡 500G硬盘
ip规划:
控制节点: 外网ip 192.168.207.52 内网 10.10.10.3
计算节点: 外网ip 192.168.207.77 内网 10.10.10.4
安装步骤:
1.安装cenos7操作系统(设置u盘启动,通过读取u盘镜像安装)
2.两台主机设置静态ip:
分别修改两台主机/etc/sysconfig/network-scripts目录下的ifcfg-eno1和ifcfg-eno2




3.执行systemctl restart network重启network,执行ip add show看是否修改成功,ping 一下www.baidu.com看能否ping通。
4.两台主机设置ssh通信免密码登录,并定义下hostname,修改下/etc/hosts文件。
5.两台主机执行yum install ntpd安装ntp服务,执行ntpdate 1.cn.pool.ntp.org同步下网络时间,并执行systemctl start ntpd启动ntp服务(也可以定义一台服务器为ntp服务器,其余主机定期同步这台ntp服务器的时间)。
6.两台主机设置下/etc/enviroment,添加LANG=en_US.utf-8
LC_ALL=en_US.utf-8。

7.两台主机执行如下操作
$ sudo systemctl disable firewalld
$ sudo systemctl stop firewalld
$ sudo systemctl disable NetworkManager
$ sudo systemctl stop NetworkManager
$ sudo systemctl enable network
$ sudo systemctl start network
8.两台主机执行sudo yum install -y centos-release-openstack-ocata安装openstack-ocata源
9.两台主机执行 sudo yum update -y操作更新下yum源
10.控制节点执行$ sudo yum install -y openstack-packstack命令安装packstack
11.控制节点执行packstack --gen-answer-file lipeng_answers.txt命令生成answer文件
12.修改answer文件中的CONFIG_COMPUTE_HOSTS配置为192.168.207.77和CONFIG_NEUTRON_ML2_VNI_RANGES配置为1:1000
13.控制节点执行packstack --answer-file=lipeng_answers.txt命令开始安装openstack
14.当屏幕出现Installation completed successfully时说明openstack安装成功

安装过程中遇到的问题以及解决方案
1.一般会遇到网络问题,如下图

类似这种情况重新执行一下packstack --answer-file=lipeng_answers.txt,还不行的话就修改下两台主机的CentOS-OpenStack-ocata.repo源

还有一些网络问题的话可以安装yum install python-pip 并设置一下豆瓣的pip源
在root目录下创建.pip目录,新建一个pip.conf文件,添加如下内容:
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
timeout=6000
2.报puppet脚本执行的错误,Error while evaluating a Function call,'versioncmp' parameter 'a' expects a String value...如下图

这个原因是没有执行yum update -y更新yum源。
3.报编码问题的错误UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 20: ordinal not in range(128),如下图

这个问题是因为编码不一致,如果安装操作系统的时候安装的是中文的话会出现这种问题,需要修改一下/etc/locale.conf为LANG="en_US.UTF-8",执行下locale命令看是否一致,同时重启下服务器,要不然不会生效。
网友评论