# 在控制节点上执行 hostnamectl set-hostname controller echo ‘ # controller 192.168.182.143 controller # compute1 192.168.182.142 compute1 ‘>>/etc/hosts # 在计算节点上执行 hostnamectl set-hostname compute1 echo ‘ # controller 192.168.182.143 controller # compute1 192.168.182.142 compute1 ‘>>/etc/hosts
systemctl stop firewalld.service systemctl disable firewalld.service systemctl status firewalld.service setenforce 0 getenforce sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g‘ /etc/sysconfig/selinux grep SELINUX=disabled /etc/sysconfig/selinux
# 在所有的节点上执行
yum install chrony -y
vim /etc/chrony.conf # 在控制节点上配置 # 去掉原有的server server ntp6.aliyun.com iburst allow 192.168.182.0/24
vim /etc/chrony.conf # 在计算节点上配置 # 去掉原有的server server 192.168.182.143 iburst allow 192.168.182.0/24
systemctl restart chronyd.service
systemctl status chronyd.service
systemctl enable chronyd.service
systemctl list-unit-files |grep chronyd.service
timedatectl set-timezone Asia/Shanghai chronyc sources timedatectl status
mv -f /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install centos-release-openstack-rocky -y
yum clean all
yum makecache
# 也可以手动创建OpenStack的阿里云yum源地址
echo ‘[centos-openstack-rocky] name=CentOS-7 - OpenStack rocky baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud [centos-openstack-rocky-test] name=CentOS-7 - OpenStack rocky Testing baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/ gpgcheck=0 enabled=0 [centos-openstack-rocky-debuginfo] name=CentOS-7 - OpenStack rocky - Debug baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud [centos-openstack-rocky-source] name=CentOS-7 - OpenStack rocky - Source baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-rocky/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud [rdo-trunk-rocky-tested] name=OpenStack rocky Trunk Tested baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/rdo-trunk-rocky-tested/ gpgcheck=0 enabled=0‘>/etc/yum.repos.d/CentOS-OpenStack-Rocky.repo
yum update -y
yum install python-openstackclient openstack-selinux -y
yum install mariadb mariadb-server MySQL-python python2-PyMySQL -y
vim /etc/my.cnf.d/mariadb_openstack.cnf # 在[mysqld]添加以下配置 # ----------------------------------- [mysqld] bind-address = 0.0.0.0 default-storage-engine = innodb innodb_file_per_table = on max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8 init-connect = ‘SET NAMES utf8‘ # -----------------------------------
systemctl restart mariadb.service
systemctl status mariadb.service
systemctl enable mariadb.service
systemctl list-unit-files |grep mariadb.service
# 最后安全初始化,运行``mysql_secure_installation``脚本
mysql_secure_installation
步骤依次如下:
回车
n
Y
Y
Y
Y
# 重启服务
systemctl restart mariadb.service
yum install rabbitmq-server -y
# 监听端口:5672,15672
systemctl start rabbitmq-server.service systemctl status rabbitmq-server.service systemctl enable rabbitmq-server.service systemctl list-unit-files |grep rabbitmq-server.service # 查看端口开启情况 ss -ntl | egrep "5672|15672"
# 添加openstack用户和密码,配置用户权限,配置读,写权限
rabbitmqctl add_user openstack openstack rabbitmqctl set_permissions openstack ".*" ".*" ".*" rabbitmqctl set_permissions -p "/" openstack ".*" ".*" ".*"
# 启用web管理插件,需要重启服务使之生效
rabbitmq-plugins enable rabbitmq_management systemctl restart rabbitmq-server.service rabbitmq-plugins list lsof -i:15672
# web访问:http://192.168.182.143:15672
# 认证服务认证缓存使用Memcached缓存令牌。缓存服务memecached运行在控制节点。在生产部署中,推荐联合启用防火墙、认证和加密保证它的安全。
yum install memcached python-memcached -y
# 修改配置,改成本机的IP地址,为了外部能访问 sed -i ‘s#127.0.0.1#192.168.182.143#g‘ /etc/sysconfig/memcached
systemctl start memcached.service systemctl status memcached.service netstat -anptl|grep memcached systemctl enable memcached.service systemctl list-unit-files |grep memcached.service
yum install etcd -y
vim /etc/etcd/etcd.conf ----------------------------------- #[Member] ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="http://192.168.182.143:2380" ETCD_LISTEN_CLIENT_URLS="http://192.168.182.143:2379" ETCD_NAME="controller" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.182.143:2380" ETCD_ADVERTISE_CLIENT_URLS="http://192.168.182.143:2379" ETCD_INITIAL_CLUSTER="controller=http://192.168.182.143:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01" ETCD_INITIAL_CLUSTER_STATE="new" ------------------------------------
# 注意上面的IP地址不能用controller替代,无法解析
systemctl start etcd.service systemctl status etcd.service netstat -anptl|grep etcd systemctl enable etcd.service systemctl list-unit-files |grep etcd.service
~~~至此,控制节点controller就完成基础环境的配置,下面可以开始安装 openstack 的组件~~~
Centos7安装部署OpenStack--01.系统环境准备
原文:https://www.cnblogs.com/liugp/p/12462189.html