一、OpenStack环境准备及共享组件安装

一、OpenStack部署环境准备:

1、关闭防火墙所有虚拟机都要操作
# setenforce 0
# systemctl stop firewalld

2、域名解析所有虚拟机都要操作

# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.83.171 node1
192.168.83.173 node2
192.168.83.174 node3

3、测试外网的连通性,虚拟机使用net模式

4、使用公司源

# cat yum-repo.sh
mkdir /etc/yum.repos.d/old
mv /etc/yum.repos.d/C* /etc/yum.repos.d/old/
wget -O /etc/yum.repos.d/Centos7-Base-yunwei.repo 192.168.254.6/shell/Centos7-Base-yunwei.repo
wget -O /etc/yum.repos.d/epel-yunwei.repo 192.168.254.6/shell/epel-yunwei.repo
wget -O /etc/yum.repos.d/rdo-release-yunwei.repo 192.168.254.6/shell/rdo-release-yunwei.repo
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud 192.168.254.6/shell/RPM-GPG-KEY-CentOS-SIG-Cloud
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL- 192.168.254.6/shell/RPM-GPG-KEY-EPEL-

5、开启虚拟机的虚拟化功能

一、OpenStack环境准备及共享组件安装

6、虚拟机时间统一
1)下载ntp服务
# yum -y install ntp
2)配置文件
# vim /etc/ntp.conf
主节点:

#restrict 127.0.0.1 (注释)
restrict 0.0.0.0(改成所有ip)
#server .centos.pool.ntp.org iburst(注释)
#server .centos.pool.ntp.org iburst
#server .centos.pool.ntp.org iburst
#server .centos.pool.ntp.org iburst
server 127.127.1.0(同步本地主机)
fudge 127.127.1.0 stratum

其他节点

# server .centos.pool.ntp.org iburst(注释上述几行)
server 192.168.83.171 iburst(同步的主机ip)

3)所有节点重启ntp服务

# systemctl restart ntpd
# systemctl enable ntpd

二、OpenStack环境组件安装

由于我们配置好了公司的源,所以直接下载所需的组件

(1)OpenStack包:

1、安装启用OpenStack仓库的包
# yum install centos-release-openstack-ocata -y
2、安装OpenStack客户端
# yum install python-openstackclient -y
3、安装 openstack-selinux 软件包以便自动管理 OpenStack 服务的安全策略
# yum install openstack-selinux -y

(2)SQL数据库:
1、安装软件包
# yum install mariadb mariadb-server python2-PyMySQL -y
2、创建并编辑 /etc/my.cnf.d/openstack.cnf,然后完成如下动作:
在 [mysqld] 部分,设置 ``bind-address``值为控制节点的管理网络IP地址以使得其它节点可以通过管理网络访问数据库:
# cat /etc/my.cnf.d/openstack.cnf

[mysqld]
bind-address = 192.168.64.7 #绑定控制节点IP
default-storage-engine = innodb
innodb_file_per_table = on
max_connections =
collation-server = utf8_general_ci
character-set-server = utf8

3、启动数据库服务,并将其配置为开机自启

# systemctl enable mariadb.service
# systemctl start mariadb.service
4、为了保证数据库服务的安全性,运行``mysql_secure_installation``脚本
# mysql_secure_installation

(3)消息队列:

1、安装
# yum install rabbitmq-server -y

2、启动消息队列服务并将其配置为随系统启动
# systemctl enable rabbitmq-server.service
# systemctl start rabbitmq-server.service

3、添加 openstack 用户,密码为openstack
# rabbitmqctl add_user openstack openstack

4、给``openstack``用户配置写和读权限
# rabbitmqctl set_permissions openstack ".*" ".*" ".*"

5、将``openstack``用户设置为管理员
# rabbitmqctl set_user_tags openstack administrator

6、可以选择将rabbbitmq搭建成集群(可按照上篇博客介绍搭建)

(4)Memcached:
1、安装包
# yum install memcached python-memcached -y
2、编辑配置文件/etc/sysconfig/memcached

# cat /etc/sysconfig/memcached
PORT=""
USER="memcached"
MAXCONN=""
CACHESIZE=""
OPTIONS="-l 127.0.0.1,::1,192.168.64.7" #后面添加Ip即可(或者主机名)

3、启动并设置开机自启

# systemctl enable memcached.service
# systemctl start memcached.service

上一篇:mysql远程登录


下一篇:快速排序 Python 模板