杨校老师课堂之云计算私有云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 更改为 disabled
    SELINUX=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 --allinone
    Installing:
    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.pp
    192.168.101.166_controller.pp:                        [ DONE ]           
    # 应用网络节点(测试时可能需要较长时间,可以考虑先开一局王者~)
    Applying 192.168.101.166_network.pp
    192.168.101.166_network.pp:                           [ DONE ]        
    # 应用计算节点(测试时可能需要较长时间,可以考虑先开一局王者~)
    Applying 192.168.101.166_compute.pp
    192.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 416 2022 anaconda-ks.cfg
    -rw-------. 1 root root   373 416 10:52 keystonerc_admin
    -rw-------. 1 root root   318 416 10:52 keystonerc_demo
    -rw-------. 1 root root 51769 416 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=admin
    export OS_USER_DOMAIN_NAME=Default
    export OS_PROJECT_DOMAIN_NAME=Default
    export 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 更改为 disabled
    SELINUX=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 --allinone
    Installing:
    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.pp
    192.168.101.166_controller.pp:                        [ DONE ]           
    # 应用网络节点(测试时可能需要较长时间,可以考虑先开一局王者~)
    Applying 192.168.101.166_network.pp
    192.168.101.166_network.pp:                           [ DONE ]        
    # 应用计算节点(测试时可能需要较长时间,可以考虑先开一局王者~)
    Applying 192.168.101.166_compute.pp
    192.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 416 2022 anaconda-ks.cfg
    -rw-------. 1 root root   373 416 10:52 keystonerc_admin
    -rw-------. 1 root root   318 416 10:52 keystonerc_demo
    -rw-------. 1 root root 51769 416 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=admin
    export OS_USER_DOMAIN_NAME=Default
    export OS_PROJECT_DOMAIN_NAME=Default
    export OS_IDENTITY_API_VERSION=3
    
    

  • 打开浏览器,访问http://192.168.6.168

在这里插入图片描述

  • 输入用户名和密码

用户名: admin
密码: ce0612847f2442ad

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

杨校

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值