【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置

从创建虚拟机开始搭建 openstack-Train版

CentOS8 镜像地址 : https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/images/boot.iso
https://docs.openstack.org/install-guide/

#1

我们使用centOS8版本进行搭建,搭建最小化操作系统,使用Boost.ios安装

controller : 0000@root

compute : root@0001

【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第1张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第2张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第3张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第4张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第5张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第6张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第7张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第8张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第9张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第10张图片

#2

配置虚拟机网络、防火墙等。

cd /etc/sysconfig/network-scripts/
vi ifcfg-ens160

查看 虚拟网络模拟器

【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第11张图片
【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第12张图片

这里看到NAT模式,子网ip分配的是192.168.61.0 ,子网掩码255.255.255.0

网关192.168.61.2

在虚拟机上配置相关的内容:

【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第13张图片

nmcil #查看ip配置
nmcli c reload #重启网络配置
reboot #重启

然后可以看到虚拟机的ip,可以在本机上用ssh进行连接。

虚拟机系统需要设置yum的软件源:

http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host" Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

解决:

cd /etc/yum.repos.d/

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*.repo

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/*.repo

yum makecache

yum update -y

关闭selinux,关闭防火墙,设置主机名

cat /etc/selinux/config
vi  /etc/selinux/config
# SELINUX=disabled
getenforce

setenforce 0

systemctl status firewalld

systemctl stop firewalld;systemctl disable firewalld #关闭防火墙

iptables -L #查看防火墙

hostnamectl set-hostname compute/controller #设置主机名

#3

配置时间服务器NTP

在controller节点:

yum -y install chrony

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 ntp3.aliyun.com 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 all

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

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

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

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

# Select which information is logged.
#log measurements statistics tracking
systemctl restart chronyd

systemctl status chronyd

date #能出来当前时间就配置成功

timedatectl set-timezone Asia/Shanghai #如果时区不正确,需要设置为上海时区

配置hosts信息,现在两个节点都要配

hostname -I #查看本机ip

vi /etc/hosts
# 加入 'controller_ip controller
#     'compute_ip compute'

compute中下载chrony,配置server controller iburst,同步控制节点

yum -y install chrony

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 controller 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 all

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

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

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

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

# Select which information is logged.
#log measurements statistics tracking

#4

下载openstack-T的包:

yum install centos-release-openstack-train

cd /etc/yum.repos.d/
ll #可以查看yum软件库中有openstack-T了

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/*.repo

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/*.repo
# yum install python-openstackclient  CentOS7

yum install python3-openstackclient -y  #CentOS8
yum install openstack-selinux -y

#5

下载数据库(controller)

#数据库(controller)
yum install mariadb mariadb-server python2-PyMySQL -y

vi /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 10.0.0.11 #要改成controller节点的ip

default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
#开启服务
systemctl enable mariadb.service;systemctl start mariadb.service

mysql_secure_installation #初始化sql , 设置密码0000 ; disallow root 选择n;其它全y; 即 y#0000,0000 ;y;n;y;y
mysql -p #输入密码查看是否可以登录进去

#6

消息队列 (controller)

yum install rabbitmq-server -y
#出错时
vi /etc/yum.repos.d/rabbitmq.repo
参考:https://www.rabbitmq.com/install-rpm.html#package-dependencies
https://blog.csdn.net/sm923/article/details/120423439
# In /etc/yum.repos.d/rabbitmq.repo

##
## Zero dependency Erlang
##

[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

##
## RabbitMQ server
##

[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_server-source]
name=rabbitmq_server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
yum update -y

yum install socat logrotate -y

yum install erlang

yum install rabbitmq-server
#开启服务
systemctl enable rabbitmq-server.service;systemctl start rabbitmq-server.service

rabbitmqctl add_user openstack openstack0000 #密码openstack0000

rabbitmqctl set_permissions openstack ".*" ".*" ".*" #开发权限

rabbitmqctl list_users #查看是否创建成功

rabbitmq-plugins list #查看需要启动的服务

rabbitmq-plugins enable rabbitmq_management 

rabbitmq_management_agent #开启图形化界面

##
可以添加一个rabbitmq管理员权限用户
rabbitmqctl add_user admin admin
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl set_user_tags admin administrator
##

此时可以在 controller_ip:15672 远程访问rabbitmq了

【openstack-T版 CentOS8 搭建记录 - VMware虚拟机上部署】 Environment基础环境配置_第14张图片

#7

配置缓存服务(controller)

# yum install memcached python-memcached #CentOS7
yum install memcached python3-memcached #CentOS8
vim /etc/sysconfig/memcached

# OPTIONS="-l 127.0.0.1,::1,controller"

#开启服务
systemctl enable memcached.service;systemctl start memcached.service

你可能感兴趣的:(openstack,openstack,云计算,运维,linux)