系统centos7.9
节点 |
第一块网卡 |
controller |
192.168.75.20 |
compute |
192.168.75.21 |
主机名为all的代表在所有节点执行
1、修改hosts文件
[root@all ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.75.20 controller 192.168.75.21 compute |
2、关闭防火墙
[root@all ~]# systemctl stop firewalld [root@all ~]# systemctl disable firewalld
3、关闭selinux
[root@all ~]# setenforce 0 [root@all ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # # # enforcing - SELinux security policy is enforced. permissive - SELinux prints warnings instead of enforcing. disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three values: # # targeted - Targeted processes are protected, minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
4、配置网卡
controller节点
# 第一块网卡 [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE="Ethernet" BOOTPROTO="static" DEVICE="ens33" ONBOOT="yes" IPADDR="192.168.75.20" PREFIX="24" GATEWAY="192.168.75.2" DNS1="114.114.114.114"
# 第二块网卡 [root@controller ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens34 DEVICE=ens34 TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none |
compute节点
# 第一块网卡 [root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE="Ethernet" BOOTPROTO="static" DEVICE="ens33" ONBOOT="yes" IPADDR="192.168.75.21" PREFIX="24" GATEWAY="192.168.75.2" DNS1="114.114.114.114"
# 第二块网卡 [root@compute ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens34 DEVICE=ens34 TYPE=Ethernet ONBOOT="yes" BOOTPROTO="none |
重启网络服务
[root@all ~]# systemctl restart network
5、配置时间协议
# 安装时间同步协议 [root@all ~]# yum install chrony -y
# 修改时间协议配置文件 [root@all ~]# head -n 3 /etc/chrony.conf # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server ntp.aliyun.com iburst |
重启网络协议
[root@all ~]# systemctl restart chronyd [root@all ~]# systemctl enable chronyd
验证时间同步
[root@all ~]# chronyc sources 210 Number of sources = 1 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 203.107.6.88 2 6 37 8 -43us[+2308us] +/- 23ms |
6、安装openstack包
# 删除epel所有yum源,防止所带的安装包与官方冲突 [root@all ~]# rm -rf /etc/yum.repos.d/epel*
# 安装openstack的yum源包 [root@all ~]# yum install centos-release-openstack-train -y |
7、安装openstack客户端
# 在控制节点安装 [root@controller ~]# yum install python-openstackclient -y
# 在所有节点安装 [root@all ~]# yum -y install openstack-selinux |
8、安装数据库
# 安装mariadb等服务 [root@controller ~]# yum install mariadb mariadb-server python2-PyMySQL -y # 在mariadb的子配置文件夹创建openstack.cnf文件 [root@controller ~]# cat > /etc/my.cnf.d/openstack.cnf << 'EOF' [mysqld] bind-address = 192.168.75.20 default-storage-engine = innodb innodb_file_per_table = on max_connections = 4096 collation-server = utf8_general_ci character-set-server = utf8 EOF # 启动数据库 [root@controller ~]# systemctl start mariadb [root@controller ~]# systemctl enable mariadb # 数据库安全初始化 (可不做) [root@controller ~]# mysql_secure_installation
9、安装rabbitmq服务
# 安装rabbitmq服务 [root@controller ~]# yum -y install rabbitmq-server # 启动rabbitmq服务 [root@controller ~]# systemctl enable rabbitmq-server [root@controller ~]# systemctl start rabbitmq-server
# 建立openstack用户 [root@controller ~]# rabbitmqctl add_user openstack 000000 Creating user "openstack"
# 授权openstack权限 [root@controller ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*" Setting permissions for user "openstack" in vhost "/" # 报错 Error: unable to connect to node rabbit@localhost: nodedown
DIAGNOSTICS ===========
attempted to contact: [rabbit@localhost]
rabbit@localhost: * connected to epmd (port 4369) on localhost * epmd reports node 'rabbit' running on port 25672 * TCP connection succeeded but Erlang distribution failed
* Hostname mismatch: node "rabbit@ct" believes its host is different. Please ensure that hostnames resolve the same way locally and on "rabbit@ct"
current node details: - node name: 'rabbitmq-cli-12@ct' - home dir: /var/lib/rabbitmq - cookie hash: oV+N20QLBoBQrAgHFUTACg==
# 解决错误 1、确认主机名是否为controller 2、使用远程工具则重新开一个会话 3、重启虚拟机 |
10、安装memcached服务
# 安装memcached服务 [root@controller ~]# yum -y install memcached python-memcached
# 修改memcached配置文件 [root@controller ~]# vi /etc/sysconfig/memcached PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="128" OPTIONS="-l 127.0.0.1,::1,controller"
# 启动memcached [root@controller ~]# systemctl start memcached [root@controller ~]# systemctl enable memcached |
11、安装etcd服务
# 安装etcd服务 [root@controller ~]# yum -y install etcd
# 修改etcd配置文件 [root@controller ~]# cat > /etc/etcd/etcd.conf << 'EOF' #[Member] ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="http://192.168.75.20:2380" ETCD_LISTEN_CLIENT_URLS="http://192.168.75.20:2379" ETCD_NAME="controller" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.75.20:2380" ETCD_ADVERTISE_CLIENT_URLS="http://192.168.75.20:2379" ETCD_INITIAL_CLUSTER="controller=http://192.168.75.20:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01" ETCD_INITIAL_CLUSTER_STATE="new" EOF
# 启动etcd服务 [root@controller ~]# systemctl start etcd [root@controller ~]# systemctl enable etcd |