OpenStack(Queens)详细安装部署(一)-基础环境安装

本文为扶艾原创文章,版权所有,禁止转载!

本系列文章将在CentOS7环境下手动安装OpenStack Q版本,手动安装对大家问题定位能力有极大的帮助。文章如果有不正确的地方欢迎大家留言指出。

附上自动化安装教程:20分钟自动化安装OpenStack

一、安装环境准备

OpenStack官方的硬件要求如下图所示,其中虚线节点是可选部分,是块存储节点与对象存储节点,本次我们暂不安装。

OpenStack(Queens)详细安装部署(一)-基础环境安装_第1张图片

本次将搭建一个简单的OpenStack平台,你需要服务器或虚拟机两台,一台作为OpenStack的控制节点,一台作为计算节点。

其中,控制节点将完成消息队列、数据库、ntp以及OpenStack相关的认证服务、镜像服务、计算服务、网络服务、界面服务的安装。计算节点将完成计算服务、网络服务的安装。

博主条件有限,使用virtual box创建了两台虚拟机具体配置如下:

1.1 硬件配置

  • 控制节点: cpu 1 ,内存 2G,网卡 2张,存储 25G
  • 计算节点: cpu 1 ,内存 2G,网卡 2张,存储 25G

1.2 操作系统

  • CentOS-7-x86_64-DVD-1708.iso
    ( 官网下载地址:http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1708.iso )

1.3 配置ip地址

ip地址大家根据自己实际情况而定
- 控制节点第一张网卡:192.168.0.77
- 控制节点第二张网卡:
- 计算节点第一张网卡:192.168.0.78
- 计算几点第二张网卡:

1.4 修改主机名

编辑文件/etc/hostname,删除原有内容,然后添加自己的主机名

控制节点

controller

计算节点

compute

注意:修改完成之后如果没生效,可以退出登录一次或者重启一次。

1.5 增加主机名解析

在控制节点和计算节点编辑/etc/hosts,在其中增加如下内容:

192.168.0.77 controller
192.168.0.78 compute

完成这步后,即可通过主机名互相访问。

1.6 关闭防火墙

关闭防火墙是因为踩了很多坑!
在控制节点与计算节点执行下面的操作。

# systemctl disable firewalld
# systemctl stop firewalld

禁用selinux,避免踩坑!编辑/etc/selinux/config,将enforcing修改为disabled。

SELINUX=disabled

selinux的设置需要重启节点才能生效。

1.7 准备yum本地源

安装OpenStack的过程中下载安装包是比较慢的,因此OpenStack核心组件所有需要用到的rpm包我们已经下载并制作成了iso文件,有了这个iso文件我们就可以完全本地安装了。扫描文章下方二维码,关注扶艾微信公众号,回复fuAi_qrpm即可获取!

  • 将下载完成的fuai_openstack_q.iso拷贝到控制节点与计算节点
  • 创建iso挂载文件目录,并挂载iso
# mkdir /opt/fuAi
# mount fuai_openstack_q.iso /opt/fuAi
  • 设置开机自动挂载
# echo 'mount /root/fuai_openstack_q.iso /opt/fuAi' >>/etc/rc.local
# chmod -R 777 /etc/rc.d/rc.local
  • 备份原有的repo文件,并创建fuAi.repo文件
# cd /etc/yum.repos.d/
# mkdir bak
# mv CentOS* bak
# vi fuAi.repo
[fuAi]
name=fuAi
baseurl=file:///opt/fuAi/
gpgcheck=0
  • 测试下本地源是否生效了,先安装个vim压压惊!
# yum install vim -y

不出意外,vim安装成功。

至此,我们所有的准备工作已经完成,接下来就将进入OpenStack的正式安装。

二、OpenStack基础环境安装

注意:后面的安装的步骤中,博主会在标题前的括号中注明该步骤在哪个节点执行,这个很重要!

2.1 (控制节点)安装ntp服务

因为设置了本地源,后面的yum安装应该都很爽!
- 安装chrony

# yum install chrony -y
  • 编辑配置文件/etc/chrony.conf增加以下内容:
server controller iburst
allow 192.168.0.0/24       #这个根据自己子网情况
  • 设置服务的开机启动,并启动服务
# systemctl enable chronyd
# systemctl start chronyd

2.2 (计算节点)安装ntp服务

  • 安装chrony
# yum install chrony -y
  • 编辑配置文件/etc/chrony.conf增加如下内容:
server controller iburst
  • 设置服务的开机启动,并启动服务
# systemctl enable chronyd
# systemctl start chronyd

2.3 (控制节点、计算节点)升级软件包,安装OpenStack客户端
- 升级软件包

# yum upgrade

注意:升级完成之后重启节点

  • 安装OpenStack客户端
# yum install python-openstackclient -y
  • 安装openstack-selinux
# yum install openstack-selinux -y

2.4 (控制节点)sql数据库安装

  • 安装软件包
# yum install mariadb mariadb-server python2-PyMySQL -y
  • 创建并编辑文件/etc/my.cnf.d/openstack.cnf增加如下内容:
[mysqld]
bind-address = 192.168.0.77

default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
  • 设置数据库服务的开机启动,并启动服务
# systemctl enable mariadb.service
# systemctl start mariadb.service
  • 为数据库设置密码
# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):   #这里直接回车
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password:              #设置数据库的root密码,我设置的fuai123
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

2.5 (控制节点)安装消息队列

  • 安装软件包
# yum install rabbitmq-server -y
  • 设置消息队列服务的开机自启,并启动服务
# systemctl enable rabbitmq-server.service
# systemctl start rabbitmq-server.service
  • 添加openstack用户并设置openstack使用消息队列的权限

注意:下面的fuai123是我自己设置的openstack使用消息队列的密码,可以自行设置

# rabbitmqctl add_user openstack fuai123
Creating user "openstack" ...

# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...

2.6 (控制节点)安装memcached服务

  • 安装软件包
# yum install memcached python-memcached -y
  • 编辑/etc/sysconfig/memcached文件设置以下内容
OPTIONS="-l 127.0.0.1,::1,controller"
  • 设置服务开机自启动,并启动服务
# systemctl enable memcached.service
# systemctl start memcached.service

2.7 (控制节点)安装etcd服务

  • 下载软件包
# yum install etcd -y
  • 编辑文件/etc/etcd/etcd.conf设置以下内容
#[Member]
#ETCD_CORS=""
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
#ETCD_WAL_DIR=""
ETCD_LISTEN_PEER_URLS="http://localhost:2380"
ETCD_LISTEN_CLIENT_URLS="http://localhost:2379"
#ETCD_MAX_SNAPSHOTS="5"
#ETCD_MAX_WALS="5"
ETCD_NAME="controller"
#ETCD_SNAPSHOT_COUNT="100000"
#ETCD_HEARTBEAT_INTERVAL="100"
#ETCD_ELECTION_TIMEOUT="1000"
#ETCD_QUOTA_BACKEND_BYTES="0"
#ETCD_MAX_REQUEST_BYTES="1572864"
#ETCD_GRPC_KEEPALIVE_MIN_TIME="5s"
#ETCD_GRPC_KEEPALIVE_INTERVAL="2h0m0s"
#ETCD_GRPC_KEEPALIVE_TIMEOUT="20s"
#
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
#ETCD_DISCOVERY=""
#ETCD_DISCOVERY_FALLBACK="proxy"
#ETCD_DISCOVERY_PROXY=""
#ETCD_DISCOVERY_SRV=""
ETCD_INITIAL_CLUSTER="controller=http://localhost:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new" 
  • 设置开机服务自启动,并启动服务
# systemctl enable etcd
# systemctl start etcd

至此,OpenStack基础环境已经安装完成,下面将进行认证服务的安装,具体请参见文章《OpenStack(Queens)详细安装部署(二)》

更多精彩内容,OpenStack干货请扫描下方二维码,关注我们微信公众号“扶艾”!
OpenStack(Queens)详细安装部署(一)-基础环境安装_第2张图片

你可能感兴趣的:(openstack)