Openstack learning summary one (environment preparation)

Preface

Preparatory work before Openstack deployment.

  • Operating environment:
    VMware® Workstation 18
    CentOS-7-x86_64

1. Minimal installation of basic software

Prepare 2 virtual hosts, the configuration is as follows:

name CPU name IP
Control node control 192.168.88.14
calculate node compute 192.168.88.15
  • Configure the virtual network card:
Configuration item Configuration value
Subnet IP 192.168.88.0
Subnet mask 255.255.255.0
network management 192.168.88.2
  • Host installation requirements:
    1) Disk space 20G, memory space 4G, processor 1C, processor core number 2C, preferred mode Intel VT-x or AMD-v/RVI, enable virtualization Intel VT-x or AMD-v/RVI ;
    2) Turn off the security group policy;
    3) Turn on the Ethernet network;
    4) Choose manual partitioning, and only keep one root partition/;

2. Installation basis

1. Configure the network card

# 配置网卡
vi /etc/sysconfig/network-scripts/ifcfg-eth0

1:TYPE=Ethernet
2:PROXY_METHOD=none
3:BROWSER_ONLY=no
4:NM_CONTROLLED=no --> 禁止network manager管理我的网卡
5:BOOTPROTO=none
6:DEFROUTE=yes
7:PEERDNS=yes
8:IPV4_FAILURE_FATAL=no
9:IPV6INIT=yes
10:IPV6_AUTOCONF=yes
11:IPV6_DEFROUTE=yes
12:IPV6_FAILURE_FATAL=no
13:IPV6_ADDR_GEN_MODE=stable-privacy
14:NAME=eth0
15:DEVICE=eth0
16:ONBOOT=yes
17:IPADDR=192.168.88.14
18:NETMASK=255.255.255.0
19:GATEWAY=192.168.88.2
20:DNS1=192.168.88.2

# 重启网络服务
systemctl restart network

2. Install the basic software

  • Modify source
  • Replace gpgkey
  • Update software
  • Install basic software
  • Prohibit upgrading the kernel
# 安装基础软件
yum install -y wget yum-plugin-priorities

# 修改源
mkdir -p /data/backup/repo
mv /etc/yum.repos.d/* /data/backup/repo/
cd /etc/yum.repos.d/
wget -O CentOS-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
wget -O epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

# 更换gpgkey
sed -i 's#RPM-GPG-KEY-CentOS-7#RPM-GPG-KEY-CentOS-Official#' /etc/yum.repos.d/CentOS-Base-163.repo

# 添加[cloud]
vi CentOS-Base-163.repo
[cloud]
name=CentOS-$releasever - Cloud - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/cloud/$basearch/openstack-train/
gpgcheck=1
enabled=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-Official

# 更新软件
yum repolist
yum clean all && yum makecache fast && yum update -y --nogpgchec

# 安装基本软件
yum install tree lrzsz vim telnet net-tools bash-completion -y
yum install yum-utils -y

# 禁止升级内核(从安全稳定性考虑)
vim /etc/yum.conf
[main]
...
exclude=kernel*
exclude=centos-release*

Tip: If the failed software package is displayed when installing yum-utils: python2-chardet-3.0.4-7.el7.noarch, you can install it manually.

wget https://pypi.python.org/packages/source/s/setuptools/setuptools-18.3.2.tar.gz#md5=d30c969065bd384266e411c446a86623
wget --no-check-certificate https://bootstrap.pypa.io/pip/2.7/get-pip.py -O - | python
pip install chardet

3. Network environment configuration

  • Turn off the NetworkManager service
  • Configure the network card to support promiscuous mode
  • Start the message service
  • Enable IPV6 function
# 关闭NetworkManager服务
systemctl stop NetworkManager
systemctl disable NetworkManager

# 配置网卡支持混杂模式
echo 'ifconfig eth0 promisc' >> /etc/profile (重启机器后即可生效) 

# 启动消息服务
systemctl restart messagebus
systemctl status messagebus
systemctl enable messagebus

# 启用IPV6功能
vi /etc/sysctl.con
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0

# 立即生效
sysctl -p

4. Other configurations

  • Disable firewall
  • Close selinux
  • Configure hostname
# 禁用防火墙
systemctl stop firewalld
systemctl status firewalld
systemctl disable firewalld

# 检查
firewall-cmd --state

# 关闭selinux
sed -i 's#=enforcing#=disabled#' /etc/selinux/config

# 检查
grep --color=auto '^SELINUX' /etc/selinux/config

# hosts文件内容
vim /etc/hosts
192.168.88.14 control.example.com control
192.168.88.15 compute.example.com compute

# 设置compute节点的主机名
hostnamectl set-hostname control

Three, Openstack environment preparation

1. Basic software installation

  • Install openstack client related software
  • Time synchronization
  • Add time task
# 安装openstack客户端相关软件:
yum install -y python3-openstackclient --nogpgchec
yum install -y openstack-selinux --nogpgchec
yum install -y openstack-utils --nogpgchec

# 互联网时间同步
yum install ntpdate -y

# 执行同步
ntpdate -u time1.aliyun.com

# 检查
date

# 添加时间任务
crontab -e

*/5 * * * * /usr/sbin/ntpdate -u time1.aliyun.com >> /dev/null 2>&1 &

Follow the above steps to complete the setting and shut down. Next, we need to create another host based on the host just created as a computing node.

2. Clone the host

  • Create a snapshot: virtual machine-snapshot-take a snapshot-name base.
  • Clone virtual machine: virtual machine-snapshot-snapshot manager-clone (based on base)-complete.

After cloning is complete, start the virtual machine.

3. Configure compute nodes

  • Configure IP
  • Install openstack related software
  • Create qemu link file
  • Modify hostname
# 配置主机IP
vim /etc/sysconfig/network-scripts/ifcfg-eth0
IPADDR=192.168.88.15

# 重启网络
systemctl restart network
ifconfig

# 计算节点安装基本软件,等部署计算节点后再安装openstack相关软件
yum install -y qemu-kvm --nogpgchec 
yum install -y libvirt --nogpgchec

# 创建qemu链接文件,将qemu放到可执行目录里面
ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu

# 查询是否已经安装qemu-kvm
rpm -ql qemu-kvm

# 设置主机名
hostnamectl set-hostname compute

Four, Openstack support service installation

The following installation services are all done on the control host.

1. Database installation

Openstack uses a database to store openstack service information, usually running on the control node, supporting MariaDB (default) or MySQL.

  • Install mariadb database
  • Configuration database
  • Start the database service
  • Database security initialization
  • Verify that the installation was successful
# 安装软件
yum install -y mariadb --nogpgchec
yum install -y mariadb-server python-PyMySQL --nogpgchec

# 创建配置文件
vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.88.14
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

# 启动数据库服务
systemctl start mariadb
systemctl status mariadb
systemctl enable mariadb

# 数据库安全初始化
mysql_secure_installation  --> 全部选择Y或直接按enter即可

# 测试
mysql -uroot -proot
show databases;
select user,host,password from mysql.user;
exit;

2. rabbitmq installation

The main function of rabbitmq is to realize the mutual communication between openstack components and the asynchronous and synchronous update of information. openstack supports rabbitmq (default), Qpid and ZeroMQ queues.

  • install software
  • Start service
  • Add user
  • Setting permissions
  • Open rabbitmq monitoring plug-in (optional)
  • Set user role
# 安装软件
yum install -y erlang --nogpgchec
yum install -y socat --nogpgchec
yum install -y rabbitmq-server --nogpgchec

# 启动服务
systemctl start rabbitmq-server
systemctl status rabbitmq-server
systemctl enable rabbitmq-server

# 添加用户
rabbitmqctl add_user openstack openstack
rabbitmqctl list_users

# 给openstack用户配置“配置、写入,读取”权限
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

# 开启rabbitmq监控插件
rabbitmq-plugins enable rabbitmq_management
netstat -tnulp | grep 15672

# 设置管理员角色
rabbitmqctl set_user_tags openstack administrator

Rabbitmq uses ports:

The port number Description
5672 client communication
15672 Server management, only available after the monitoring service is turned on
25672 Internal communication between server services
4369 erlang service discovery

After the monitoring service is turned on, you can also view the status information of rabbitmq through the web page. Visit address: http://192.168.88.14:15672.

3. memcache installation

memcache is used to cache tokens used for authentication of various OpenStack services.

  • Software Installation
  • Parameter configuration
  • Start service
# 软件安装
yum install -y memcached  --nogpgchec
yum install -y python-memcached  --nogpgchec

# 配置参数
vim /etc/sysconfig/memcached
OPTIONS="-l 192.168.88.14,::1"   --> 修改memcache启动后监听的主机ip

# 启动服务
systemctl start memcached
systemctl status memcached
systemctl enable memcached

# 检查
netstat -tnulp | grep 11211

to sum up

This part of the content is just the beginning of the deployment of the openstack environment, and then the installation of openstack related components will be carried out.

Guess you like

Origin blog.csdn.net/zhongliwen1981/article/details/115410990