本文档为安装 OpenStack 的准备环境
由于电脑配置问题,所以只分配两个虚机
- 硬件配置 4 核 8 G,50 G硬盘,其中处理器需要开机虚拟化功能(如图所示)
- 虚拟机需要配置双网卡
仅主机网卡作为 controller 管理地址
桥接网卡作为连接外网和 Self-Service Networks 配置
- 版本:CentOS 7.9.2009
controller节点IP: 172.16.30.30
compute节点IP: 172.16.30.30
OpenStack 需要安装
- MariaDB 数据库
- memcached 缓存
- RabbitMQ 消息队列处理
- etcd 分布式键值库(选装)
节点服务器命名,controller 节点和 compute 节点分别执行
hostnamectl set-hostname controller
hostnamectl set-hostname compute
controller 节点和 compute 节点hosts文件配置:
cat << EOF >> /etc/hosts
172.16.30.30 controller
172.16.30.31 compute
EOF
controller 节点和 compute 节点都需要执行下述命令
getenforce 0
sed -i s'/=enforcing/=disabled/g' /etc/selinux/config
systemctl stop firewalld
systemctl disabled firewalld
systemctl disable firewalld
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo_bak
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum -y update
# 安装常用工具
yum install open-vm-tools tree dos2unix nc telnet lsof ntpdate bash-completion bash-completion-extras vim wget lrzsz net-tools -y
yum install python-openstackclient -y
yum install centos-release-openstack-train -y
# 重启系统一次(reboot)
controller 节点部署 rabbitmq
yum -y install rabbitmq-server
rabbitmq-plugins enable rabbitmq_management
systemctl enable rabbitmq-server
systemctl start rabbitmq-server
rabbitmqctl add_user openstack openstack
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
controller 节点部署 mariadb
yum install mariadb mariadb-server python2-PyMySQL
# vim /etc/my.cnf
...
[mysqld]
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
...
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation
controller 节点部署 memcached
yum install memcached python-memcached
# vim /etc/sysconfig/memcached
OPTIONS="-l 127.0.0.1,::1,controller"
systemctl enable memcached.service
systemctl start memcached.service
controller 节点部署 etcd
yum install etcd
# grep "^[^#]" /etc/etcd/etcd.conf
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://172.16.30.30:2380"
ETCD_LISTEN_CLIENT_URLS="http://172.16.30.30:2379"
ETCD_NAME="controller"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://172.16.30.30:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://172.16.30.30:2379"
ETCD_INITIAL_CLUSTER="controller=http://172.16.30.30:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
systemctl enable etcd
systemctl start etcd
至此,服务器的准备工作已经完毕
安装完毕后服务启动情况
[root@controller ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 19744/epmd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1149/sshd
tcp 0 0 0.0.0.0:15672 0.0.0.0:* LISTEN 22036/beam.smp
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1593/master
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 22036/beam.smp
tcp 0 0 172.16.30.30:2379 0.0.0.0:* LISTEN 26940/etcd
tcp 0 0 172.16.30.30:11211 0.0.0.0:* LISTEN 26262/memcached
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 26262/memcached
tcp 0 0 172.16.30.30:2380 0.0.0.0:* LISTEN 26940/etcd
tcp6 0 0 :::4369 :::* LISTEN 19744/epmd
tcp6 0 0 :::22 :::* LISTEN 1149/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1593/master
tcp6 0 0 :::5672 :::* LISTEN 22036/beam.smp
tcp6 0 0 :::3306 :::* LISTEN 25142/mysqld
tcp6 0 0 ::1:11211 :::* LISTEN 26262/memcached