- 环境准备
Hostname Ip func hcy-node1 192.168.7.80 controller hcy-node2 192.168.7.81 compute hcy-node3 192.168.7.82 compute
- /etc/hostname都要改 /etc/hosts增加:
192.168.7.80 hcy-node1192.168.7.81 hcy-node2192.168.7.82 hcy-node3
- 将网卡配置成开机启动:
/etc/sysconfig/network-scripts/ifcfg-eth0中,将ONBOOT=no改为yes
- 在三个节点安装packstack: 在这里最好先设置网易的源,下载速度快
cd /etc/yum.repos.dmv CentOS-Base.repo CentOS-Base.repo.backupwget http://mirrors.163.com/.help/CentOS7-Base-163.repomv CentOS7-Base-163.repo CentOS-Base.repoyum clean all
这里可能找不到 openstack-packstack,建议直接
yum install https://repos.fedorapeople.org/repos/openstack/openstack-mitaka/rdo-release-mitaka-6.noarch.rpm
在下载完之后,安装过程中可能有什么key错误,去/etc/yum.repos.d/CentOS-Base.repo中将centos6 改成 centos7,因为我是centos7版本安装的
yum install openstack-packstack -y
- 生成answer-file:
packstack --gen-answer-file=hcloud.txt
- 修改hcloud.txt中的如下配置:
这里node2,node3上的hcloud.txt都和node1上的一样,指定node1为控制节点,node2,node3为计算节点
(1)修改计算节点和网络节点IP
[root@hcy-node1 ~]# grep HOST ./hcloud.txt CONFIG_CONTROLLER_HOST=192.168.7.80CONFIG_COMPUTE_HOSTS=192.168.7.80改为:CONFIG_COMPUTE_HOSTS=192.168.7.81,192.168.7.82CONFIG_NETWORK_HOSTS=192.168.7.80CONFIG_VCENTER_HOST=CONFIG_STORAGE_HOST=192.168.7.80改为:CONFIG_STORAGE_HOST=192.168.7.81,192.168.7.82CONFIG_SAHARA_HOST=192.168.7.80CONFIG_AMQP_HOST=192.168.7.80CONFIG_MARIADB_HOST=192.168.7.80
(2)不安装cirros镜像 另外将CONFIG_PROVISION_DEMO=y改为n 部署之前再检查一下/etc/hostname和/etc/hosts:
节点1:
[root@hcy-node1 ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.7.80 hcy-node1192.168.7.81 hcy-node2192.168.7.82 hcy-node3
节点2:
[root@hcy-node2 ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.7.80 hcy-node1192.168.7.81 hcy-node2192.168.7.82 hcy-node3
节点3:
[root@hcy-node3 ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.7.80 hcy-node1192.168.7.81 hcy-node2192.168.7.82 hcy-node3
再次检查hcloud.txt:
[root@hcy-node1 ~]# grep HOST ./hcloud.txt CONFIG_CONTROLLER_HOST=192.168.7.80CONFIG_COMPUTE_HOSTS=192.168.7.81,192.168.7.82CONFIG_NETWORK_HOSTS=192.168.7.80CONFIG_VCENTER_HOST=CONFIG_STORAGE_HOST=192.168.7.81,192.168.7.82CONFIG_SAHARA_HOST=192.168.7.80
还有如下选项:
[root@hcy-node1 ~]# grep CONFIG_PROVISION_DEMO ./hcloud.txtCONFIG_PROVISION_DEMO=n
开始部署,只在控制节点执行即可:
# yum install screen# screen packstack --answer-file=hcloud.txt
Welcome to the Packstack setup utility The installation log file is available at:/var/tmp/packstack/20160509-021808-zfHLVi/openstack-setup.log Installing:Clean Up [DONE ]Discovering ip protocol version [ DONE ]这里需要手动输入三台节点的密码,接下来一直等待直到部署完成:root@192.168.7.80'spassword: root@192.168.7.81'spassword: root@192.168.7.82'spassword:Setting up ssh keys [ DONE ] 部署成功后,出现如下信息:**** Installation completed successfully****** Additional information: *File /root/keystonerc_admin has been created on OpenStack client host192.168.7.80. To use the command line tools you need to source the file. * Toaccess the OpenStack Dashboard browse to http://192.168.7.80/dashboard .Please, find your login credentials storedin the keystonerc_admin in your home directory.
到此就部署成功了,horizon登陆密码在 /root/keystonerc_admin 的export OS_PASSWORD参数中。 source keystonerc_admin
在horizon修改admin密码的时候,(最好先把初始密码记下来,因为要先去horizon user修改)也要在这个文件中修改export OS_PASSWORD参数为修改后的admin密码
安装好的openstack是没有镜像和网络的。网络自己随便创建一个子网。 上传镜像到/mnt/image目录下,执行:openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public 到此,可以成功创建云主机
基本服务检查:
文章参考: