IaaS 平台構建
1.關閉防火牆,禁止開機自啟
systemctl stop firewalld
systemctl disable firewalld
2.設置主機名
hostnamectl set-hostname controller
設置主機名compute
3.設置selinux,permissive
vim /etc/selinux/config
查看selinux狀態
getenforce
4.上傳鏡像(controller節點)
5.創建文件夾/opt/centos,/opt/iaas
6.掛載鏡像到兩個文件夾
mount -o loop 鏡像 opt/centos or iaas
7.使用df -h查看磁盤信息
8.在/etc/yum.repos.d創建centos.repo源文件(controller)
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1
在/etc/yum.repos.d創建centos.repo源文件(compute)
[centos]
name=centos
baseurl=ftp://192.168.31.14/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.31.14/iaas/iaas-repo
gpgcheck=0
enabled=1
9.通過配置好的本地yum源安裝vsftpd(controller)
10.修改ftp配置文件,指定匿名訪問位置(controller)
vi /etc/vsftpd/vsftpd.conf
anon_root=/opt/
11.重啟ftp服務,添加開機自啟
12.安裝iaas-xiandian
yum install iaas-xiandian -y
13.按照要求配置openrc.sh,另外,應該在HOST_IP上寫上自己的本機ip
14.使用腳本配置ntp
iaas-pre-host.sh
15.安裝opnestark(不需要執行,集成在上個腳本中)
yum -y install openstack-utils openstack-selinux python-openstackclient
16.使用腳本安裝數據庫並查看其默認搜索引擎(controller)
yum update
yum upgrade
iaas-install-mysql.sh
看你的mysql當前默認的存儲引擎:
mysql> show variables like '%storage_engine%';
17.使用腳本安裝keystone(controller)
iaas-install-keystone.sh
18.注入變量
source /etc/keystone/admin-openrc.sh
19.以已有的domain新建用戶
openstack user create --domain demo --password xiandian testuser
20.賦予用戶testuser admin權限
openstack role add --project demo(項目名) --user demo(用戶名) user(角色名)
openstack role add --project admin --user testuser admin
21.使用腳本安裝glance(controller)
iaas-install-glance.sh
安裝完成后會報錯An unexpected error prevented the server from fulfilling your request. (HTTP 500)
重啟兩個節點重新執行glance
22.創建鏡像
glance image-create --name "examimage" --disk-format qcow2 --container-format bare --progress < /opt/iaas/images/CentOS_6.5_x86_64_XD.qcow2
23.設置鏡像標簽后查詢鏡像信息
openstack image set --tag "lastone" examimage
openstack image show examimage
23.安裝nova服務(controller)
iaas-install-nova-controller.sh
24.安裝nova服務(compute)
計算節點不知道誰是控制節點,所以需要把控制節點的IP寫入到hosts文件中,之后再執行腳本
iaas-install-nova-compute.sh
25.查看nova節點使用狀況
nova host-describe compute
26.gre網絡模式(controller)
iaas-install-neutron-controller.sh
iaas-install-neutron-controller-gre.sh
27.gre網絡模式(compute)
iaas-install-neutron-compute.sh
iaas-install-neutron-compute-gre.sh
28.配置網絡
創建網絡要注意雲主機外網的網段和虛擬機的ip在同一網段,雲主機內網隨意。
創建外網
neutron net-create ext-net --provider:network_type=gre --provider:segmentation_id=1 --router:external
創建子網
neutron subnet-create ext-net (自己的內網所在網段)/24 --name ext-subnet --gateway (自己的內網網關)
創建內網
neutron net-create int-net1 --provider:network_type=gre --provider:segmentation_id=2
創建子網
neutron subnet-create int-net1 10.0.0.0/24 --name int-subnet1 --gateway 10.0.0.1
創建內網
neutron net-create int-net2 --provider:network_type=gre --provider:segmentation_id=3
創建子網
neutron subnet-create int-net2 10.0.1.0/24 --name int-subnet2 --gateway 10.0.1.1
創建路由器
neutron router-create ext-router
綁定內外網
neutron router-interface-add ext-router int-subnet1
neutron router-gateway-set ext-router ext-net
查看子網列表
neutron subnet-list
查看子網詳細信息
neutron subnet-show int-subnet1
29.安裝dashboard面板
iaas-install-dashboard.sh