centos7 installation and configuration openstack deployment (1)

Article directory

  • Preface
  • 1. Architecture introduction
  • 2. Preparation
    • 1. Configure hosts
    • 2. Change the host name and configure hosts mapping
    • 3. Turn off the firewall, core protection, and network management
    • 4. Mount the CD
    • 5. Configure local source files
    • 6. Time server deployment
    • 7. Time client deployment
  • 3. Install auxiliary components (rabbittmq, memcached, mariadb)
    • 1. Configure epel-release source
    • 2. Install rabbitmq
    • 3. Edit rabbittmq variable file
    • 4. Open rabbitmq’s web management page
    • 5. Open the web for verification
    • 6. Copy cookie to computing node
    • 7. Configure the cluster
    • 8. Configure the cluster
    • 9. Verify rabbitmqctl cluster
    • 1. Install and start mariadb
    • 2. Modify configuration file
    • 3. Configure automatic startup at boot
    • 4.Initialize mariadb
    • 5.Verification
    • 1.Install memcached
    • 2. Open the web for verification
    • 3. Configure memcached to start automatically
    • 4.Verification
  • Summarize

Foreword

Chapter 1 of installing official openstack through yum on CentOS 7.9
This article introduces the preliminary preparations for installing openstack, including the establishment of message queues, databases, and caches.
In the future, there will be deployment of keystone, glance, nova, neutron, chinder, and Dashboard.
Following the deployment of this set of articles, you can ensure that you can build a complete openstack.

1. Architecture introduction

1. Control node (control node: rs1)
CPU: Dual core, dual thread – CPU virtualization enabled
Memory: 8G (minimum memory 6G, if it is less than 6G, problems will occur)
Hard drive: 60G
Network card: NAT1-192.168.244.50 NAT-2-192.168.244.40 VM1-172.16.0.40
There are 3 network cards: 1. VM1 (internal network card) 2. NAT (can access the Internet), NAT2 (can access the Internet)
Operating system: Centos 7.9 –minimized installation

2. Computing node 1 (computing node: rs2)
CPU: Dual core, dual thread – CPU virtualization enabled
Memory: 8G (minimum memory 6G, if it is less than 6G, problems will occur)
Hard drive: 60G
Network card: NAT-192.168.244.41 VM1-172.16.0.41
There are 2 network cards: 1. VM1 (internal network card) 2. NAT (can access the Internet)
Operating system: Centos 7.9 – Minimal installation

3. Computing node 2 (computing node: rs2)
CPU: Dual core, dual thread – CPU virtualization enabled
Memory: 8G (minimum memory 6G, if it is less than 6G, problems will occur)
Hard drive: 60G
Network card: NAT-192.168.244.42 VM1-172.16.0.42
There are 2 network cards: 1. VM1 (internal network card) 2. NAT (can access the Internet)
Operating system: Centos 7.9 – Minimal installation

2. Preparation

1. Configure hosts

The code is as follows (example):

vi /etc/hosts

192.168.244.50 rs1
192.168.244.51rs1
192.168.244.52rs3

2. Change the host name and configure hosts mapping

Full node configuration

hostnamectl set-hostname rs1
hostnamectl set-hostname rs2
hostnamectl set-hostname rs3

3. Turn off the firewall, core protection, and network management

Full node configuration

systemctl stop firewalld
systemctl disable firewalld
setenforce 0

vi /etc/selinux/config
Change to SELINUX=disabled
systemctl stop NetworkManager
systemctl disable NetworkManager

4. Mount the CD

Full node configuration
Mount the CD and configure automatic mounting at startup

mount /dev/cdrom /mnt
df-hT
vi /etc/fstab #Automatically mount on boot
Insert last line
/dev/cdrom /mnt iso9660 defaults 0 0

5. Configure local source files

Full node configuration

# mount -a or init 6
# cd /etc/yum.repos.d
# vi local.repo

Insert last line
[centos]
name=centos
baseurl=file:///mnt
gpgcheck=0
enabled=1

#Update yum source
# yum clean all
# yum makecache

6. Time server deployment

Control node deployment

(1) Installation time synchronization, synchronization with Alibaba Cloud

# yum -y install ntpdate ntp install time synchronization, clock service

# ntpdate ntp.aliyun.com Synchronize Alibaba Cloud
# ntpdate ntp.aliyun.com >>/var/log/ntpdate.log generate log files
Set periodic scheduled tasks
#crontab-e
*/30 * * * * /usr/sbin/ntpdate ntp.aliyun.com >>/var/log/ntpdate.log

# systemctl restart crond
# systemctl enable crond

(2) Set China time zone
timedatectl set-timezone Asia/Shanghai
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

(3) Modify configuration file
vi /etc/ntp.conf
restrict 192.168.244.0 mask 255.255.255.0 nomodify notrap

#comments
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#New
server 127.127.1.0
fudge 127.127.1.0 stratum 8
serverntp.aliyun.com
fudge ntp.aliyun.com stratum 8

(4) Start ntp service
# systemctl disable chronyd.service --NTP restart BUG -- Restart the system by disabling the chronyd service from booting
# systemctl restart ntpd --Restart the ntp server
# systemctl enable ntpd --Start the ntp server at boot

7. Time client deployment

Compute node deployment

(1) Install client
# yum -y install ntpdate Install time synchronization
# ntpdate rs1 or # ntpdate 192.168.244.40 time synchronization control node

(2) Set China time zone
timedatectl set-timezone Asia/Shanghai
mv /etc/localtime /etc/localtime.bak
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

(3) Synchronization plan
crontab -e
*/30 * * * * /usr/sbin/ntpdate ntp.aliyun.com >>/var/log/ntpdate.log

3. Install auxiliary components (rabbittmq, memcached, mariadb)

(1) Install and configure rabbittmq cluster

1. Configure epel-release source

Full node configuration

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install epel-release net-tools -y
yum clean all
yum makecache

2. Install rabbitmq

Full node configuration

yum install -y erlang rabbitmq-server.noarch

systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
systemctl status rabbitmq-server.service

Check if the port exists
netstat -lantp | grep 5672

View cluster status
rabbitmqctl cluster_status

3. Edit rabbittmq variable file

Full node configuration

#IP changed to local IP
vim /etc/rabbitmq/rabbitmq-env.conf
RABBITMQ_NODE_PORT=5672
ulimit -S -n 4096
RABBITMQ_SERVER_ERL_ARGS=" + K true + A30 + P 1048576 -kernel inet_default_connect_options
[{<!-- -->nodelay,true},{<!-- -->raw,6,18,<<5000:64/native>>}] -kernel inet_default_listen_options
[{<!-- -->raw,6,18,<<5000:64/native>>}]" RABBITMQ_NODE_IP_ADDRESS=192.168.244.40

4. Open rabbitmq’s web management page

Full node configuration

rabbitmq-plugins enable rabbitmq_management

systemctl restart rabbitmq-server.service
systemctl status rabbitmq-server.service

5. Open the web for verification

Account: guest Password: guest
http://192.168.244.40:15672/#/
http://192.168.244.41:15672/#/
http://192.168.244.42:15672/#/

6. Copy cookie to computing node

Control node configuration

scp /var/lib/rabbitmq/.erlang.cookie rs2:/var/lib/rabbitmq/.erlang.cookie
scp /var/lib/rabbitmq/.erlang.cookie rs3:/var/lib/rabbitmq/.erlang.cookie

7. Configure the cluster

Compute node configuration

systemctl restart rabbitmq-server.service

rabbitmqctl stop_app
rabbitmqctl join_cluster --ram rabbit@rs1
rabbitmqctl start_app

8. Configure the cluster

Compute node configuration

#Create an openstack account and let openstack call mq through this account
rabbitmqctl add_user openstack admin
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
rabbitmqctl set_user_tags openstack administrator

9. Verify rabbitmqctl cluster

Control node configuration

rabbitmqctl cluster_status
[root@rs1 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@rs1 ...
[{<!-- -->nodes,[{<!-- -->disc,[rabbit@rs1]},{<!-- -->ram,[rabbit@rs3,rabbit@rs2]}] },
 {<!-- -->running_nodes,[rabbit@rs1]},
 {<!-- -->cluster_name,<<"rabbit@rs1">>},
 {<!-- -->partitions,[{<!-- -->rabbit@rs1,[rabbit@rs3]}]}]
...done.

(2) Install and configure mariadb

1. Install and start mariadb

Control node configuration

yum install mariadb mariadb-server python2-PyMySQL -y
systemctl start mariadb.service

2. Modify the configuration file

Control node configuration

vi /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.244.40

default-storage-engine=innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server=utf8

3. Configure auto-start at boot

Control node configuration

systemctl enable mariadb.service
systemctl start mariadb.service

4.Initialize mariadb

Control node configuration

mysql_secure_installation

5.Verification

Control node configuration

[root@rs1 ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 350
Server version: 10.3.10-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
 + -------------------- +
| Database |
 + -------------------- +

(3) Install and configure memcached

1. Install memcached

yum install memcached python-memcached -y

2. Open the web for verification

vi /etc/sysconfig/memcached
OPTIONS="-l 127.0.0.1,::1,rs1"

3. Configure memcached to start automatically

systemctl enable memcached.service
systemctl start memcached.service

4.Verification

[root@rs1 ~]# ss -lntp|grep memcached
LISTEN 0 128 192.168.244.40:11211 *:* users:(("memcached",pid=10087,fd=28))
LISTEN 0 128 127.0.0.1:11211 *:* users:(("memcached",pid=10087,fd=26))
LISTEN 0 128 [::1]:11211 [::]:* users:(("memcached",pid=10087,fd=27))

Summary

The above is what I will talk about today. This article only briefly introduces the installation of the early components of openstack. From here on, we will officially enter the deployment of openstack components. As long as you follow this tutorial, you can guarantee that you can deploy a complete openstack cluster.