7、上传所需镜像文件并进行挂载测试
【controller】
[root@controller ~]# ll total 8075368 -rw-------. 1 root root 1381 Oct 18 14:22 anaconda-ks.cfg -rw-r--r--. 1 root root 4470079488 Nov 14 17:53 CentOS-7-x86_64-DVD-1804.iso -rw-r--r--. 1 root root 3799093248 Nov 14 18:00 chinaskills_cloud_iaas.iso [root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt/ mount: /dev/loop0 is write-protected, mounting read-only [root@controller ~]# cp -rf /mnt/* /opt/centos/ [root@controller ~]# umount /mnt/ [root@controller ~]# mount -o loop chinaskills_cloud_iaas.iso /mnt/ mount: /dev/loop0 is write-protected, mounting read-only [root@controller ~]# cp -rf /mnt/* /opt/openstack/ [root@controller ~]# umount /mnt/
测试镜像是否设置成功
[root@controller ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: centos openstack Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos [root@controller ~]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors centos | 3.6 kB 00:00:00 openstack | 2.9 kB 00:00:00 (1/3): centos/primary_db | 3.1 MB 00:00:00 (2/3): centos/group_gz | 166 kB 00:00:00 (3/3): openstack/primary_db | 1.4 MB 00:00:00 repo id repo name statuscentos centos 3,971 openstack openstack 3,232 repolist: 7,203 [root@controller ~]#
安装http服务
[root@controller ~]# yum install -y httpd [root@controller ~]# systemctl start httpd && systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@controller ~]# ln -s /opt/ /var/www/html/ [root@controller ~]# cd /var/www/html/ [root@controller html]# ll total 0 lrwxrwxrwx 1 root root 5 Nov 15 02:30 opt -> /opt/ [root@controller html]#
【compute】
[root@compute ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: centos openstack Cleaning up everything Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos [root@compute ~]# yum repolist Loaded plugins: fastestmirror Determining fastest mirrors centos | 3.6 kB 00:00:00 openstack | 2.9 kB 00:00:00 (1/3): centos/group_gz | 166 kB 00:00:00 (2/3): openstack/primary_db | 1.4 MB 00:00:00 (3/3): centos/primary_db | 3.1 MB 00:00:00 repo id repo name statuscentos centos 3,971 openstack openstack 3,232 repolist: 7,203 [root@compute ~]#
8、YUM源安装并修改opensrc.sh配置文件
【controller】
[root@controller ~]# yum install -y iaas-xiandian
[root@controller ~]# vi /etc/xiandian/openrc.sh
在命令模式下执行此命令:%s/^.//g用于删除#
在命令模式下执行此命令:%s/PASS=/PASS=000000/g用于编写PASS
在编辑模式下,按q
进入到命令模式
[root@controller ~]# cat /etc/xiandian/openrc.sh #--------------------system Config--------------------## #Controller Server Manager IP. example:x.x.x.x HOST_IP=172.16.10.10 #Controller HOST Password. example:000000 HOST_PASS=000000 #Controller Server hostname. example:controller HOST_NAME=controller #Compute Node Manager IP. example:x.x.x.x HOST_IP_NODE=172.16.10.20 #Compute HOST Password. example:000000 HOST_PASS_NODE=000000 #Compute Node hostname. example:compute HOST_NAME_NODE=compute #--------------------Chrony Config-------------------## #Controller network segment IP. example:x.x.0.0/16(x.x.x.0/24) network_segment_IP=172.16.10.0/24 #--------------------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 #Tunnel Network Interface. example:x.x.x.x INTERFACE_IP=172.16.10.10 #External Network Interface. example:eth1 INTERFACE_NAME=ens34 #External Network The Physical Adapter. example:provider Physical_NAME=provider #First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101 minvlan=1 #Last Vlan ID in VLAN RANGE for VLAN Network. example:200 maxvlan=2000 #--------------------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=sdb #--------------------Swift Config---------------------## #Password for Keystore swift user. exmaple:000000 SWIFT_PASS=000000 #The NODE Object Disk for Swift. example:md126p4. OBJECT_DISK=sdc #The NODE IP for Swift Storage Network. example:x.x.x.x. STORAGE_LOCAL_NET_IP=172.16.10.20 #--------------------Heat Config----------------------## #Password for Mysql heat user. exmaple:000000 HEAT_DBPASS=000000 #Password for Keystore heat user. exmaple:000000 HEAT_PASS=000000 #--------------------Zun Config-----------------------## #Password for Mysql Zun user. exmaple:000000 ZUN_DBPASS=000000 #Password for Keystore Zun user. exmaple:000000 ZUN_PASS=000000 #Password for Mysql Kuryr user. exmaple:000000 KURYR_DBPASS=000000 #Password for Keystore Kuryr user. exmaple:000000 KURYR_PASS=000000 #--------------------Ceilometer Config----------------## #Password for Gnocchi ceilometer user. exmaple:000000 CEILOMETER_DBPASS=000000 #Password for Keystore ceilometer user. exmaple:000000 CEILOMETER_PASS=000000 #--------------------AODH Config----------------## #Password for Mysql AODH user. exmaple:000000 AODH_DBPASS=000000 #Password for Keystore AODH user. exmaple:000000 AODH_PASS=000000 #--------------------Barbican Config----------------## #Password for Mysql Barbican user. exmaple:000000 BARBICAN_DBPASS=000000 #Password for Keystore Barbican user. exmaple:000000 BARBICAN_PASS=000000
将controller配置好的openrc.sh通过scp传输至compute相应的文件夹内
[root@controller ~]# scp /etc/xiandian/openrc.sh 172.16.19.20:/etc/xiandian/openrc.sh ssh: connect to host 172.16.19.20 port 22: No route to host lost connection [root@controller ~]# scp /etc/xiandian/openrc.sh 172.16.10.20:/etc/xiandian/openrc.sh The authenticity of host '172.16.10.20 (172.16.10.20)' can't be established. ECDSA key fingerprint is SHA256:lDjv6aHOHM9bz6LzO/u3DT4AMGxP56xSw5VGt9YVco0. ECDSA key fingerprint is MD5:11:8a:16:1d:cb:78:26:35:c7:87:1b:81:d3:fa:e2:fb. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '172.16.10.20' (ECDSA) to the list of known hosts. root@172.16.10.20's password: openrc.sh 100% 3807 1.8MB/s 00:00 [root@controller ~]#
【compute】
[root@compute ~]# vi /etc/xiandian/openrc.sh [root@compute ~]# cat /etc/xiandian/openrc.sh #--------------------system Config--------------------## #Controller Server Manager IP. example:x.x.x.x HOST_IP=172.16.10.10 #Controller HOST Password. example:000000 HOST_PASS=000000 #Controller Server hostname. example:controller HOST_NAME=controller #Compute Node Manager IP. example:x.x.x.x HOST_IP_NODE=172.16.10.20 #Compute HOST Password. example:000000 HOST_PASS_NODE=000000 #Compute Node hostname. example:compute HOST_NAME_NODE=compute #--------------------Chrony Config-------------------## #Controller network segment IP. example:x.x.0.0/16(x.x.x.0/24) network_segment_IP=172.16.10.0/24 #--------------------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 #Tunnel Network Interface. example:x.x.x.x INTERFACE_IP=172.16.10.20 #External Network Interface. example:eth1 INTERFACE_NAME=ens34 #External Network The Physical Adapter. example:provider Physical_NAME=provider #First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101 minvlan=1 #Last Vlan ID in VLAN RANGE for VLAN Network. example:200 maxvlan=2000 #--------------------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=sdb #--------------------Swift Config---------------------## #Password for Keystore swift user. exmaple:000000 SWIFT_PASS=000000 #The NODE Object Disk for Swift. example:md126p4. OBJECT_DISK=sdc #The NODE IP for Swift Storage Network. example:x.x.x.x. STORAGE_LOCAL_NET_IP=172.16.10.20 #--------------------Heat Config----------------------## #Password for Mysql heat user. exmaple:000000 HEAT_DBPASS=000000 #Password for Keystore heat user. exmaple:000000 HEAT_PASS=000000 #--------------------Zun Config-----------------------## #Password for Mysql Zun user. exmaple:000000 ZUN_DBPASS=000000 #Password for Keystore Zun user. exmaple:000000 ZUN_PASS=000000 #Password for Mysql Kuryr user. exmaple:000000 KURYR_DBPASS=000000 #Password for Keystore Kuryr user. exmaple:000000 KURYR_PASS=000000 #--------------------Ceilometer Config----------------## #Password for Gnocchi ceilometer user. exmaple:000000 CEILOMETER_DBPASS=000000 #Password for Keystore ceilometer user. exmaple:000000 CEILOMETER_PASS=000000 #--------------------AODH Config----------------## #Password for Mysql AODH user. exmaple:000000 AODH_DBPASS=000000 #Password for Keystore AODH user. exmaple:000000 AODH_PASS=000000 #--------------------Barbican Config----------------## #Password for Mysql Barbican user. exmaple:000000 BARBICAN_DBPASS=000000 #Password for Keystore Barbican user. exmaple:000000 BARBICAN_PASS=000000
9、执行相关服务部署脚本
【controller| compute】
# iaas-pre-host.sh # reboot
等到controller、compute两个节点同时创建完成后再同时重启centos
Please Reboot or Reconnect the terminal当同时在两个节点看到此提示,即可重启。
【controller】
安装数据库服务
[root@controller ~]# iaas-install-mysql.sh
安装认证服务
[root@controller ~]# iaas-install-keystone.sh
验证认证服务
[root@controller ~]# source /etc/keystone/admin-openrc.sh [root@controller ~]# openstack user list +----------------------------------+-------+ | ID | Name | +----------------------------------+-------+ | cac753e558c747338116623b8de8de42 | admin | | e6a51892258b45c79c28ae7e10127a80 | demo | +----------------------------------+-------+
安装镜像服务
[root@controller ~]# iaas-install-glance.sh
验证镜像服务
[root@controller ~]# openstack user list
±---------------------------------±-------+
| ID | Name |
±---------------------------------±-------+
| 7c33302f61cf4b85b09f6cf4d91598e5 | glance |
| cac753e558c747338116623b8de8de42 | admin |
| e6a51892258b45c79c28ae7e10127a80 | demo |
±---------------------------------±-------+
上传测试镜像
[root@controller ~]# source /etc/keystone/admin-openrc.sh [root@controller ~]# glance image-create --name cirros --disk-format qcow2 --container bare --progress < cirros-0.5.1-x86_64-disk.img [=============================>] 100% +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | 1d3062cd89af34e419f7100277f38b2b | | container_format | bare | | created_at | 2020-11-15T04:06:20Z | | disk_format | qcow2 | | id | 1fea3777-e5ed-46b7-9dae-2d9a3554bb99 | | min_disk | 0 | | min_ram | 0 | | name | cirros | | owner | b80d6a7fd05641aea59268fc30775ed5 | | protected | False | | size | 16338944 | | status | active | | tags | [] | | updated_at | 2020-11-15T04:06:21Z | | virtual_size | None | | visibility | shared | +------------------+--------------------------------------+ [root@controller ~]# openstack image list +--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ | 1fea3777-e5ed-46b7-9dae-2d9a3554bb99 | cirros | active | +--------------------------------------+--------+--------+
安装计算服务
[root@controller ~]# iaas-install-nova-controller.sh
验证计算服务
[root@controller ~]# openstack user list +----------------------------------+-----------+ | ID | Name | +----------------------------------+-----------+ | 7c33302f61cf4b85b09f6cf4d91598e5 | glance | | 91b70a465e494ad1b438b167d4db6d2a | placement | | 958fd8e1ba0e427fbab6e149f0a3ea1b | nova | | cac753e558c747338116623b8de8de42 | admin | | e6a51892258b45c79c28ae7e10127a80 | demo | +----------------------------------+-----------+
【compute】
安装计算服务
注意:等待controller控制节点计算服务脚本执行安装完毕后,再执行compute节点的安装。后面的安装亦是如此。
[root@compute ~]# iaas-install-nova-compute.sh
【controller】
安装网络服务
[root@controller ~]# iaas-install-neutron-controller.sh
【compute】
安装网络服务
[root@compute ~]# iaas-install-neutron-compute.sh
【controller】
安装Dashboard服务
[root@controller ~]# iaas-install-dashboard.sh
10、登录Dashboard管理控制平台
至此。基础部分搭建完成!