虽然目前容器越来越火,用K8S的也越来越多,但是Iaas平台依然是云计算的基础设施中的基础,而Iaas平台中Openstack依然是开源首选项目。
Openstack平台经过这么多年的发展,已经发展到T版本,而18年发布的R版Rocky已经经过一年多的时间的考验,趋于稳定。本文给大家介绍Centos7如何通过互联网安装Openstack Rocky版。
安装前说明:下面没有特别说明,全部节点都要做相关配置。
1.环境信息
软件 | 版本 |
centos | 7.7-1908 |
controller | 10.23.155.100 |
nova01 | 10.23.155.101 |
nova02 | 10.23.155.102 |
2.配置hosts
配置hosts
cat >> /etc/hosts <<EOF
10.23.155.100 controller
10.23.155.101 nova01
10.23.155.102 nova02
EOF
3.关闭防火墙和SeLinux
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld.service
关闭SELINUX
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
4.ntp同步所有节点时间
yum -y install ntp
systemctl enable ntpd
systemctl start ntpd
ntpdate -u cn.pool.ntp.org
5.设置controller节点对所有计算节点ssh免密登陆。controller节点执行
ssh-keygen -t rsa
分发到各个节点,包括controller节点
ssh-copy-id 10.23.155.100/101/102
6.创建openstack rocky版本的国内repo源,使用的是阿里云源
cat <<EOF > /etc/yum.repos.d/openstack.repo
[openstack-rocky]
name=openstack-rocky
baseurl=https://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-rocky/
enabled=1
gpgcheck=0
[qume-kvm]
name=qemu-kvm
baseurl= https://mirrors.aliyun.com/centos/7/virt/x86_64/kvm-common/
enabled=1
gpgcheck=0
EOF
7.安装centos-release-openstack-rocky
yum install centos-release-openstack-rocky
yum upgrade
8.安装openstack客户端和selinux服务
yum install -y python-openstackclient openstack-selinux
9.安装数据库mariadb 只在controller节点执行
yum install -y mariadb mariadb-server python2-PyMySQL
数据库配置
cat <<EOF > /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 10.23.155.100
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
EOF
启动数据库
systemctl enable mariadb.service
systemctl start mariadb.service
设置数据库密码
运行mysql_secure_installation命令
[root@controller ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, Maria