首先需要安装openstack的管理工具,此处选择的openstack版本为Train。文中所有步骤全部来源于官方安装文档,官方文档中提供了suse、centos、ubuntu三种操作系统的安装教程,此处使用centos。
系统环境如下:
操作系统:Centos7.9 mini
一、安装# OpenStack packages
安装openstack train版本,命令如下:
yum install centos-release-openstack-train
下载安装openstack的rdo仓库的rpm包 (download and install the RDO repository RPM to enable the OpenStack repository)
yum install https://rdoproject.org/repos/rdo-release.rpm
yum upgrade
安装openstack命令行客户端
yum install python-openstackclient
安装openstack selinux管理工具,由于我关闭了selinux,所以这个模块应该没用。
yum install openstack-selinux
二、安装sql数据库
openstack使用sql数据库来存储它本身需要的信息,比如启动了哪些服务,安装了哪些节点之类;还存储了用户信息,以供keystone服务来使用。理论上支持大部分的sql数据库,比如mysql、pgsql、sqlite之类的玩意,文中使用mariadb,是mysql的社区版。数据库安装在控制节点
安装数据库和python的数据库驱动
yum install mariadb mariadb-server python2-PyMySQL
然后进行配置
[mysqld]
bind-address = 10.0.0.11 # 绑定数据库地址
default-storage-engine = innodb # 指定数据库引擎
innodb_file_per_table = on # 开启独立表空间
max_connections = 4096 # 指定最大连接数,当mysql连接数量超过这个,就会拒绝新的连接
collation-server = utf8_general_ci
character-set-server = utf8 # 指定字符集
设置开机启动,并启动数据库
systemctl enable mariadb.service # 设置开机启动 会给系统里搞个软连接
systemctl start mariadb.service # 启动数据库
配置数据库安全选项,这个命令可以设置数据库root密码,设置访问限制等,还会问你是不是要删除test库之类的问题,由于是测试环境,加上本人是条懒狗,全部选(n) ,数据库默认root密码为空。
mysql_secure_installation
至此,数据库安装完成,搞定。
三、安装消息队列
OpenStack uses a message queue to coordinate operations and status information among services. The message queue service typically runs on the controller node. OpenStack supports several message queue services including RabbitMQ, Qpid, and ZeroMQ.
OpenStack 使用消息队列来协调服务之间的操作和状态信息。消息队列服务通常在控制器节点上运行。OpenStack 支持多种消息队列服务,包括 RabbitMQ、 Qpid 和 ZeroMQ。
官方文档中采用rabbitmq作为消息队列
1、进行安装
yum install rabbitmq-server
2、设置开机启动,并开启服务
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
3、在rabbitmq中添加openstack用户,此处我将密码设置为123456,方便测试
rabbitmqctl add_user openstack 123456
rabbitmqctl 添加用户 用户名 密码
4、设置rabbitmq中openstack用户的权限。允许 openstack 用户进行配置、写和读访问
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
四、安装内存数据库(memcached)
The Identity service authentication mechanism for services uses Memcached to cache tokens. The memcached service typically runs on the controller node. For production deployments, we recommend enabling a combination of firewalling, authentication, and encryption to secure it.
服务的 Identity 服务身份验证机制使用 Memcached 缓存令牌。Memcached 服务通常在控制器节点上运行。对于生产部署,我们建议启用防火墙、身份验证和加密的组合来保护它。
1、安装
yum install memcached python-memcached
2、配置memcached,配置文件位于/etc/sysconfig/memcached,将下列内容写入文件。
主要是要将controller写入OPTIONS中。
OPTIONS="-l 127.0.0.1,::1,controller"
3、设置开机启动
systemctl enable memcached.service
4、启动memcached
systemctl start memcached.service
到此安装完成,执行systemctl status mamcached,查看状态,出现下图说明成功
五、安装配置管理服务(Etcd)
OpenStack services may use Etcd, a distributed reliable key-value store for distributed key locking, storing configuration, keeping track of service live-ness and other scenarios.
OpenStack 服务可以使用 Etcd,这是一种分布式的可靠密钥值存储,用于分布式密钥锁定、存储配置、跟踪服务活性和其他场景。
1、安装
yum install etcd
2、编辑/etc/ETCD/ETCD.conf 文件并将 ETCD _ INITIAL _ CLUSTER,ETCD _ INITIAL _ ADVERTISE _ PEER _ URLS,ETCD _ ADVERTISE _ CLIENT _ URLS,ETCD _ LISTEN _ CLIENT _ URLS 设置为控制器节点的管理 IP 地址,使其他节点能够通过管理网络进行访问:
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://10.0.0.11:2380"
ETCD_LISTEN_CLIENT_URLS="http://10.0.0.11:2379"
ETCD_NAME="controller"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.0.0.11:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://10.0.0.11:2379"
ETCD_INITIAL_CLUSTER="controller=http://10.0.0.11:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
3、设置etcd开机启动
systemctl enable etcd
4、启动etcd服务
systemctl start etcd
至此,etcd安装成功。执行systemctl status etcd,出现下图即为成功
openstack依赖的第三方服务就是以上这些,到这就全部安装完成了
要是实在不放心,可以通过netstat -nltp查看所有端口,来验证所有服务是否安装成功