基于'国基北盛'云基础架构平台软件搭建私有云平台

基于’国基北盛’云基础架构平台软件搭建私有云平台

1
2
3
[root@localhost ~] 指所有节点操作
[root@controller ~] 指仅在controller节点操作
[root@compute ~] 指仅在compute节点操作

1.前期准备与节点规划

  • 系统:CentOS-7-x86_64-DVD-1804.iso

  • 镜像:chinaskills_cloud_iaas.iso

  • 远程工具:SecureCRT

  • 控制节点,计算节点,三层交换机

    网络规划为:

    节点 内网IP地址 外网IP地址
    Controller 192.168.100.10 192.168.200.10
    Compute 192.168.100.20 192.168.200.20

    计算节点与控制节点内网卡名为enp7s0,外网卡为enp8s0

2.安装Centos7

如需将网卡改为eth开头,请在安装系统前添加启动代码

1
net.ifnames=0 biosdevnames=0

3.配置网络,主机名,设置SeLinux,关闭防火墙

修改网卡之前千万千万用ip a命令确定网卡名称

1.Controller

  • 内网卡
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp7s0(此处不一定是enp7s0)
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
# BOOTPROTO=static(要改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=enp7s0
UUID=58a7179c-8d1b-411b-bac3-b298c0165f67
DEVICE=enp7s0
# ONBOOT=yes
# IPADDR=192.168.100.10
# PREFIX=24
# GATEWAY=192.168.100.1
  • 外网卡
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp8s0 (此处不一定是enp8s0)
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=enp8s0
UUID=aff77da4-a7b2-409e-832a-42b525c8900e
DEVICE=enp8s0
ONBOOT=yes
IPADDR=192.168.200.10
PREFIX=24
  • 修改主机名
1
[root@localhost ~]# hostnamectl set-hostname controller

2.Compute

  • 内网卡
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp7s0(此处不一定是enp7s0)
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static(要改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=enp7s0
UUID=58a7179c-8d1b-411b-bac3-b298c0165f67
DEVICE=enp7s0
ONBOOT=yes
IPADDR=192.168.100.20
PREFIX=24
GATEWAY=192.168.100.1
  • 外网卡
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp8s0 (此处不一定是enp8s0)
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=enp8s0
UUID=aff77da4-a7b2-409e-832a-42b525c8900e
DEVICE=enp8s0
ONBOOT=yes
IPADDR=192.168.200.20
PREFIX=24
  • 修改主机名
1
[root@localhost ~]# hostnamectl set-hostname compute
  • 重启网络
1
systemctl restart network
  • 配置Hosts解析
1
2
3
4
[root@localhost ~]# vi /etc/hosts
添加(此处IP不一定是192.168.100.10/20,根据实际来)
192.168.100.10 controller
192.168.100.20 compute
  • 关闭防火墙
1
systemctl stop firewalld &&systemctl statue firewalld 
  • 设置selinux
1
2
3
4
5
6
7
8
#临时设置
setenforce 0 &&getenforce
#永久设置
vi /etc/selinux/config
修改
SELINUX=enforcing为Permissive
#把此文件传送到另一台节点上
scp /etc/selinux/config root@compute:/etc/selinux/

3.修改完成之后重新连接

1
2
[root@localhost ~]# exit
logout

4.给Compute节点配置分区

1
2
3
4
5
6
7
[root@compute ~]# parted /dev/md126(此处不一定是md126)
使用命令查看硬盘分区:lsblk
确定要分区的硬盘
初始化硬盘命令:mklabel gpt
创建分区: mkpart 回车完毕后会提示写硬盘名与分区系统,不选,直接填start与end就行
按p查看分区
按q退出

5.上传镜像并写入Yum源

使用远程文件工具上传两份镜像

删除旧的yum源,写本地Yum源

1.Controller(ftp是vsftpd的服务格式,http就是httpd的服务格式)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@controller ~]# rm -rvf /etc/yum.repos.d/*
removed ‘/etc/yum.repos.d/CentOS-Base.repo’
removed ‘/etc/yum.repos.d/CentOS-CR.repo’
removed ‘/etc/yum.repos.d/CentOS-Debuginfo.repo’
removed ‘/etc/yum.repos.d/CentOS-fasttrack.repo’
removed ‘/etc/yum.repos.d/CentOS-Media.repo’
removed ‘/etc/yum.repos.d/CentOS-Sources.repo’
removed ‘/etc/yum.repos.d/CentOS-Vault.repo’
[root@controller ~]# vi /etc/yum.repos.d/centos.repo
按i写入
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas-repo
baseurl=file:///opt/iaas-repo
gpgcheck=0
enabled=1

2.Compute

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@compute ~]# rm -rvf /etc/yum.repos.d/*
removed ‘/etc/yum.repos.d/CentOS-Base.repo’
removed ‘/etc/yum.repos.d/CentOS-CR.repo’
removed ‘/etc/yum.repos.d/CentOS-Debuginfo.repo’
removed ‘/etc/yum.repos.d/CentOS-fasttrack.repo’
removed ‘/etc/yum.repos.d/CentOS-Media.repo’
removed ‘/etc/yum.repos.d/CentOS-Sources.repo’
removed ‘/etc/yum.repos.d/CentOS-Vault.repo’
[root@compute ~]# vi /etc/yum.repos.d/centos.repo
按i写入
[centos]
name=centos
baseurl=ftp://192.168.100.10/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas-repo
baseurl=ftp://192.168.100.10/iaas-repo
gpgcheck=0
enabled=1

6.在Controller上挂载本地Yum

分支:可能会用到Vsftp服务提供yum源,也可能会使用httpd提供

1.使用Vsftpd提供

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1804.iso /mnt
[root@controller ~]# mkdir /opt/centos
[root@controller ~]# mkdir /opt/openstack
[root@controller ~]# cp -rvf /mnt/* /opt/centos/
[root@controller ~]# umount /mnt/
[root@controller ~]# mount -o loop chinaskills_cloud_iaas.iso /mnt/
[root@controller ~]# cp -rvf /mnt/* /opt/openstack
测试Controller节点Yum是否正t
[root@controller ~]# yum clean all
[root@controller ~]# yum list

安装FTP服务
[root@controller ~]# yum install vsftpd
[root@controller ~]# vi /etc/vsftpd/vsftpd.conf
末尾添加
anon_root=/opt/
重启FTP
[root@controller ~]# systemctl restart vsftpd
停止并关闭防火墙
[root@controller ~]# systemctl stop firewalld &&systemctl disable firewalld
Removed symlink /etc/systemd/system/multiuser.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbusorg.fedoraproject.FirewallD1.service.


2.使用httpd提供

删除旧yum源

1
[root@controller ~]# rm -rvf /etc/yum.repos.d/*

在opt目录下分别创建Centos.Openstack文件夹并挂载镜像文件

1
2
3
4
5
root@controller ~]# mkdir /opt/centos
[root@controller ~]# mkdir /opt/openstack

[root@controller ~]# mount -o loop Centos.iso /opt/centos
[root@controller ~]# mount -o loop chinaskill_iaas.iso /opt/openstack

使用Httpd服务提供Yum源服务

新建local.repo

1
2
3
4
5
6
[root@controller ~]# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1

安装Httpd

1
[root@controller ~]# yum install httpd

查看Httpd配置文件确定网站路径

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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
[root@controller ~]# vi /etc/httpd/conf/httpd.conf

#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# with ServerRoot set to '/www' will be interpreted by the
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/etc/httpd"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
Include conf.modules.d/*.conf

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User apache
Group apache

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin root@localhost

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"(!!!这就是默认路径)

#
# Relax access to content within /var/www.
#
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>

# Further relax access to the default document root:
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
Require all denied
</Files>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog "logs/access_log" common

#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar

#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

</IfModule>

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>

<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /etc/mime.types

#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi

# For type maps (negotiated resources):
#AddHandler type-map var

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default. To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
AddDefaultCharset UTF-8

<IfModule mime_magic_module>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
MIMEMagicFile conf/magic
</IfModule>

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults if commented: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
EnableSendfile on

# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf

在默认路径下创建Centos.Openstack文件夹,复制文件到此目录,重启Httpd服务,并测试

1
2
3
4
5
6
7
[root@controller ~]# mkdir /var/www/html/centos
[root@controller ~]# mkdir /var/www/html/openstack

[root@controller ~]# cp -rvf /opt/centos/* /var/www/html/centos
[root@controller ~]# cp -rvf /opt/openstack/* /var/www/html/openstack

[root@controller ~]# systemctl restart httpd &&systemctl enable httpd

分别在Controller与Compute上添加ftp.repo,要求地址使用主机名模式

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@controller ~]# rm -rvf /etc/yum.repos.d/*
[root@controller ~]# vi /etc/yum.repos.d/ftp.repo

[centos]
name=centos
baseurl=http://controller/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=http://controller/openstack/iaas-repo
gpgcheck=0
enabled=1

7.配置时间同步

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
[root@controller ~]# vi /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#注释掉以前的服务器,添加本机作为服务器
server 127.0.0.1 iburst(只保留一条,将0.centosxxx.org修改为127.0.0.1,不删除iburst,格式就是前边所示)
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#设置允许同步的网段
allow 192.168.100.0/24

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking
allow 192.168.100.0/24(删除注释,修改同步内网网段)
local stratum 10
#保存退出

[root@controller ~]# systemctl restart chronyd &&systemctl enable chronyd
[root@compute ~]# vi /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#注释掉以前的服务器,添加controller作为服务器
server controller iburst(修改为控制节点IP或主机名,最好是主机名)
#保存退出
[root@compute ~]# systemctl restart chronyd &&systemctl enable chronyd
[root@compute ~]# chronyc sources -v
210 Number of sources = 1

.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* controller 11 7 377 10 +24us[ +43us] +/- 154ms
即同步成功

9.配置环境变量

:%s%#%为删除每行首个#号

:%s%PASS=%PASS=000000全局修改PASS密码

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
[root@controller ~]# yum install -y iaas-xiandian
[root@compute ~]# yum install -y iaas-xiandian
[root@controller ~]# vi /etc/xiandian/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=openstakc(默认空,要添加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(openstack 域,默认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

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

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

##--------------------Neturon 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(默认空,改为000000)

##Tunnel Network Interface. example:x.x.x.x
INTERFACE_IP=192.168.100.10(本机内网卡IP,控制节点写控制节点IP,其他节点写其他节点IP)

##External Network Interface. example:eth1
INTERFACE_NAME=enp8s0(外网卡)

##External Network The Physical Adapter. example:provider
Physical_NAME=provider(此处名字与外网卡关联,默认provider)

##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=101(默认101)

##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=200(默认200)

##--------------------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=md126p4(空白分区第一个)

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

##The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=mk126p5(空白分区第二个)

##The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.100.20(计算节点IP)

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

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

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

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

##Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=000000

注意在Compute节点上

INTERFACE_IP=192.168.100.10要改成192.168.100.20

1
2
[root@controller ~]# iaas-pre-host.sh
[root@compute ~]# iaas-pre-host.sh

10.安装服务

1.安装Mysql

1
[root@controller ~]# iaas-install-mysql.sh

2.安装Keyston

1
[root@controller ~]# iaas-install-keystone.sh

3.安装Glance

1
[root@controller ~]# iaas-install-glance.sh

4.安装Nova服务

1
2
[root@controller ~]# iaas-install-nova-controller.sh
[root@compute ~]# iaas-install-nova-compute.sh

5.安装Neutron

1
2
[root@controller ~]# iaas-install-neutron-controller.sh
[root@compute ~]# iaas-install-neutron-compute.sh

6.Dashboard

1
[root@controller ~]# iaas-install-dashboard.sh

如果要安装后续服务,需要配置内外网,样卷只做到安装Cinder服务,不配也无妨

6.1配置网络

虚拟机与服务器实际配置有所出入

1.虚拟机配置网络

1.网络

管理员>网络>创建网络

  • 名称:extnet

  • 项目:admin

  • 供应商类型:Flat

  • 物理网络名称:Provider(与openrc.sh文件中Physical_NAME=provider对应)

  • 勾选外部网络

2.子网
  • 名称:extsubnet

  • 网络地址:外网网

  • 网关:网段第一个,(例子192.168.1.1)

2.服务器创网络

1.网络
  • 名称:extnet

  • 项目:admin

  • 供应商类型:vlan

  • 物理网络名称:Provider(与openrc.sh文件中Physical_NAME=provider对应)

  • 段ID:外网网段xxx(192.168.xxx.0/24)

  • 勾选外部网络

2.子网
  • 名称:extsubnet

  • 网络地址:外网网

  • 网关:网段第一个,(例子192.168.1.1)

7.安装Cinder

1
2
[root@controller ~]# iaas-install-cinder-controller.sh
[root@compute ~]# iaas-install-cinder-compute.sh

8.安装Swift

1
2
[root@controller ~]# iaas-install-swift-controller.sh
[root@compute ~]# iaas-install-swift-compute.sh

9.安装Heat

1
[root@compute ~]# iaas-install-heat.sh

10.安装Zun

1
2
[root@controller ~]# iaas-install-zun-controller.sh
[root@compute ~]# iaas-install-zun-compute.sh

11.安装Celiometer

1
2
[root@controller ~]# iaas-install-ceilometer-controller.sh
[root@compute ~]# iaas-install-ceilometer-compute.sh

12.安装Aodh

1
[root@controller ~]# iaas-install-aodh.sh

13.将控制节点资源添加到云平台

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
修改控制节点openrc.sh,将计算节点IP与主机名替换为控制节点
##--------------------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.10(控制节点ip)

##Compute HOST Password. example:000000
HOST_PASS_NODE=000000

##Compute Node hostname. example:compute
HOST_NAME_NODE=controller(控制节点主机名)

在控制节点上运行脚本iaas-install-nova-compute.sh即可加入

11.安装完成后服务状态:


基于'国基北盛'云基础架构平台软件搭建私有云平台
https://blog.itmmu.com/2023/05/29/基于'国基北盛'云基础架构平台软件搭建私有云平台/
作者
itmua
发布于
2023年5月29日
更新于
2023年5月31日
许可协议