赞
踩
CentOS-7-x86_64-DVD-1804.iso
chinaskills_cloud_iaas.iso
xshell
节点 | 内网IP地址 | 外网IP地址 |
---|---|---|
controller | 192.168.100.10 | 192.168.200.10 |
compute | 192.168.100.20 | 192.168.200.20 |
=注意=:IP地址根据实际组网情况进行填写配置
云计算IaaS控制节点 | 云计算IaaS计算节点 |
---|---|
Keystone安全认证服务 | |
Glance镜像服务 | |
Nova计算控制服务 | Nova Compute计算服务 |
Dashboard管理界面 | |
Neutron Server网络服务 | Neutron节点网络服务 |
Cinder存储控制服务 | Cinder Volume存储服务 |
Rabbit消息服务 | |
Mysql数据库 | |
Swift 代理服务 | Swift 存储服务 |
Heat编配服务 | |
Ceilometer 监控服务 | Ceilometer监控代理 |
`说明:存储节点安装操作系统时需划分两个空白分区,作为cinder和swift存储磁盘搭建 ftp服务器作为搭建云平台的yum源。
controller控制节点虚拟硬件配置:
compute计算节点虚拟硬件配置:
设置对应的网卡模式和网络地址
通常默认情况下。VMnet0为桥接模式;VMnet1为仅主机模式;VMnet8为NAT模式。
以controller节点安装为例,compute计算节点安装步骤与此相同。`
通过xShell
远程连接工具连接【controller
】节点和【compute
】节点,即控制节点和计算节点。
配置主机名【controller】
- [root@controller ~]# hostnamectl set-hostname controller
- [root@controller ~]# bash
- [root@controller ~]# hostnamectl
- Static hostname: controller
- Icon name: computer-desktop
- Chassis: desktop
- Machine ID: 03ea1deb7ce84827b40dcc0cad6deba0
- Boot ID: 73599f8a282c461bb30037e90d8f1702
- Operating System: CentOS Linux 7 (Core)
- CPE OS Name: cpe:/o:centos:centos:7
- Kernel: Linux 3.10.0-862.el7.x86_64
- Architecture: x86-64
配置网络信息(这里只贴出控制节点了,计算节点自行修改)
- [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp8s0
- TYPE=Ethernet
- PROXY_METHOD=none
- BROWSER_ONLY=no
- BOOTPROTO=static
- DEFROUTE=yes
- NAME=enp8s0
- DEVICE=enp8s0
- ONBOOT=yes
- IPADDR=192.168.100.10
- NETMASK=255.255.255.0
- GATEWAY=192.168.100.1
- DNS1=192.168.100.1
-
- [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp9s0
- TYPE=Ethernet
- PROXY_METHOD=none
- BROWSER_ONLY=no
- BOOTPROTO=static
- DEFROUTE=yes
- NAME=enp9s0
- DEVICE=enp9s0
- ONBOOT=yes
- IPADDR=192.168.200.10
- NETMASK=255.255.255.0
- GATEWAY=192.168.200.1
- DNS1=192.168.200.1
关闭控制节点的防火墙,设置开机不启动
设置SELinux为Permissive 模式
【controller】
镜像挂载
配置【controller节点】的本地YUM源
- [root@controller yum.repos.d]#mv /etc/yum.repos.d/* /opt/
- [root@controller ~]# vi /etc/yum.repos.d/local.repo
- [root@controller ~]# cat /etc/yum.repos.d/local.repo
- [centos]
- name=centos
- baseurl=file:///opt/centos
- gpgcheck=0
- enabled=1
- [iaas]
- name=iaas
- baseurl=file:///opt/openstack/iaas-repo
- gpgcheck=0
- enabled=1
配置【compute节点】的本地YUM源,使用ftp的方式获取controller节点的YUM源
- [root@compute ~]#mv /etc/yum.repos.d/* /opt/
- [root@compute yum.repos.d]# vi /etc/yum.repos.d/ftp.repo
- [root@compute yum.repos.d]# cat /etc/yum.repos.d/ftp.repo
- [centos]
- name=centos
- baseurl=ftp://192.168.100.10/centos
- gpgcheck=0
- enable=1
- [iaas]
- name=openstack
- baseurl=ftp://192.168.100.10/openstack/iaas-repo
- gpgcheck=0
- enabled=1
- [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/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 status
- centos centos 3,971
- iaas iaas 3,232
- repolist: 7,203
- [root@controller ~]#
- 123456789101112131415161718
在controller节点上安装ftp服务
- [root@controller ~]# yum install -y vsftpd
- Loaded plugins: fastestmirror
- Loading mirror speeds from cached hostfile
- Resolving Dependencies
- --> Running transaction check
- ---> Package vsftpd.x86_64 0:3.0.2-22.el7 will be installed
- --> Finished Dependency Resolution
-
- Dependencies Resolved
-
- =======================================================================================================================================
- Package Arch Version Repository Size
- =======================================================================================================================================
- Installing:
- vsftpd x86_64 3.0.2-22.el7 centos 169 k
-
- Transaction Summary
- =======================================================================================================================================
- Install 1 Package
-
- Total download size: 169 k
- Installed size: 348 k
- Downloading packages:
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- Installing : vsftpd-3.0.2-22.el7.x86_64 1/1
- Verifying : vsftpd-3.0.2-22.el7.x86_64 1/1
-
- Installed:
- vsftpd.x86_64 0:3.0.2-22.el7
-
- Complete!
- [root@controller ~]# vi /etc/vsftpd/vsftpd.conf
- [root@controller ~]# systemctl start vsftpd;systemctl enable vsftpd
【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
- Cleaning up list of fastest mirrors
- [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 status
- centos centos 3,971
- iaas iaas 3,232
- repolist: 7,203
- [root@compute ~]# parted /dev/sdb
- (parted) mkpart swift 0G 107.4G //创建swift分区
- (parted) mkpart cinder 107.4G 214.8G //创建cinder分区
- [root@compute ~]# mkfs.xfs /dev/sdb1
- [root@compute ~]# mkfs.xfs /dev/sdb2
- [root@compute ~]# yum install -y iaas-xiandian
- Loaded plugins: fastestmirror
- Loading mirror speeds from cached hostfile
- Resolving Dependencies
- --> Running transaction check
- ---> Package iaas-xiandian.x86_64 0:2.4-2 will be installed
- --> Finished Dependency Resolution
-
- Dependencies Resolved
-
- =======================================================================================================================================
- Package Arch Version Repository Size
- =======================================================================================================================================
- Installing:
- iaas-xiandian x86_64 2.4-2 openstack 19 k
-
- Transaction Summary
- =======================================================================================================================================
- Install 1 Package
-
- Total download size: 19 k
- Installed size: 81 k
- Downloading packages:
- iaas-xiandian-2.4-2.x86_64.rpm | 19 kB 00:00:00
- Running transaction check
- Running transaction test
- Transaction test succeeded
- Running transaction
- Installing : iaas-xiandian-2.4-2.x86_64 1/1
- Verifying : iaas-xiandian-2.4-2.x86_64 1/1
-
- Installed:
- iaas-xiandian.x86_64 0:2.4-2
-
- Complete!
【controller】openrc.sh配置文件如下
一键去注释 ctrl+v选中所有行,按d
给pass加000000
:%s/PASS=/PASS=000000/g
- [root@controller ~]# vi /etc/xiandian/openrc.sh
- [root@controller ~]# cat /etc/xiandian/openrc.sh
- #--------------------system Config--------------------##
- #Controller Server Manager IP. example:x.x.x.x
- HOST_IP=192.168.100.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=192.168.100.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=192.168.100.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=192.168.100.10
-
- #External Network Interface. example:eth1
- INTERFACE_NAME=enp9s0
-
- #External Network The Physical Adapter. example:provider
- Physical_NAME=provider
-
- #First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
- minvlan=101
-
- #Last Vlan ID in VLAN RANGE for VLAN Network. example:200
- maxvlan=200
-
- #--------------------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=sda4p1
-
- #--------------------Swift Config---------------------##
- #Password for Keystore swift user. exmaple:000000
- SWIFT_PASS=000000
-
- #The NODE Object Disk for Swift. example:md126p4.
- OBJECT_DISK=sda4p2
-
- #The NODE IP for Swift Storage Network. example:x.x.x.x.
- STORAGE_LOCAL_NET_IP=192.168.100.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
- [root@controller ~]# scp /etc/xiandian/openrc.sh 192.168.100.20:/etc/xiandian/openrc.sh
- The authenticity of host '192.168.100.20 (192.168.100.20)' can't be established.
- ECDSA key fingerprint is SHA256:Gwi9FGsddkAOsnxzxoJKmgLRFE+ZHKV8HhOfsupYapA.
- ECDSA key fingerprint is MD5:e6:e9:42:34:5f:b9:57:7c:7c:db:02:60:3b:14:f3:ac.
- Are you sure you want to continue connecting (yes/no)? yes
- Warning: Permanently added '192.168.100.20' (ECDSA) to the list of known hosts.
- root@192.168.100.20's password:
- openrc.sh 100% 3812 1.5MB/s 00:00
【compute】
将从控制节点传输过来的openrc.sh配置文件进行修改,修改内容如下。
- #Tunnel Network Interface. example:x.x.x.x
- INTERFACE_IP=192.168.100.20
(1)通过脚本安装服务
【controller】
[root@controller ~]# iaas-pre-host.sh
[root@controller ~]# reboot
【compute】
[root@compute ~]# iaas-pre-host.sh
[root@compute ~]# reboot
(2)通过脚本安装数据库服务
【controller】
[root@controller ~]# iaas-install-mysql.sh
(3)通过脚本安装keystone服务
【controller】
[root@controller ~]# iaas-install-keystone.sh
(4)通过脚本安装glance服务
【controller】
[root@controller ~]# iaas-install-glance.sh
上传镜像并使用命令查询是否上传成功
- [root@controller ~]# cd /opt/openstack/images/
- [root@controller images]# ll
- total 1539152
- -rw-r--r--. 1 root root 283181056 Nov 3 11:39 CentOS_6.5_x86_64_XD.qcow2
- -rw-r--r--. 1 root root 381696512 Nov 3 11:39 CentOS7_1804.tar
- -rw-r--r--. 1 root root 400752640 Nov 3 11:39 CentOS_7.2_x86_64_XD.qcow2
- -rw-r--r--. 1 root root 510459904 Nov 3 11:39 CentOS_7.5_x86_64_XD.qcow2
- [root@controller images]# source /etc/keystone/admin-openrc.sh
- [root@controller images]# glance image-create --name "centos7.5" --disk-format qcow2 --container-format bare --progress < CentOS_7.5_x86_64_XD.qcow2
- [=============================>] 100%
- +------------------+--------------------------------------+
- | Property | Value |
- +------------------+--------------------------------------+
- | checksum | 3d3e9c954351a4b6953fd156f0c29f5c |
- | container_format | bare |
- | created_at | 2020-11-03T06:20:20Z |
- | disk_format | qcow2 |
- | id | d0122867-8ac2-444b-9c9f-556ede05e9f4 |
- | min_disk | 0 |
- | min_ram | 0 |
- | name | centos7.5 |
- | owner | 25e184cdfaf44d29b11d9b435293253f |
- | protected | False |
- | size | 510459904 |
- | status | active |
- | tags | [] |
- | updated_at | 2020-11-03T06:20:23Z |
- | virtual_size | None |
- | visibility | shared |
- +------------------+--------------------------------------+
- [root@controller images]# glance image-create --name "centos7.2" --disk-format qcow2 --container-format bare --progress < CentOS_7.2_x86_64_XD.qcow2
- [=============================>] 100%
- +------------------+--------------------------------------+
- | Property | Value |
- +------------------+--------------------------------------+
- | checksum | ea197f4c679b8e1ce34c0aa70ae2a94a |
- | container_format | bare |
- | created_at | 2020-11-03T06:20:40Z |
- | disk_format | qcow2 |
- | id | 428e4940-fc03-484f-96e2-4b8d5310e372 |
- | min_disk | 0 |
- | min_ram | 0 |
- | name | centos7.2 |
- | owner | 25e184cdfaf44d29b11d9b435293253f |
- | protected | False |
- | size | 400752640 |
- | status | active |
- | tags | [] |
- | updated_at | 2020-11-03T06:20:42Z |
- | virtual_size | None |
- | visibility | shared |
- +------------------+--------------------------------------+
- [root@controller images]# glance image-create --name "centos6.5" --disk-format qcow2 --container-format bare --progress < CentOS_6.5_x86_64_XD.qcow2
- [=============================>] 100%
- +------------------+--------------------------------------+
- | Property | Value |
- +------------------+--------------------------------------+
- | checksum | 3e565ace16066679ea363dde5411ed25 |
- | container_format | bare |
- | created_at | 2020-11-03T06:20:58Z |
- | disk_format | qcow2 |
- | id | 6a3333a2-0125-4654-bbb3-d9004ace3788 |
- | min_disk | 0 |
- | min_ram | 0 |
- | name | centos6.5 |
- | owner | 25e184cdfaf44d29b11d9b435293253f |
- | protected | False |
- | size | 283181056 |
- | status | active |
- | tags | [] |
- | updated_at | 2020-11-03T06:21:44Z |
- | virtual_size | None |
- | visibility | shared |
- +------------------+--------------------------------------+
- [root@controller images]# glance image-list
- +--------------------------------------+-----------+
- | ID | Name |
- +--------------------------------------+-----------+
- | 6a3333a2-0125-4654-bbb3-d9004ace3788 | centos6.5 |
- | 428e4940-fc03-484f-96e2-4b8d5310e372 | centos7.2 |
- | d0122867-8ac2-444b-9c9f-556ede05e9f4 | centos7.5 |
- +--------------------------------------+-----------+
- [root@controller images]# openstack image list
- +--------------------------------------+-----------+--------+
- | ID | Name | Status |
- +--------------------------------------+-----------+--------+
- | 6a3333a2-0125-4654-bbb3-d9004ace3788 | centos6.5 | active |
- | 428e4940-fc03-484f-96e2-4b8d5310e372 | centos7.2 | active |
- | d0122867-8ac2-444b-9c9f-556ede05e9f4 | centos7.5 | active |
- +--------------------------------------+-----------+--------+
(5)通过脚本安装nova服务
【controller】
[root@controller ~]# iaas-install-nova-controller.sh
【compute】
[root@compute ~]# iaas-install-nova-compute.sh
(6)通过脚本安装neutron服务
【controller】
[root@controller ~]# iaas-install-neutron-controller.sh
【compute】
[root@compute ~]# iaas-install-neutron-compute.sh
注意:使用真实服务器搭建的话,网络模式选择vlan模式;使用虚拟机搭建的话,网络模式选择flat模式。
(7)通过脚本安装dashboard服务
【controller】
[root@controller ~]# iaas-install-dashboard.sh
(8)通过脚本安装Cinder服务
【controler】
[root@controller ~]# iaas-install-cinder-controller.sh
【compute】
[root@compute ~]# iaas-install-cinder-compute.sh
(9)通过脚本安装Swift服务
【controller】
[root@controller ~]# iaas-install-swift-controller.sh
【compute】
[root@compute ~]# iaas-install-swift-compute.sh
(10)通过脚本安装heat服务
【controller】
[root@controller ~]# iaas-install-heat.sh
(11)通过脚本安装Zun服务
【controller】
[root@controller ~]# iaas-install-zun-controller.sh
【compute】
[root@compute ~]# iaas-install-zun-compute.sh
(12)通过脚本安装Ceilometer服务
【controller】
[root@controller ~]# iaas-install-ceilometer-controller.sh
【compute】
[root@compute~]# iaas-install-ceilometer-compute.sh
(13)通过脚本安装Aodh服务
【controller】
[root@controller ~]# iaas-install-aodh.sh
【controller】修改openrc.sh
把compute节点的IP地址和主机名改为controller节点的IP和主机名
在控制节点运行iaas-install-nova-compute.sh
执行过程中需要确认登录controller节点和输入controller节点root用户密码。
修改openrc.sh配置文件
- #Compute Node Manager IP. example:x.x.x.x
- HOST_IP_NODE=192.168.100.10
-
- #Compute Node hostname. example:compute
- HOST_NAME_NODE=controller
- [root@controller ~]# iaas-install-nova-compute.sh(只敲这行)
- Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
- Pseudo-terminal will not be allocated because stdin is not a terminal.
- The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.
- ECDSA key fingerprint is SHA256:rX1rbCElY3mREAkrNRYC+yob0sFY+VyQAoUxPHPZucs.
- ECDSA key fingerprint is MD5:18:11:82:84:98:8b:fd:3d:58:df:18:82:f7:a5:2e:50.
- Are you sure you want to continue connecting (yes/no)? yes
- Warning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts.
- root@192.168.1.10's password: (这里输入密码)
- +----+--------------+------------+------+---------+-------+----------------------------+
- | ID | Binary | Host | Zone | Status | State | Updated At |
- +----+--------------+------------+------+---------+-------+----------------------------+
- | 10 | nova-compute | compute | nova | enabled | up | 2020-11-03T07:34:09.000000 |
- | 11 | nova-compute | controller | nova | enabled | up | 2020-11-03T07:34:09.000000 |
- +----+--------------+------------+------+---------+-------+----------------------------+
- Found 2 cell mappings.
- Skipping cell0 since it does not contain hosts.
- Getting computes from cell 'cell1': b7e5c36e-d44d-4886-b756-7f37fe2bff2d
- Checking host mapping for compute host 'controller': a35af4bb-d210-4e8e-a2eb-1ed65fd439d9
- Creating host mapping for compute host 'controller': a35af4bb-d210-4e8e-a2eb-1ed65fd439d9
- Found 1 unmapped computes in cell: b7e5c36e-d44d-4886-b756-7f37fe2bff2d
输入http://192.168.100.10/dasboard
至此,IaaS搭建完成。
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。