centos7上安装0penStack

centos7上安装0penStack

author:headsen chen

2017-10-09  20:41:54

个人原创,欢迎转载,请注明作者,出去,否则依法追究责任

一,准备工作(配置ip地址,主机名,yum包安装)

--------------------------------------------------------------------------------------------------------------------------

[root@localhost network-scripts]# uname -a
Linux controller 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost network-scripts]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

vim ifcfg-eno16777736
 systemctl restart network
[root@localhost network-scripts]# ifconfig

eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.11 netmask 255.255.255.0 broadcast 10.0.0.255
i

eno33554984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.13.148 netmask 255.255.255.0 broadcast 192.168.13.255

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500

确保能ping通外网:

ping baidu.com

设置主机名:

hostname controller
 hostnamectl set-hostname controller
设置主机名解析地址:
vim /etc/hosts

centos7上安装0penStack

ping自己能通

centos7上安装0penStack

确保时间正确
centos7上安装0penStack

查看yum源,确保没有安装epel的扩展库

yum clean all
 yum repolist

安装openstack的扩展源:

yum install centos-release-openstack-newton
升级yum的安装包仓库

yum  upgrade

reboot   -----------------------------------------(一定要重启,否则后面的做会报错,因为内核等文件有可能改变了)

centos7上安装0penStack

yum install python-openstackclient
yum install openstack-selinux

二,安装OpenStack的各个组件:

---------------------------------------------------------------------------------------------------------------------------------------------------------

安装数据库:

yum install mariadb mariadb-server python2-PyMySQL

新建并编辑一个openstack的配置文件

centos7上安装0penStack

启动数据库:

systemctl enable mariadb.service

systemctl start mariadb.service

设置root密码,移除匿名用户,运行root远程登录,删除test库,加载设置

mysql_secure_installation

安装消息队列:

yum install rabbitmq-server

启动消息队列服务并将其配置为随系统启动:

systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service

添加 openstack 用户并设置密码为RABBIT_PASS:

[root@controller ~]# rabbitmqctl add_user openstack RABBIT_PASS
Creating user "openstack" ...
[root@controller ~]#

给``openstack``用户配置写和读权限:

[root@controller ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...
[root@controller ~]#

centos7上安装0penStack

安装memcached,缓存服务memecached运行在控制节点

yum install memcached python-memcached -y
systemctl enable memcached.service
systemctl start memcached.service

centos7上安装0penStack

三,安装认证服务

,1,在你配置 OpenStack 身份认证服务前,你必须创建一个数据库和管理员令牌

用数据库连接客户端以 root 用户连接到数据库服务器:

mysql -u root -p

创建 keystone 数据库:

CREATE DATABASE keystone;

对``keystone``数据库授予恰当的权限:

GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'  IDENTIFIED BY 'KEYSTONE_DBPASS';

GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'KEYSTONE_DBPASS';(若只有这一条则不行,不能再本地登录,所以必需两条都加上)

这里的用户密码设为: KEYSTONE_DBPASS

centos7上安装0penStack

退出数据库

2, 生成一个随机值在初始的配置中作为管理员的令牌。

[root@controller ~]# openssl rand -hex 10

centos7上安装0penStack

使用带有``mod_wsgi``的Apache HTTP服务器来服务认证服务请求,端口为5000和35357。缺省情况下,Kestone服务仍然监听这些端口。然而,本教程手动禁用keystone服务。

3,安装openstack的认证组件:keystone

yum install openstack-keystone httpd mod_wsgi

vim /etc/keystone/keystone.conf

centos7上安装0penStack

4,初始化身份认证服务的数据库(又叫同步数据库,在数据库keystone中生成一些表):

su -s /bin/sh -c "keystone-manage db_sync" keystone  (忽略输出中任何不推荐使用的信息。)

初始化Fernet keys:

keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone

centos7上安装0penStack

5,配置 Apache HTTP 服务器

编辑``/etc/httpd/conf/httpd.conf`` 文件,配置``ServerName`` 选项为控制节点:

vim /etc/httpd/conf/httpd.conf

centos7上安装0penStack

创建文件:vim /etc/httpd/conf.d/wsgi-keystone.conf,内容如下

Listen 5000
Listen 35357 <VirtualHost *:5000>
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-public
WSGIScriptAlias / /usr/bin/keystone-wsgi-public
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
ErrorLogFormat "%{cu}t %M"
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined <Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost> <VirtualHost *:35357>
WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-admin
WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
ErrorLogFormat "%{cu}t %M"
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined <Directory /usr/bin>
Require all granted
</Directory>
</VirtualHost>

centos7上安装0penStack

启动 Apache HTTP 服务并配置其随系统启动:

systemctl enable httpd.service

systemctl start httpd.service

6,身份认证服务提供服务的目录和他们的位置。每个你添加到OpenStack环境中的服务在目录中需要一个 service 实体和一些 API endpoints 。

默认情况下,身份认证服务数据库不包含支持传统认证和目录服务的信息。你必须使用:doc:keystone-install 章节中为身份认证服务创建的临时身份验证令牌用来初始化的服务实体和API端点

[root@controller ~]# export OS_TOKEN=ADMIN_TOKEN
[root@controller ~]# export OS_TOKEN=6d6817ef2478a89cc6cc
[root@controller ~]# export OS_URL=http://controller:35357/v3
[root@controller ~]# export OS_IDENTITY_API_VERSION=3
centos7上安装0penStack

7,创建服务实体和身份认证服务:(在你的Openstack环境中,认证服务管理服务目录。服务使用这个目录来决定您的环境中可用的服务。)

openstack service create --name keystone --description "OpenStack Identity" identity

centos7上安装0penStack

centos7上安装0penStack

身份认证服务管理了一个与您环境相关的 API 端点的目录。服务使用这个目录来决定如何与您环境中的其他服务进行通信。

OpenStack使用三个API端点变种代表每种服务:admin,internal和public。默认情况下,管理API端点允许修改用户和租户而公共和内部APIs不允许这些操作。在生产环境中,处于安全原因,变种为了服务不同类型的用户可能驻留在单独的网络上。对实例而言,公共API网络为了让顾客管理他们自己的云在互联网上是可见的。管理API网络在管理云基础设施的组织中操作也是有所限制的。内部API网络可能会被限制在包含OpenStack服务的主机上。此外,OpenStack支持可伸缩性的多区域。为了简单起见,本指南为所有端点变种和默认``RegionOne``区域都使用管理网络。

创建认证服务的 API 端点:

openstack service create --name keystone --description "OpenStack Identity" identity
The request you have made requires authentication. (HTTP 401) (Request-ID: req-1407fbf2-e274-4f51-aa48-c309640f1c6a)
[root@controller ~]# openstack endpoint create --region RegionOne  identity public http://controller:5000/v3
The request you have made requires authentication. (HTTP 401) (Request-ID: req-93240dd6-7757-42e0-933f-5dcd13b29a9b)
[root@controller ~]# openstack endpoint create --region RegionOne  identity internal http://controller:5000/v3
The request you have made requires authentication. (HTTP 401) (Request-ID: req-1e21beda-1c4e-43c2-bd46-474afb989538)
[root@controller ~]# openstack endpoint create --region RegionOne  identity admin http://controller:35357/v3
The request you have made requires authentication. (HTTP 401) (Request-ID: req-8cbbcaeb-6d58-4889-a7c1-1ed93b114ad2)
[root@controller ~]#

centos7上安装0penStack

8,创建域、项目、用户和角色(身份认证服务为每个OpenStack服务提供认证服务。认证服务使用 T domains, projects (tenants), :term:`users<user>`和 :term:`roles<role>`的组合。)

上一篇:[NOIP2018]赛道修建


下一篇:51nod1821 最优集合 贪心