openEuler-22.03-LTS-SP2源码编译部署OpenStack-Zed详细攻略

  • Post author:
  • Post category:其他


openEuler-22.03-LTS-SP2源码编译部署OpenStack-Zed详细攻略



机器详情

主机名 IP 磁盘 CPU 内存
controller ens160:192.168.31.100/24 ens192:不配置IP地址 100G 2C 8G
compute ens160:192.168.31.101/24 ens192:不配置IP地址 100G 2C 8G



所有机器基础准备



安装操作系统

安装操作只需注意的一步是

Software Selection

要勾选

Development Tools


在这里插入图片描述
这会自动地帮我们安装一些基础的编译环境,如果你没有勾选,也无大碍,在编译安装时可能会遇到

报错说缺失一些编译环境,根据报错安装与之对应地编译环境即可解决



关闭防火墙

systemctl disable --now firewalld



关闭selinux

vim /etc/selinux/config
SELINUX=disabled



设置静态IP

nmtui

设置ens160网卡的IP地址为静态IP地址

设置ens192网卡不获取到IP地址(即设置为Disabled)

网卡配置生效命令

nmcli c reload
nmcli c up ens160
nmcli c up ens192



更新

dnf update -y



准备环境



环境配置(controller&&compute)



修改主机名

hostnamectl set-hostname controller
hostnamectl set-hostname compute



编辑hosts文件

vim /etc/hosts
192.168.31.100   controller
192.168.31.101   compute



安装 SQL DataBase(controller)



安装软件包

dnf install mariadb mariadb-server python3-PyMySQL -y



编辑文件

vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.31.100
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8



启动 DataBase 服务,并为其配置开机自启动

systemctl enable mariadb.service
systemctl start mariadb.service



配置DataBase的默认密码

mysql_secure_installation



安装 RabbitMQ(controller)



安装软件包

dnf install rabbitmq-server -y



启动 RabbitMQ 服务,并为其配置开机自启动

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



添加 OpenStack用户

rabbitmqctl add_user openstack 123456



设置openstack用户权限,允许进行配置、写、读

rabbitmqctl set_permissions openstack ".*" ".*" ".*"



安装 Memcached(controller)



安装依赖软件包

dnf install memcached python3-memcached -y



编辑文件

vim /etc/sysconfig/memcached
OPTIONS="-l 127.0.0.1,::1,controller"



启动 Memcached 服务,并为其配置开机启动

systemctl enable memcached.service
systemctl start memcached.service



验证

memcached-tool controller stats



正式编译安装



所需文件下载地址


https://releases.openstack.org/zed/index.html#zed-keystone



Keystone 编译安装(controller)



创建 keystone 数据库并授权

mysql -u root -p
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY '123456';
exit



安装httpd、mod_wsgi软件包

dnf install httpd mod_wsgi -y



解压keystone-22.0.0.tar.gz

tar -xvf keystone-22.0.0.tar.gz
cd keystone-22.0.0/



安装所需依赖包

pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

注意安装完之后要把SQLAlchemy的版本降为1.4.49,否则之后的命令会报错,因为2.0之后的版本有个参数被遗弃了

pip3 install SQLAlchemy==1.4.49 -i https://pypi.tuna.tsinghua.edu.cn/simple



编译安装

python3 setup.py install



创建/etc/keystone文件夹

mkdir /etc/keystone



复制etc/目录下的内容到/etc/keystone

cp -r etc/* /etc/keystone/



创建并编辑keystone配置文件

vim /etc/keystone/keystone.conf
[DEFAULT]
[application_credential]
[assignment]
[auth]
[cache]
[catalog]
[cors]
[credential]
[database]
connection = mysql+pymysql://keystone:123456@controller/keystone
[domain_config]
[endpoint_filter]
[endpoint_policy]
[eventlet_server]
[federation]
[fernet_receipts]
[fernet_tokens]
[healthcheck]
[identity]
[identity_mapping]
[jwt_tokens]
[ldap]
[memcache]
[oauth1]
[oslo_messaging_amqp]
[oslo_messaging_kafka]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
[oslo_middleware]
[oslo_policy]
[policy]
[profiler]
[receipt]
[resource]
[revoke]
[role]
[saml]
[security_compliance]
[shadow_users]
[token]
provider = fernet
[tokenless_auth]
[totp]
[trust]
[unified_limit]
[wsgi]



同步数控

useradd keystone
su -s /bin/sh -c "keystone-manage db_sync" keystone



初始化Fernet密钥仓库

keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone



启动服务

keystone-manage bootstrap --bootstrap-password 123456 \
--bootstrap-admin-url http://controller:5000/v3/ \
--bootstrap-internal-url http://controller:5000/v3/ \
--bootstrap-public-url http://controller:5000/v3/ \
--bootstrap-region-id RegionOne



配置Apache HTTP server

vim /etc/httpd/conf/httpd.conf
ServerName controller
ln -s /root/keystone-22.0.0/httpd/wsgi-keystone.conf /etc/httpd/conf.d/



启动Apache HTTP服务

systemctl enable httpd.service
systemctl start httpd.service

这里会报一个错误

No such file or directory: AH02291: Cannot access directory ‘/var/log/apache2/’ for error log of vhost defined at /etc/httpd/conf


在这里插入图片描述

原因是因为/var/log/apache2/这个目录不存在,创建这个目录即可解决问题

mkdir /var/log/apache2/
systemctl restart httpd.service



创建环境变量配置



版权声明:本文为wstc2689784536原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。