杨校老师课堂之云计算私有云OpenStack框架快速搭建-详细搭建过程
更换镜像源为阿里云
-
1 先安装
wget
yum install -y wget
-
2.打开
https://developer.aliyun.com/mirror/
访问阿里镜像资源网站,找到centOS
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo或者curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
-
3.运行清除缓存
[root@openstack ~]# yum clean all
-
4.运行生成缓存
[root@openstack ~]# yum makecache
准备工作
-
5.配置
IP
与主机名#配置IP地址[root@openstack ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33#更新网卡操作[root@openstack ~]# systemctl restart network#配置主机名为openstack[root@openstack ~]# hostnamectl set-hostname openstack
-
6.关闭防火墙和核心防护、取消开机自动运行
#关闭防火墙[root@openstack ~]# systemctl stop firewalld#取消开机自动运行防火墙[root@openstack ~]# systemctl disable firewalld#关闭核心防护[root@openstack ~]# setenforce 0#取消开机自动运行核心防护[root@openstack ~]# vi /etc/sysconfig/selinux# 在selinux 文件内 ,将 SELINUX = enforce 更改为 disabledSELINUX=disabled
-
7.关闭网络管理工具、取消开机自动运行
#关闭网络管理工具[root@openstack ~]# systemctl stop NetworkManager#取消开机自动运行网络管理工具[root@openstack ~]# systemctl disable NetworkManager
-
8.确保时间同步
# 安装ntpdate服务[root@openstack ~]# yum install ntpdate -y# 同步阿里云时间[root@openstack ~]# ntpdate ntp.aliyun.com >> / var/log/ntpdate.log# 设置开机自动运行[root@openstack ~]# systemctl enable crond
-
9.重启
# 可以省略、跳过!# reboot
部署OpenStack
-
1.安装PackStack服务软件
# 在线更新openstack的镜像文件[root@openstack ~]# yum -y install centos-release-openstack-train
-
2.安装Packstack软件
# 在线更新openstack-packstack的软件安装包[root@openstack ~]# yum -y install openstack-packstack
-
3.运行Packstack,以“All-in-One”方式安装OpenStack Train版本
[root@openstack ~]# packstack --allinoneInstalling:Clean Up [ DONE ]Discovering ip protocol version [ DONE ]# 设置SSH密钥Setting up ssh keys [ DONE ]# 准备服务器Preparing servers [ DONE ]# 预安装Puppet并探测主机详情Pre installing Puppet and discovering hosts' details [ DONE ]# 准备预装的项目Preparing pre-install entries [ DONE ]# 设置证书Setting up CACERT [ DONE ]# 准备AMQP(高级消息队列协议)项目Preparing AMQP entries [ DONE ]# 准备MariaDB(代替MySQL)数据库项目Preparing MariaDB entries[ DONE ]# 修正Keystone LDAP参数Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]# 准备Keystone(身份服务)项目Preparing Keystone entries [ DONE ]# 准备Glance(镜像服务)项目Preparing Glance entries [ DONE ]# 检查Cinder(卷存储服务)是否有卷Checking if the Cinder server has a cinder-volumes vg[ DONE ]# 准备Cinder(卷存储服务)项目Preparing Cinder entries [ DONE ]# 准备Nova API(Nova接口)项目Preparing Nova API entries [ DONE ]# 为Nova迁移创建SSH密钥Creating ssh keys for Nova migration [ DONE ]Gathering ssh host keys for Nova migration [ DONE ]Gathering ssh host keys for Nova migration [ DONE ]# 准备Nova(计算服务)项目Preparing Nova Compute entries [ DONE ]Preparing Nova Scheduler entries[ DONE ]Preparing Nova VNC Proxy entries[ DONE ]Preparing OpenStack Network-related Nova entries [ DONE ]Preparing Nova Common entries [ DONE ]# 准备Neutron(网络)项目Preparing Neutron API entries [ DONE ]Preparing Neutron L3 entries [ DONE ]Preparing Neutron L2 Agent entries [ DONE ]Preparing Neutron DHCP Agent entries [ DONE ]Preparing Neutron Metering Agent entries [ DONE ]# 检查NetworkManager是否启用并运行Checking if NetworkManager is enabled and running [ DONE ]# 准备OpenStack客户端项目Preparing OpenStack Client entries [ DONE ]# 准备Horizon仪表板项目Preparing Horizon entries[ DONE ]# 准备Swift(对象存储服务)项目Preparing Swift builder entries [ DONE ]Preparing Swift proxy entries [ DONE ]Preparing Swift storage entries [ DONE ]# 准备Gnocchi(用于计量的时间序列数据库服务器)项目Preparing Gnocchi entries[ DONE ]# 准备Redis(用于计量的数据结构服务器)项目Preparing Redis entries [ DONE ]# 准备Ceilometer(计量服务)项目Preparing Ceilometer entries [ DONE ]# 准备Aodh(警告)项目Preparing Aodh entries [ DONE ]# 准备Puppet模块和配置清单Preparing Puppet manifests [ DONE ]Copying Puppet modules and manifests [ DONE ]# 应用控制节点(测试时可能需要较长时间,可以考虑先开一局王者~)Applying 192.168.101.166_controller.pp192.168.101.166_controller.pp: [ DONE ] # 应用网络节点(测试时可能需要较长时间,可以考虑先开一局王者~)Applying 192.168.101.166_network.pp192.168.101.166_network.pp: [ DONE ] # 应用计算节点(测试时可能需要较长时间,可以考虑先开一局王者~)Applying 192.168.101.166_compute.pp192.168.101.166_compute.pp: [ DONE ] # 应用Puppet配置清单Applying Puppet manifests[ DONE ]Finalizing [ DONE ]# 安装成功,完成应用并给出其他提示信息 **** Installation completed successfully ******Additional information:# 提示网络已采用OVN Neutron后端 * Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS or FWaaS services. Geneve will be used as the encapsulation method for tenant networks# 执行命令产生的应答文件 * A new answerfile was created in: /root/packstack-answers-20220415-231639.txt# 未安装时间同步,需要确认CentOS当前的系统时间是否正确,如果不正确,则需要修改 * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.# 在用户主目录下产生keystonerc_admin文件,要使用命令行工具需要使用它作为授权凭据 * File /root/keystonerc_admin has been created on OpenStack client host 192.168.101.166. To use the command line tools you need to source the file.# 访问OpenStack Dashboard(Web访问界面),请使用keystonerc_admin中的登录凭据 * To access the OpenStack Dashboard browse to http://192.168.101.166/dashboard .Please, find your login credentials stored in the keystonerc_admin in your home directory.# 安装日志文件名及其路径 * The installation log file is available at: /var/tmp/packstack/20220415-231639-wZEI2M/ openstack-setup.log# Puppet配置清单路径 * The generated manifests are available at: /var/tmp/packstack/20220415-231639- wZEI2M/manifests# 在命令行中执行以下命令,获取OpenStack主要组件Nova的当前安装版本。
访问
-
切换到根路径
[root@openstack log]# cd[root@openstack ~]# ll总用量 64-rw-------. 1 root root 1317 4月 16 2022 anaconda-ks.cfg-rw-------. 1 root root 373 4月 16 10:52 keystonerc_admin-rw-------. 1 root root 318 4月 16 10:52 keystonerc_demo-rw-------. 1 root root 51769 4月 16 10:41 packstack-answers-20220416-104111.txt
-
查看
keystonerc_admin
文件unset OS_SERVICE_TOKEN# 系统用户名![2022-04-16_112200](C:\Users\Administrator\Desktop\2022-04-16_112200.png)是admin export OS_USERNAME=admin # 系统密码是 ce0612847f2442ad export OS_PASSWORD='ce0612847f2442ad' export OS_REGION_NAME=RegionOne # 系统访问入口是 http://192.168.6.168 export OS_AUTH_URL=http://192.168.6.168:5000/v3 export PS1='[\u@\h \W(keystone_admin)]\$ ' export OS_PROJECT_NAME=adminexport OS_USER_DOMAIN_NAME=Defaultexport OS_PROJECT_DOMAIN_NAME=Defaultexport OS_IDENTITY_API_VERSION=3
-
打开浏览器,访问
http://192.168.6.168
### 更换镜像源为阿里云
-
1 先安装
wget
yum install -y wget
-
2.打开
https://developer.aliyun.com/mirror/
访问阿里镜像资源网站,找到centOS
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo或者curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
-
3.运行清除缓存
[root@openstack ~]# yum clean all
-
4.运行生成缓存
[root@openstack ~]# yum makecache
准备工作
-
5.配置
IP
与主机名#配置IP地址[root@openstack ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33#更新网卡操作[root@openstack ~]# systemctl restart network#配置主机名为openstack[root@openstack ~]# hostnamectl set-hostname openstack
-
6.关闭防火墙和核心防护、取消开机自动运行
#关闭防火墙[root@openstack ~]# systemctl stop firewalld#取消开机自动运行防火墙[root@openstack ~]# systemctl disable firewalld#关闭核心防护[root@openstack ~]# setenforce 0#取消开机自动运行核心防护[root@openstack ~]# vi /etc/sysconfig/selinux# 在selinux 文件内 ,将 SELINUX = enforce 更改为 disabledSELINUX=disabled
-
7.关闭网络管理工具、取消开机自动运行
#关闭网络管理工具[root@openstack ~]# systemctl stop NetworkManager#取消开机自动运行网络管理工具[root@openstack ~]# systemctl disable NetworkManager
-
8.确保时间同步
# 安装ntpdate服务[root@openstack ~]# yum install ntpdate -y# 同步阿里云时间[root@openstack ~]# ntpdate ntp.aliyun.com >> / var/log/ntpdate.log# 设置开机自动运行[root@openstack ~]# systemctl enable crond
-
9.重启
# 可以省略、跳过!# reboot
部署OpenStack
-
1.安装PackStack服务软件
# 在线更新openstack的镜像文件[root@openstack ~]# yum -y install centos-release-openstack-train
-
2.安装Packstack软件
# 在线更新openstack-packstack的软件安装包[root@openstack ~]# yum -y install openstack-packstack
-
3.运行Packstack,以“All-in-One”方式安装OpenStack Train版本
[root@openstack ~]# packstack --allinoneInstalling:Clean Up [ DONE ]Discovering ip protocol version [ DONE ]# 设置SSH密钥Setting up ssh keys [ DONE ]# 准备服务器Preparing servers [ DONE ]# 预安装Puppet并探测主机详情Pre installing Puppet and discovering hosts' details [ DONE ]# 准备预装的项目Preparing pre-install entries [ DONE ]# 设置证书Setting up CACERT [ DONE ]# 准备AMQP(高级消息队列协议)项目Preparing AMQP entries [ DONE ]# 准备MariaDB(代替MySQL)数据库项目Preparing MariaDB entries[ DONE ]# 修正Keystone LDAP参数Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]# 准备Keystone(身份服务)项目Preparing Keystone entries [ DONE ]# 准备Glance(镜像服务)项目Preparing Glance entries [ DONE ]# 检查Cinder(卷存储服务)是否有卷Checking if the Cinder server has a cinder-volumes vg[ DONE ]# 准备Cinder(卷存储服务)项目Preparing Cinder entries [ DONE ]# 准备Nova API(Nova接口)项目Preparing Nova API entries [ DONE ]# 为Nova迁移创建SSH密钥Creating ssh keys for Nova migration [ DONE ]Gathering ssh host keys for Nova migration [ DONE ]Gathering ssh host keys for Nova migration [ DONE ]# 准备Nova(计算服务)项目Preparing Nova Compute entries [ DONE ]Preparing Nova Scheduler entries[ DONE ]Preparing Nova VNC Proxy entries[ DONE ]Preparing OpenStack Network-related Nova entries [ DONE ]Preparing Nova Common entries [ DONE ]# 准备Neutron(网络)项目Preparing Neutron API entries [ DONE ]Preparing Neutron L3 entries [ DONE ]Preparing Neutron L2 Agent entries [ DONE ]Preparing Neutron DHCP Agent entries [ DONE ]Preparing Neutron Metering Agent entries [ DONE ]# 检查NetworkManager是否启用并运行Checking if NetworkManager is enabled and running [ DONE ]# 准备OpenStack客户端项目Preparing OpenStack Client entries [ DONE ]# 准备Horizon仪表板项目Preparing Horizon entries[ DONE ]# 准备Swift(对象存储服务)项目Preparing Swift builder entries [ DONE ]Preparing Swift proxy entries [ DONE ]Preparing Swift storage entries [ DONE ]# 准备Gnocchi(用于计量的时间序列数据库服务器)项目Preparing Gnocchi entries[ DONE ]# 准备Redis(用于计量的数据结构服务器)项目Preparing Redis entries [ DONE ]# 准备Ceilometer(计量服务)项目Preparing Ceilometer entries [ DONE ]# 准备Aodh(警告)项目Preparing Aodh entries [ DONE ]# 准备Puppet模块和配置清单Preparing Puppet manifests [ DONE ]Copying Puppet modules and manifests [ DONE ]# 应用控制节点(测试时可能需要较长时间,可以考虑先开一局王者~)Applying 192.168.101.166_controller.pp192.168.101.166_controller.pp: [ DONE ] # 应用网络节点(测试时可能需要较长时间,可以考虑先开一局王者~)Applying 192.168.101.166_network.pp192.168.101.166_network.pp: [ DONE ] # 应用计算节点(测试时可能需要较长时间,可以考虑先开一局王者~)Applying 192.168.101.166_compute.pp192.168.101.166_compute.pp: [ DONE ] # 应用Puppet配置清单Applying Puppet manifests[ DONE ]Finalizing [ DONE ]# 安装成功,完成应用并给出其他提示信息 **** Installation completed successfully ******Additional information:# 提示网络已采用OVN Neutron后端 * Parameter CONFIG_NEUTRON_L2_AGENT: You have chosen OVN Neutron backend. Note that this backend does not support the VPNaaS or FWaaS services. Geneve will be used as the encapsulation method for tenant networks# 执行命令产生的应答文件 * A new answerfile was created in: /root/packstack-answers-20220415-231639.txt# 未安装时间同步,需要确认CentOS当前的系统时间是否正确,如果不正确,则需要修改 * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.# 在用户主目录下产生keystonerc_admin文件,要使用命令行工具需要使用它作为授权凭据 * File /root/keystonerc_admin has been created on OpenStack client host 192.168.101.166. To use the command line tools you need to source the file.# 访问OpenStack Dashboard(Web访问界面),请使用keystonerc_admin中的登录凭据 * To access the OpenStack Dashboard browse to http://192.168.101.166/dashboard .Please, find your login credentials stored in the keystonerc_admin in your home directory.# 安装日志文件名及其路径 * The installation log file is available at: /var/tmp/packstack/20220415-231639-wZEI2M/ openstack-setup.log# Puppet配置清单路径 * The generated manifests are available at: /var/tmp/packstack/20220415-231639- wZEI2M/manifests# 在命令行中执行以下命令,获取OpenStack主要组件Nova的当前安装版本。
访问
-
切换到根路径
[root@openstack log]# cd[root@openstack ~]# ll总用量 64-rw-------. 1 root root 1317 4月 16 2022 anaconda-ks.cfg-rw-------. 1 root root 373 4月 16 10:52 keystonerc_admin-rw-------. 1 root root 318 4月 16 10:52 keystonerc_demo-rw-------. 1 root root 51769 4月 16 10:41 packstack-answers-20220416-104111.txt
-
查看
keystonerc_admin
文件unset OS_SERVICE_TOKEN# 系统用户名![2022-04-16_112200](C:\Users\Administrator\Desktop\2022-04-16_112200.png)是admin export OS_USERNAME=admin # 系统密码是 ce0612847f2442ad export OS_PASSWORD='ce0612847f2442ad' export OS_REGION_NAME=RegionOne # 系统访问入口是 http://192.168.6.168 export OS_AUTH_URL=http://192.168.6.168:5000/v3 export PS1='[\u@\h \W(keystone_admin)]\$ ' export OS_PROJECT_NAME=adminexport OS_USER_DOMAIN_NAME=Defaultexport OS_PROJECT_DOMAIN_NAME=Defaultexport OS_IDENTITY_API_VERSION=3
-
打开浏览器,访问
http://192.168.6.168
- 输入用户名和密码
用户名: admin
密码: ce0612847f2442ad