Openstack 概念:由美国国家航空局开发,是一个开源的云计算管理平台项目,由几个主要的组件组合起来工作,OpenStack通过各种互补的服务提供了基础设施即服务(IaaS)的解决方案,每个服务提供API以进行集成。
openstack主要组成组件:horizon、keystone、Nova、glance、quantum、cinder、swift。
horizon:用于管理OpenStack各种服务,基于web的管理接口。
keystone:为其他服务提供认证和授权集中身份管理,支持多种身份认证方式,SSO认证
neutron:一种软件定义网络服务,可创建网络,子网、路由器、浮动IP实现虚拟机交换机路由器,可在项目中创建VPN。
cinder:为虚拟机管理储存卷提供永久的块储存,通过快照备份。
glance:扮演虚拟机镜像注册的角色,这些镜像模板可以新建新的虚拟机。
Nova:在节点上用于管理虚拟机的服务,一种分布式服务,能够与keystone交互实现。
openstack安装时需要使用外部DNS来解析域名。
vim /etc/resolv.conf
nameserver 8.8.8.8 设置真机的DNS
安装实例:
安装配置 (repo: 192.168.1.100)
准备 yum 仓库
[root@localhost ~]# mkdir -p /var/ftp/{centos-1804,extras,openstack}
[root@localhost ~]# cd /var/iso/
[root@localhost ~]# mount -t iso9660 -o ro,loop CentOS-7.5-1804.iso /var/ftp/centos-1804
[root@localhost ~]# mount -t iso9660 -o ro,loop RHEL7-extras.iso /var/ftp/extras
[root@localhost ~]# mount -t iso9660 -o ro,loop RHEL7OSP-10.iso /var/ftp/openstack
[root@localhost ~]# yum install -y vsftpd
[root@localhost ~]# systemctl enable vsftpd
[root@localhost ~]# systemctl start vsftpd
配置 yum 源 (所有机器)
[root@localhost ~]# cat /etc/yum.repos.d/local.repo
[BaseOS]
name=CentOS-$releasever – BaseOS
baseurl=”ftp://192.168.1.100/centos-1804″
enabled=1
gpgcheck=0
[local_extras]
name=CentOS-$releasever – extras
baseurl=”ftp://192.168.1.100/extras”
enabled=1
gpgcheck=0
[openstack]
name=CentOS-$releasever – Openstack
baseurl=”ftp://192.168.1.100/openstack/rhel-7-server-openstack-10-rpms”
enabled=1
gpgcheck=0
[openstack-devel]
name=CentOS-$releasever – Openstack-devel
baseurl=”ftp://192.168.1.100/openstack/rhel-7-server-openstack-10-devtools-rpms”
enabled=1
gpgcheck=0
[root@localhost ~]# yum repolist
BaseOS CentOS-7 – BaseOS 9,911
local_extras CentOS-7 – extras 76
openstack CentOS-7 – Openstack 680
openstack-devel CentOS-7 – Openstack-devel 3
repolist: 10,670
准备时间服务器 (repo: 192.168.1.100)
[root@localhost ~]# yum install -y chrony
编辑 /etc/chrony.conf
添加 bindacqaddress 0.0.0.0
allow 0/0
[root@localhost ~]# systemctl enable chronyd
[root@localhost ~]# systemctl start chronyd
[root@localhost ~]# ss -ltun
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 127.0.0.1:323 *:*
udp UNCONN 0 0 *:123 *:*
配置 openstack,nova01,nova02
1 修改 DNS 配置,必须删除所有 search 开头的行
[root@openstack ~]# cat /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
nameserver 114.114.114.114
2 配置 /etc/hosts 保证主机名能 ping 通
[root@openstack ~]# vim /etc/hosts
# ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.10 openstack
192.168.1.11 nova01
192.168.1.12 nova02
3 添加时间同步服务器,修改 /etc/chrony.conf
添加 server 192.168.1.100 iburst
重启服务
[root@openstack ~]# systemctl restart chronyd
验证
[root@openstack ~]# chronyc sources -v
===============================================================================
^* 192.168.1.100 4 6 17 17 +1420ns[ +26us] +/- 15ms
4 配置 yum 源,指向上午配置的 yum 仓库
参考上午的配置文件
验证结果
[root@openstack ~]# yum makecache
[root@openstack ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
BaseOS CentOS-7 – BaseOS 9,911
local_extras CentOS-7 – extras 76
openstack CentOS-7 – Openstack 680
openstack-devel CentOS-7 – Openstack-devel 3
repolist: 10,670
虚拟化平台安装(nova01,nova02)
[root@localhost ~]# yum install qemu-kvm libvirt-daemon libvirt-daemon-driver-qemu libvirt-client python-setuptools
[root@localhost ~]# systemctl enable libvirtd
[root@localhost ~]# systemctl start libvirtd
packstack 安装(openstack)
[root@localhost ~]# yum install openstack-packstack python-setuptools
创建应答文件 (openstack)
[root@localhost ~]# packstack –gen-answer-file=answer.ini
修改配置文件 answer.ini
42: CONFIG_SWIFT_INSTALL=n //存储对象组件
45: CONFIG_CEILOMETER_INSTALL=n //计费模块
49: CONFIG_AODH_INSTALL=n //计费模块
53: CONFIG_GNOCCHI_INSTALL=n //计费模块
75: CONFIG_NTP_SERVERS=192.168.1.100 //时间服务器
98: CONFIG_COMPUTE_HOSTS=192.168.1.11 //计算节点IP
102: CONFIG_NETWORK_HOSTS=192.168.1.10,192.168.1.11 //网络节点IP
333: CONFIG_KEYSTONE_ADMIN_PW=a //管理员密码
840: CONFIG_NEUTRON_ML2_TYPE_DRIVERS=flat,vxlan //支持协议
910: CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=physnet1:br-ex //网桥设备
921: CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0 //出口网卡
1179: CONFIG_PROVISION_DEMO=n //演示模块
安装 openstack
[root@localhost ~]# packstack –answer-file=answer.ini
apache 配置文件 bug 修改
编辑 /etc/httpd/conf.d/15-horizon_vhost.conf
… …
WSGIProcessGroup apache
WSGIApplicationGroup %{GLOBAL} <—添加这行
WSGIScriptAlias /dashboard “/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi”
</VirtualHost>
重启服务 systemctl reload httpd
通过浏览器打开页面查看验证 http://192.168.1.10