centos7.6搭建OpenStack搭建安装部署ocata版本(带dashboard界面)+LBaas插件

 

 

准备centos7.6,OpenStack-ocata

1、换源

安装OpenStack时,各个版本不同 api和插件也不同,a-z命名的版本中已经t版本了应该x版本(xena),学习的速度赶不上更新的速度了都,就离谱。。不多说,干。

此次安装采用的是packstack一键安装,(如果从头开始安装,源的问题会很慢还有各种组件安装和配置文件的配置)。

packstack安装时如果不指定yum源,则只能下载最新的几个版本,我当时t,u,v三个版本

1.1,查看源地址

由图可知centos7.6版本还支持安装OpenStack-ocata版本,图中地址:

http://mirrors.oit.uci.edu/centos/7.6.1810/cloud/x86_64/

1.2,修改yum源

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo
[root@localhost yum.repos.d]# mkdir bk
[root@localhost yum.repos.d]# mv ./C* bk/
[root@localhost yum.repos.d]# ls
bk
[root@localhost yum.repos.d]# 

先把官方源备份走,然后创建自己的源文件并修改

代码段

[root@localhost yum.repos.d]# vim /etc/yum.repos.d/openstack-ocata.repo
[root@localhost yum.repos.d]# cat /etc/yum.repos.d/openstack-ocata.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[centos_76_1810]
name=CentOS-$releasever - Base
baseurl=http://10.5.1.100/pxe/os/centos_76_1810/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[openstack-ocata]
name=openstack-ocata
baseurl=http://mirrors.oit.uci.edu/centos/7.6.1810/cloud/x86_64/openstack-ocata
gpgcheck=0

[extras67]
name=extras67
gpgcheck=0
baseurl=http://mirrors.oit.uci.edu/centos/7.6.1810/extras/x86_64/

[virt67]
name=virt67
gpgcheck=0
baseurl=http://mirrors.oit.uci.edu/centos/7.6.1810/virt/x86_64/kvm-common/
[root@localhost yum.repos.d]#

清理源缓存

[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: centos_76_1810 extras67 openstack-ocata virt67
[root@localhost yum.repos.d]#yum update -y

2、安装

控制节点+网络节点:一台机器

计算节点:一台机器

在所有物理机上都执行(单机只在一台机器运行即控制节点)

关闭NetworkManager服务

[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
[root@localhost ~]# systemctl stop NetworkManager
[root@localhost ~]# systemctl enable network
network.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig network on
[root@localhost ~]# systemctl start network

安装deltarpm

[root@localhost ~]# yum install deltarpm -y

关闭selinux

[root@localhost ~]# cat /etc/selinux/config | grep SELINUX=
# SELINUX= can take one of these three values:
SELINUX=disabled

设置主机名分别设置控制节点,计算节点等的主机名

hostnamectl set-hostname control.myopenstack.com

hostnamectl set-hostname compute.myopenstack.com

hostnamectl status

hostnamectl status --static

hostnamectl status --transient

hostnamectl status --pretty

在控制节点执行

安装packstack

yum install -y openstack-packstack

确保/etc/yum.repos.d/下只有自己创建的yum源文件。

生成应答文件:(如果不要自定义配置及lbaas,请生成文件后直接运行第二步安装)

packstack --gen-answer-file=a.txt

编辑应答文件

去掉不必要的安装内容:

[root@cortrol ~]# cat a.txt |grep =n
CONFIG_MANILA_INSTALL=n
CONFIG_SWIFT_INSTALL=n
CONFIG_CEILOMETER_INSTALL=n
CONFIG_AODH_INSTALL=n
CONFIG_GNOCCHI_INSTALL=n
CONFIG_PANKO_INSTALL=n
CONFIG_SAHARA_INSTALL=n
CONFIG_HEAT_INSTALL=n
CONFIG_MAGNUM_INSTALL=n
CONFIG_TROVE_INSTALL=n
CONFIG_IRONIC_INSTALL=n
CONFIG_NAGIOS_INSTALL=n
CONFIG_DEBUG_MODE=n
CONFIG_VMWARE_BACKEND=n
CONFIG_UNSUPPORTED=n
CONFIG_USE_SUBNETS=n
CONFIG_USE_EPEL=n
CONFIG_ENABLE_RDO_TESTING=n
CONFIG_AMQP_ENABLE_SSL=n
CONFIG_AMQP_ENABLE_AUTH=n
CONFIG_KEYSTONE_LDAP_USER_ENABLED_INVERT=n
CONFIG_KEYSTONE_LDAP_USER_ALLOW_CREATE=n
CONFIG_KEYSTONE_LDAP_USER_ALLOW_UPDATE=n
CONFIG_KEYSTONE_LDAP_USER_ALLOW_DELETE=n
CONFIG_KEYSTONE_LDAP_GROUP_ALLOW_CREATE=n
CONFIG_KEYSTONE_LDAP_GROUP_ALLOW_UPDATE=n
CONFIG_KEYSTONE_LDAP_GROUP_ALLOW_DELETE=n
CONFIG_KEYSTONE_LDAP_USE_TLS=n
CONFIG_CINDER_VOLUMES_CREATE=n
CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL=nfs
CONFIG_NOVA_COMPUTE_MANAGER=nova.compute.manager.ComputeManager
CONFIG_NEUTRON_FWAAS=n
CONFIG_NEUTRON_VPNAAS=n
CONFIG_MANILA_NETWORK_TYPE=neutron
CONFIG_HORIZON_SSL=n
CONFIG_HEAT_CLOUDWATCH_INSTALL=n
CONFIG_PROVISION_DEMO=n
CONFIG_PROVISION_TEMPEST=n
CONFIG_RUN_TEMPEST=n
CONFIG_PROVISION_OVS_BRIDGE=n

保留项(lbaas v2配置)

CONFIG_LBAAS_INSTALL=y

修改项

#admin的密码

CONFIG_KEYSTONE_ADMIN_USERNAME=admin
CONFIG_KEYSTONE_ADMIN_PW=123456

#需要使用到网络类型,以逗号隔开,根据需要填写。可选项['local','flat','vlan','gre','vxlan']

CONFIG_NEUTRON_ML2_TYPE_DRIVERS=vxlan,flat

# 物理网络与bridge的映射关系

CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=extnet:br-ex

#bridge与接口的映射关系

CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eth0 #eth0为网卡名

#compute计算网络使用的bridge

CONFIG_NEUTRON_OVS_BRIDGES_COMPUTE=br-ex

#外部网络使用的物理网络

CONFIG_NEUTRON_OVS_EXTERNAL_PHYSNET=extnet

安装前配置lvm

创建nova-instances VG(可选)

找到一个没有使用的分区或者磁盘,例如sdb,创建pv,使用刚创建pv创建nova-instances VG

[root@control ~]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.
[root@control ~]# vgcreate nova-instances /dev/sdb
  Volume group "nova-instances" successfully created

找到一个没有使用的分区或者磁盘,例如sdc,创建pv,使用刚创建pv创建cinder-volumes VG

[root@control ~]# pvcreate /dev/sdc
  Physical volume "/dev/sdc" successfully created.
[root@control ~]# vgcreate cinder-volumes /dev/sdc
  Volume group "cinder-volumes" successfully created

开始安装

以下为正常安装过程,如遇到error,请看我对应error博客的处理方式

最好在console下执行,不要ssh里面执行,因为可能安装过程会断网

error报错

 

 

 

[root@cortrol ~]# packstack --answer-file=a.txt
Welcome to the Packstack setup utility

The installation log file is available at: /var/tmp/packstack/20210331-135225-Qy6JUl/openstack-setup.log

Installing:
Clean Up                                             [ DONE ]
Discovering ip protocol version                      [ DONE ]
Setting up ssh keys                                  [ DONE ]
Preparing servers                                    [ DONE ]
Pre installing Puppet and discovering hosts' details [ DONE ]
Preparing pre-install entries                        [ DONE ]
Setting up CACERT                                    [ DONE ]
Preparing AMQP entries                               [ DONE ]
Preparing MariaDB entries                            [ DONE ]
Fixing Keystone LDAP config parameters to be undef if empty[ DONE ]
Preparing Keystone entries                           [ DONE ]
Preparing Glance entries                             [ DONE ]
Checking if the Cinder server has a cinder-volumes vg[ DONE ]
Preparing Cinder entries                             [ DONE ]
Preparing Nova API entries                           [ DONE ]
Creating ssh keys for Nova migration                 [ DONE ]
Gathering ssh host keys for Nova migration           [ DONE ]
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 ]
Preparing Neutron LBaaS Agent entries                [ DONE ]
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 ]
Checking if NetworkManager is enabled and running    [ DONE ]
Preparing OpenStack Client entries                   [ DONE ]
Preparing Horizon entries                            [ DONE ]
Preparing Puppet manifests                           [ DONE ]
Copying Puppet modules and manifests                 [ DONE ]
Applying 10.5.115.1_controller.pp
10.5.115.1_controller.pp:                            [ DONE ]       
Applying 10.5.115.1_network.pp
10.5.115.1_network.pp:                               [ DONE ]    
Applying 10.5.115.1_compute.pp
10.5.115.1_compute.pp:                               [ DONE ]    
Applying Puppet manifests                            [ DONE ]
Finalizing                                           [ DONE ]

 **** Installation completed successfully ******

Additional information:
 * Time synchronization installation was skipped. Please note that unsynchronized time on server instances might be problem for some OpenStack components.
 * File /root/keystonerc_admin has been created on OpenStack client host 10.5.115.1. To use the command line tools you need to source the file.
 * To access the OpenStack Dashboard browse to http://10.5.115.1/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/20210331-135225-Qy6JUl/openstack-setup.log
 * The generated manifests are available at: /var/tmp/packstack/20210331-135225-Qy6JUl/manifests

3、安装完成后修改

修改Nova配置文件

vim /etc/nova/nova.conf

#配置Nova后端使用lvm

#images_type后端存储使用lvm,默认为default,使用/var/lib/nova/instances目录

images_type=lvm

#images_volume_group后端使用lvm的vg名字,vg必须存在

images_volume_group=nova-instances

配置nova删除虚拟机instance时不对删除的磁盘进行置零操作

#volume_clear删除instance时是否擦除volume,none标识不进行操作,zero标识擦除置零操作

volume_clear=none

配置允许resize到相同的节点

#allow_resize_to_same_host是否允许resize到原来的host主机,true标识允许

allow_resize_to_same_host=True

配置resize不需要确认

#resize是是否需要确认操作,0表示需要手动确认,1表示自动确认

resize_confirm_window=1

主机启动后回复虚拟机状态

# 主机启动后回复虚拟机状态,true表示自动恢复,false启动后不回复

resume_guests_state_on_host_boot=true

修改cinder配置

vim /etc/cinder/cinder.conf

配置cinder删除volume时是否擦除volume,none表示不进行操作,zero表示擦除置零操作

volume_clear=none

重启服务

systemctl | grep openstack | awk '{print $1}' |xargs systemctl restart

systemctl | grep neutron | awk '{print $1}' |xargs systemctl restart

4、dashboard配置lbaas v2

1、git下载neutron-lbaas-dashboard源码并切换到对应分支,如果没有git,需要先安装git

yum install -y git

git clone https://git.openstack.org/openstack/neutron-lbaas-dashboard

cd neutron-lbaas-dashboard

git checkout stable/ocata

2、安装neutron-lbaas-dashboard

python setup.py install

3、把_1481_project_ng_loadbalancersv2_panel.py拷贝到openstack-dashboard/openstack_dashboard/local/enabled/

cp build/lib/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py /usr/share/openstack-dashboard/openstack_dashboard/local/enabled/

4、修改 /etc/openstack-dashboard/local_settings,把'enable_lb': False,修改为'enable_lb': True

[root@localhost mnt(keystone_admin)]# vim /etc/openstack-dashboard/local_settings

    # profile_support can be turned on if needed.
    #'profile_support': None,
    #'profile_support': 'cisco',

    # Set which provider network types are supported. Only the network types
    # in this list will be available to choose from when creating a network.
    # Network types include local, flat, vlan, gre, and vxlan.
    #'supported_provider_types': ['*'],

    # Set which VNIC types are supported for port binding. Only the VNIC
    # types in this list will be available to choose from when creating a
    # port.
    # VNIC types include 'normal', 'macvtap' and 'direct'.
    # Set to empty list or None to disable VNIC type selection.
    #'supported_vnic_types': ['*']
#}
OPENSTACK_NEUTRON_NETWORK = {
    'enable_distributed_router': False,
    'enable_firewall': False,
    'enable_ha_router': False,
    'enable_lb': True,
    'enable_quotas': True,
    'enable_security_group': True,
    'enable_vpn': False,
    'profile_support': None,
}

5、在/usr/share/openstack-dashboard/执行命令收集并压缩对应网页资源

[root@localhost openstack-dashboard(keystone_admin)]# cd /usr/share/openstack-dashboard/
[root@localhost openstack-dashboard(keystone_admin)]# ./manage.py collectstatic
WARNING:root:"dashboards" and "default_dashboard" in (local_)settings is DEPRECATED now and may be unsupported in some future release. The preferred way to specify the order of dashboards and the default dashboard is the pluggable dashboard mechanism (in /usr/share/openstack-dashboard/openstack_dashboard/enabled, /usr/share/openstack-dashboard/openstack_dashboard/local/enabled).

You have requested to collect static files at the destination
location as specified in your settings:

    /usr/share/openstack-dashboard/static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes

0 static files copied to '/usr/share/openstack-dashboard/static', 1673 unmodified.
[root@localhost openstack-dashboard(keystone_admin)]# ./manage.py compress

Type 'yes' to continue, or 'no' to cancel: yes  询问时输入yes

6.重启web服务

systemctl restart httpd

 

页面出现如下图安装完毕(马赛克为你机器ip)

 

 

 

 

 

 

 

 

 

  • 3
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值