openstack基础服务安装部署

一,环境准备

1,修改主机名称并写到hosts文件

  • hostnamectl set-hostname controller(控制节点)

  • hostnamectl set-hostname compute1(计算节点)

  • vim  /etc/hosts
    172.27.1.243 controller
    172.27.1.244 compute1
    

2,安装openstack

  • 获取最新base源

​ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  • 建立缓存

​ yum makecache

  • 获取当前源下所有openstack版本
 yum list | grep openstack*

centos-release-openstack-queens.noarch      1-2.el7.centos             extras   
centos-release-openstack-rocky.noarch       1-1.el7.centos             extras   
centos-release-openstack-stein.noarch       1-1.el7.centos             extras   
centos-release-openstack-train.noarch       1-1.el7.centos             extras
  • 安装最新版(19年12月最新版为train版)的openstack源

    yum install centos-release-openstack-train.noarch -y

  • 安装最新版openstack客户端、openstack SELinux管理包(控制端与计算节点安装,其它不需要)

    yum install python-openstackclient openstack-selinux -y (执行后需等待一段时间)

3,时间同步

yum install chrony  -y #控制节点和计算节点都需要安装
vim /etc/chrony.conf

#主节点修改 远程时间同步服务器,并允许计算节点网段同步
server ntp6.aliyun.com
allow 172.27.1.244/24
#启动控制节点ntp服务
systemctl enable chronyd.service
systemctl start chronyd.service
#验证NTP服务
chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^? 203.107.6.88                  2   6     1    42  -49955m[-49955m] +/-   33ms


#计算节点修改server为控制节点ip
server  172.27.1.243 iburst
#启动计算节点ntp服务
systemctl enable chronyd.service
systemctl start chronyd.service

#验证NTP服务
chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 172.27.1.243                   3   6    17     5  +5491ns[+1132ns] +/-   59ms

二,安装配置数据库( 仅在控制节点安装即可

yum -y install  mariadb mariadb-server python2-PyMySQL 

#创建并编辑 /etc/my.cnf.d/openstack.cnf,然后完成如下动作:
[mysqld]
bind-address = 172.27.1.243 # 值为控制节点的IP地址以使得其它节点可以访问数据库:
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

systemctl start mariadb.service  #启动数据库

mysql_secure_installation  #初始化mysql密码,建议设置,否则后期使用会有坑 


三,安装NoSQL数据库

因为搭建的是私有云,而nosql主要是用于计费系统,所以此次不必要安装nosql,所以博客并未进行操作,

四,安装消息队列(rabbitmq, 在控制节点安装即可

yum -y install rabbitmq-server

systemctl enable rabbitmq-server
systemctl restart rabbitmq-server
#5672和25672端口启动说明rabbitmq启动成功

rabbitmqctl add_user openstack 123.com #添加用户和密码

rabbitmqctl set_permissions openstack ".*" ".*" ".*" #创建授权,依次为 读,写,配置的权限

rabbitmq-plugins enable rabbitmq_management #启动管理插件,为以后做监控做准备
#启动之后由起了一个15672端口,可以直接访问到web界面,用户名密码默认都是guest

一,openstack基础服务部署_mysql

五,安装memcache( 在控制节点安装即可

yum install memcached python-memcached -y
sed -i 's#127.0.0.1#0.0.0.0#g' /etc/sysconfig/memcached #必须修改 否则计算节点连不上
systemctl restart memcached.service
systemctl enable memcached.service