两台虚拟机,compute和controller
computer的节点,内存4G,硬盘50G,网络要在虚拟机设置这里添加一个网络适配器,第一个是主机模式192.168.10.0,第二个是NAT模式192.168.20.0,再进入网络编辑器里编辑网段
先讲如何增加第二块网卡:
首先进入编辑里,选择添加,比如我这里是VMnet2,添加之后选择主机模式,按要求配置好网段。
再进入虚拟机设置页面,添加第二个网络适配器,需要主机模式的网卡,请选择自定义,在下拉框里选择刚才设置的网络即可
连接CRT进行操作
在computer节点更改ip,注意eno16777736是主机模式的网卡,另一个33554976是NAT模式,如果需要配置,也写一遍如下的配置文件,但是BOOTPROTO可以用dhcp,自动获取ip
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=79178a90-ca7d-409b-9ddb-fa46112721bd
DEVICE=eno16777736
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR=192.168.10.20
netmask=255.255.255.0
DNS1=192.168.1.1
DNS2=8.8.8.8
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno33554976
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNX=yes
PEERROUTES=yes
IPV4_FAILIRE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=yes
NAME=eno33554976
DEVICE=eno33554976
ONBOOT=yes
IPADDR=192.168.20.10
NETMASK=255.255.255.0
DNS1=8.8.8.8
restart的网络,下面这句在VM里面运行,之后再ip a查一下是否更改成功,由于此后要用到ftp,还可以尝试ping一下网络看是否联通
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (120.232.145.144) 56(84) bytes of data.
64 bytes from 120.232.145.144: icmp_seq=1 ttl=128 time=14.8 ms
64 bytes from 120.232.145.144: icmp_seq=2 ttl=128 time=14.2 ms
如上表示联通了,可以按ctrl+z退出
[root@localhost ~]#systemctl restart network
重新连接CRT
control节点一样的操作,将IP改成192.168.10.10
然后在控制节点的root目录下上传两个镜像文件,
[root@localhost ~]# mkdir /opt/centos7.2
[root@localhost ~]# mkdir /opt/iaas
[root@localhost ~]# mount /root/CentOS-7-x86_64-DVD-1511.iso /opt/centos7.2
mount: /dev/loop0 is write-protected, mounting read-only
[root@localhost ~]# mount /root/XianDian-IaaS-v2.2.iso /opt/iaas/
mount: /dev/loop1 is write-protected, mounting read-only
配置挂载文件
[root@localhost ~]# rm -rf /etc/yum.repos.d/CentOS- *
[root@localhost ~]# cat > /etc/yum.repos.d/local.repo <<EOF
下面每个>提示符后面输入对应一行内容
[centos]
name=centos
baseurl=file:///opt/centos7.2
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1
EOF
以上是另一种编写方法,用vi也是一样的,文件内容一样
在计算节点输入,也就是不在计算节点上传两个镜像包,而是利用ftp从控制节点下载
[root@localhost ~]# rm -rf /etc/yum.repos.d/CentOS- *
[root@localhost ~]# cat > /etc/yum.repos.d/local.repo <<EOF
[centos]
name=centos
baseurl=ftp://192.168.10.10/centos7.2
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.10.10/iaas/iaas-repo
gpgcheck=0
enabled=1
EOF
在控制节点,安装ftp服务
[root@localhost ~]# yum install vsftpd -y
出现complete以后,修改配置文件(这里如果报错,没有镜像源,则回去检查修改ip的地方dns配置了没有,如果是报错another app,运行下句
rm -f /var/run/yum.pid
)
Complete!
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf
anon_root=/opt
[root@localhost ~]# systemctl restart vsftpd
两边的节点关闭防火墙
[root@localhost ~]# setenforce 0
[root@localhost ~]# iptables -F
[root@localhost ~]# iptables -X
[root@localhost ~]# iptables -Z
[root@localhost ~]# systemctl stop firewalld
这里讲一下可能出现的问题,首先,网络出现问题,ip a检查看看,如果ip不见了,去检查一下两个网卡各自的配置文件,再重启网络
systemctl restart network;如果关防火墙的时候关不了,提示Failed to stop firewalld.service: Unit firewalld.service not loaded.,需要重新安装yum install firewalld
两边节点安装xiandian,命令一样,计算节点可能会稍慢,一样以Complete!为准
[root@localhost ~]# yum install iaas-xiandian -y
两边节点修改配置文件,注意INTERFACE_NAME=eno33554976是第二块网卡的名字
[root@localhost ~]# cat /etc/xiandian/openrc.sh
##--------------------system Config--------------------##
##Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.10.10
##Controller Server hostname. example:controller
HOST_NAME=controller
##Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.10.20
##Compute Node hostname. example:compute
HOST_NAME_NODE=compute
##--------------------Rabbit Config ------------------##
##user for rabbit. example:openstack
RABBIT_USER=openstack
##Password for rabbit user .example:000000
RABBIT_PASS=000000
##--------------------MySQL Config---------------------##
##Password for MySQL root user . exmaple:000000
DB_PASS=000000
##--------------------Keystone Config------------------##
##Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000
##Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000
##--------------------Glance Config--------------------##
##Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000
##Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000
##--------------------Nova Config----------------------##
##Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000
##Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000
##--------------------Neturon Config-------------------##
##Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000
##Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000
##metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000
##External Network Interface. example:eth1
INTERFACE_NAME=eno33554976
##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
#minvlan=
##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
#maxvlan=
##--------------------Cinder Config--------------------##
##Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000
##Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000
##Cinder Block Disk. example:md126p3
BLOCK_DISK=sda3
##--------------------Trove Config--------------------##
##Password for Mysql Trove User. exmaple:000000
TROVE_DBPASS=000000
##Password for Keystore Trove User. exmaple:000000
TROVE_PASS=000000
##--------------------Swift Config---------------------##
##Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000
##The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sda4
##The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.10.20
##--------------------Heat Config----------------------##
##Password for Mysql heat user. exmaple:000000
#HEAT_DBPASS=
##Password for Keystore heat user. exmaple:000000
#HEAT_PASS=
##--------------------Ceilometer Config----------------##
##Password for Mysql ceilometer user. exmaple:000000
#CEILOMETER_DBPASS=
##Password for Keystore ceilometer user. exmaple:000000
#CEILOMETER_PASS=
##--------------------AODH Config----------------##
##Password for Mysql AODH user. exmaple:000000
#AODH_DBPASS=
##Password for Keystore AODH user. exmaple:000000
#AODH_PASS=
开始安装openstack平台
控制节点和计算节点各自安装iaas
[root@localhost ~]# iaas-pre-host.sh
出现这句Please Reboot or Reconnect the terminal ,重新连接,如果成功,主机名会自动更改。
安装数据库
[root@controller ~]# iaas-install-mysql.sh
安装keystone认证服务
[root@controller ~]# iaas-install-keystone.sh
安装Glance镜像服务
[root@controller ~]# iaas-install-glance.sh
安装Nova计算服务
[root@controller ~]# iaas-install-nova-controller.sh
安装Neutron网络服务
[root@controller ~]# iaas-install-neutron-controller.sh
[root@controller ~]# iaas-install-neutron-controller-gre.sh
安装Dashboard服务
[root@controller ~]# iaas-install-dashboard.sh
安装Cinder块存储服务
[root@controller ~]# iaas-install-cinder-controller.sh
安装Swift对象存储服务
[root@controller ~]# iaas-install-swift-controller.sh