当前位置:   article > 正文

openstack平台搭建笔记(私有云)_openstack 私有云

openstack 私有云

openstack平台搭建笔记(私有云)

一、配置虚拟机后,配置虚拟机IP地址

1.controller

image-20230626084558156

vi /etc/sysconfig/network-scripts/ifcfg-ens33 (进入网卡ens33配置文件)
  • 1

image-20230626084926094

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.100.10 (ip地址)
PREFIX=24 (子网掩码)
GATEWAY=192.168.100.1 (网关)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

配置完成后,重启network服务

systemctl restart network 
  • 1

重启过后输入ip a 查看网卡配置信息

image-20230626085713923

2.compute

image-20230626085146566

vi /etc/sysconfig/network-scripts/ifcfg-ens33 (进入网卡ens33配置文件)
  • 1

image-20230626085241504

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.100.20 (ip地址)
PREFIX=24 (子网掩码)
GATEWAY=192.168.100.1 (网关)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

配置完成后,重启network服务

systemctl restart network 
  • 1

重启过后输入 ip a 命令查看网卡配置信息

image-20230626085615447

二、建立主机映射

配置好IP地址后,将controller节点下,/etc/hosts 中添加 两个节点的host 如下图

image-20230510161409946

之后通过scp命令将该文件传到compute节点上

scp /etc/hosts root@192.168.100.20:/etc/hosts
  • 1

之后进入root下,隐藏目录.ssh 下如有know_host文件请删除,如果没有 输入

ssh-keygen
  • 1

创建公钥,如下图(期间回车按默认创建)

image-20230510161816508

之后选择使用ssh-copy-id 192.168.100.20命令将改公钥添加给compute节点。

image-20230510161928108

之后进入compute节点重复以上操作。

image-20230510162044335

三、配置yum源

首先将/etc下的/yum.repos.d的所有文件先备份到/opt下 或者其他目录下,之后在/yum.repos.d 下创建 centos.repo 文件 进行编辑

1.controller

[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas-repo
gpgcheck=0
enabled=1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

2.compute

[centos]
name=centos
baseurl=ftp://192.168.100.10/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.100.10/iaas-repo
gpgcheck=0
enabled=1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

四、挂载镜像

首先通过 CRT 将 centos 和iaas 镜像传到controller虚拟机中

image-20230626092242059

传输过后,进入/root目录下,进行镜像挂载

mount -o loop chinaskills_cloud_iaas_v2.0.3.iso  /mnt (挂载iaas镜像)
  • 1
cp -rvf /mnt/* /opt/ (复制到opt目录下)
  • 1
umount  (解除挂载)              
  • 1
mount -o loop CentOS-7-x86_64-DVD-2009.iso /mnt (挂载Centos镜像)
  • 1
mkdir /opt/centos (在opt目录下创建centos目录)
  • 1
cp -rvf /mnt/* /opt/centos/ (复制到opt/centos/目录下)
  • 1
umount (解除挂载)
  • 1

配置过后使用 yum clean all 清理yum源缓存 和 yum list 加载yum源

五、设置防火墙

1.controller

关闭防火墙并设置开机不自启

systemctl stop firewalld(关闭防火墙)
  • 1
systemctl disable firewalld(设置开机不自启)
  • 1

image-20230510163836219

yum remove -y NetworkManager firewalld (卸载 NetworkManager firewalld 服务)
  • 1
yum -y install iptables-services (安装iptables服务)
  • 1
systemctl start iptables (启动iptables服务)
  • 1
systemctl enable iptables (设置开机自启动)
  • 1
iptables -Z
iptables -X
iptables -F
service iptables save (检测iptables服务是否正常运行)
  • 1
  • 2
  • 3
  • 4

image-20230626101348366

设置严格访问模式

setenforce 0 (临时修改)
  • 1

以下为永久修改 vi /etc/selinux/config 将SELINUX=enforcing改为SELINUX=disabled(或permissive)

image-20230510164159423

computer同样需要操作该步骤

在controller中下载vsftpd服务使comput能够连接到controller中的镜像源

yum -y install vsftpd 
systemctl start vsftpd (启动vsftpd服务)
systemctl enable vsftpd (设置开机自启)
vi /etc/vsftpd/vsftpd.conf
在配置文件中添加
anon_root=/opt/ 保存即可 (添加过后需要重新启动vsftpd服务)
(若出现进入comput使用yum命令报错 可进入contorller中重新启动vsftpd)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

image-20230626101222245

六、安装openstack服务

首先使用yum命令安装openstack基础服务(compute、controller)

yun -y install openstack-iaas 
  • 1

然后进入openstack配置文件,进行安装配置

vi /etc/openstack/openrc.sh 
  • 1

进入之后使用ctrl+v进入视块模式,然后shift+g 到最底行,最后点击x键删除首行字母

接着输入: 进入命令模式,输入以下命令进行字符替换

:% s/PASS=/PASS=000000/g
  • 1
[root@controller ~]# vi /etc/openstack/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

#--------------------Placement Config----------------------##
#Password for Mysql placement user. exmaple:000000
PLACEMENT_DBPASS=000000

#Password for Keystore placement user. exmaple:000000
PLACEMENT_PASS=000000

#--------------------Nova Config----------------------##
#Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000

#Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000

#--------------------Neutron 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

#External Network Interface. example:eth1
INTERFACE_NAME=ens34

#External Network The Physical Adapter. example:provider
Physical_NAME=provider

#First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=1

#Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=1000

#--------------------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=sdb1

#--------------------Swift Config---------------------##
#Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000

#The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdb2

#The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.100.20

#--------------------Trove Config----------------------##
#Password for Mysql trove user. exmaple:000000
TROVE_DBPASS=000000

#Password for Keystore trove user. exmaple:000000
TROVE_PASS=000000

#--------------------Heat Config----------------------##
#Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000

#Password for Keystore heat user. exmaple:000000
HEAT_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

#--------------------ZUN Config----------------##
#Password for Mysql ZUN user. exmaple:000000
ZUN_DBPASS=000000

#Password for Keystore ZUN user. exmaple:000000
ZUN_PASS=000000

#Password for Keystore KURYR user. exmaple:000000
KURYR_PASS=000000

#--------------------OCTAVIA Config----------------##
#Password for Mysql OCTAVIA user. exmaple:000000
OCTAVIA_DBPASS=000000

#Password for Keystore OCTAVIA user. exmaple:000000
OCTAVIA_PASS=000000

#--------------------Manila Config----------------##
#Password for Mysql Manila user. exmaple:000000
MANILA_DBPASS=000000

#Password for Keystore Manila user. exmaple:000000
MANILA_PASS=000000

#The NODE Object Disk for Manila. example:md126p5.
SHARE_DISK=sdb3

#--------------------Cloudkitty Config----------------##
#Password for Mysql Cloudkitty user. exmaple:000000
CLOUDKITTY_DBPASS=000000

#Password for Keystore Cloudkitty user. exmaple:000000
CLOUDKITTY_PASS=000000

#--------------------Barbican Config----------------##
#Password for Mysql Barbican user. exmaple:000000
BARBICAN_DBPASS=000000

#Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=000000
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175

配置过后保存退出,使用scp命令将该配置文件传输到compute上

scp /etc/openstack/openrc.sh root@compute:/etc/openstack/openrc.sh
  • 1

传输过后检查配置文件是否有问题无问题就可以安装openstack所需的服务了

七、安装服务

controller

 iaas-pre-host.sh (初始化服务)
  • 1

compute

 iaas-pre-host.sh (初始化服务)
  • 1

初始化之后根据要求重启两台服务器(使用reboot命令)

controller

iaas-install-mysql.sh (安装mysql数据库服务)
iaas-install-keystone.sh (安装keystone服务)
iaas-install-glance.sh (安装glance服务)
iaas-install-placement.sh (安装placement服务)
  • 1
  • 2
  • 3
  • 4

安装nove服务(controller、compute)

controller

iaas-install-nova-controller.sh
  • 1

compute

iaas-install-nova-compute.sh
  • 1

安装neutron服务 (controller、compute)

controller

iaas-install-neutron-controller.sh
  • 1

compute

iaas-install-neutron-compute.sh
  • 1

最后安装dashboard服务

iaas-install-dashboard.sh  (controller)
  • 1

image-20230626110241598

根据提示进入网址 输入账户密码测试是否安装成功

placement服务)

安装nove服务(controller、compute)

controller

iaas-install-nova-controller.sh
  • 1

compute

iaas-install-nova-compute.sh
  • 1

安装neutron服务 (controller、compute)

controller

iaas-install-neutron-controller.sh
  • 1

compute

iaas-install-neutron-compute.sh
  • 1

最后安装dashboard服务

iaas-install-dashboard.sh  (controller)
  • 1

根据提示进入网址 输入账户密码测试是否安装成功

image-20230626110327040

image-20230627150438421

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/983369
推荐阅读
相关标签
  

闽ICP备14008679号