专栏首页python3CentOS 7部署OpenStack(

CentOS 7部署OpenStack(

1、创建数据库

[root@controller ~]# mysql -u root -p -e "CREATE DATABASEglance;"

Enter password:

[root@controller ~]# mysql -u root -p -e "GRANT ALL PRIVILEGES ONglance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';"

Enter password:

[root@controller ~]# mysql -u root -p -e "GRANT ALL PRIVILEGES ONglance.* TO 'glance'@'%' IDENTIFIED BY 'glance';"

Enter password:

2、安装glance

[root@controller ~]# yum install -y openstack-glance python-glancepython-glanceclient

3、配置glance

3.1、同步数据库

[root@controller ~]# vim /etc/glance/glance-api.conf

538 connection=mysql://glance:glance@192.168.1.11/glance

[root@controller ~]# vim /etc/glance/glance-registry.conf

363 connection=mysql://glance:glance@192.168.1.11/glance

[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync"glance

3.2、创建glance用户

[root@controller ~]# source admin-openrc.sh

[root@controller ~]# openstack user create --domain default--password=glance glance

+-----------+----------------------------------+

| Field     | Value                            |

+-----------+----------------------------------+

| domain_id | default                          |

| enabled   | True                             |

| id        |c13d8e0ef83f466e95bdd4040284c52b |

| name      | glance                           |

+-----------+----------------------------------+

[root@controller ~]# openstack role add --project service --user glanceadmin

3.3、配置glance-api

3.3.1、配置连接keystone

[root@controller ~]# vim /etc/glance/glance-api.conf

973 [keystone_authtoken]

974 auth_uri = http://192.168.1.11:5000

975 auth_url = http://192.168.1.11:35357

976 auth_plugin = password

977 project_domain_id = default

978 user_domain_id = default

979 project_name = service

980 username = glance

981 password = glance

1484 flavor=keystone

3.3.2、配置不使用消息队列

[root@controller ~]# vim /etc/glance/glance-api.conf

491 notification_driver = noop

3.3.3、配置镜像存放位置

[root@controller ~]# vim /etc/glance/glance-api.conf

642 default_store=file

701 filesystem_store_datadir=/var/lib/glance/p_w_picpaths/

3.4、配置glance-registry

3.4.1、配置连接keystone

[root@controller ~]# vim /etc/glance/glance-registry.conf

762 [keystone_authtoken]

763 uth_uri = http://192.168.1.11:5000

764 auth_url = http://192.168.1.11:35357

765 auth_plugin = password

766 project_domain_id = default

767 user_domain_id = default

768 project_name = service

769 username = glance

770 password = glance

1256 flavor=keystone

3.5、注册到keystone

[root@controller ~]# openstack service create --name glance --description"OpenStack Image service" p_w_picpath

+-------------+----------------------------------+

| Field       | Value                            |

+-------------+----------------------------------+

| description | OpenStack Image service          |

| enabled     | True                             |

| id          |9d7176f5cfab47aa99789159dd8ea8a2 |

| name        | glance                           |

| type        | p_w_picpath                            |

+-------------+----------------------------------+

[root@controller ~]# openstack endpoint create --region RegionOne   p_w_picpath public http://192.168.1.11:9292

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           |e8c6bfd66506449094a2aab994e7a4be |

| interface    | public                           |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   |9d7176f5cfab47aa99789159dd8ea8a2 |

| service_name | glance                           |

| service_type | p_w_picpath                            |

| url          | http://192.168.1.11:9292         |

+--------------+----------------------------------+

[root@controller ~]# openstack endpoint create --region RegionOne   p_w_picpath internal http://192.168.1.11:9292

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           |3b18ac8bd0764d009451223f26dccede |

| interface    | internal                         |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   |9d7176f5cfab47aa99789159dd8ea8a2 |

| service_name | glance                           |

| service_type | p_w_picpath                            |

| url          |http://192.168.1.11:9292         |

+--------------+----------------------------------+

[root@controller ~]# openstack endpoint create --region RegionOne   p_w_picpath admin http://192.168.1.11:9292

+--------------+----------------------------------+

| Field        | Value                            |

+--------------+----------------------------------+

| enabled      | True                             |

| id           | db9f2e251e26413d836bacd725677426|

| interface    | admin                            |

| region       | RegionOne                        |

| region_id    | RegionOne                        |

| service_id   |9d7176f5cfab47aa99789159dd8ea8a2 |

| service_name | glance                           |

| service_type | p_w_picpath                            |

| url          |http://192.168.1.11:9292         |

+--------------+----------------------------------+

4、启动glance

[root@controller ~]# systemctl enable openstack-glance-api

[root@controller ~]# systemctl enable openstack-glance-registry

[root@controller ~]# systemctl start openstack-glance-api

[root@controller ~]# systemctl start openstack-glance-registry

5、添加glance环境变量

[root@controller ~]# echo "export OS_IMAGE_API_VERSION=2" \

| tee -a admin-openrc.sh kevin-openrc.sh

6、验证是否安装成功

[root@controller ~]# glance p_w_picpath-list

+----+------+

| ID | Name |

+----+------+

+----+------+

7、上传镜像

下载cirros镜像,该镜像为大约13M大小的镜像

[root@controller ~]# wget https://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

[root@controller ~]# rm -f cirros-0.3.4-x86_64-disk.img

[root@controller ~]#

[root@controller ~]# glance p_w_picpath-create --name "cirros" \

--file cirros-0.3.4-x86_64-disk.img \

--disk-format qcow2 --container-format bare \

--visibility public --progress    //要在镜像当前目录执行

[=============================>] 100%

+------------------+--------------------------------------+

| Property         | Value                                |

+------------------+--------------------------------------+

| checksum         |ee1eca47dc88f4879d8a229cc70a07c6     |

| container_format | bare                                 |

| created_at       |2015-12-28T07:20:25Z                 |

| disk_format      | qcow2                                |

| id               |de72b13d-3f0f-4292-9afa-30c94175c3b5 |

| min_disk         | 0                                    |

| min_ram          | 0                                    |

| name             | cirros                               |

| owner            |69d1967e59d247e6b7c4c3937d5baa89     |

| protected        | False                                |

| size             | 13287936                             |

| status           | active                               |

| tags             | []                                   |

| updated_at       |2015-12-28T07:20:26Z                 |

| virtual_size     | None                                 |

| visibility       | public                               |

+------------------+--------------------------------------+

root@controller ~]# glance p_w_picpath-list

+--------------------------------------+--------+

| ID                                   | Name   |

+--------------------------------------+--------+

| de72b13d-3f0f-4292-9afa-30c94175c3b5 | cirros |

+--------------------------------------+--------+

Linux运维开发技术交流群:298324302

北京linux运维求职招聘群:153677549

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • Ubuntu16.10安装Ocata之3

    root@controller:~/ocata# mysql -uroot -p -e "CREATE DATABASE glance"

    py3study
  • Linux入门笔记3

    一、管理权限和归属 1.权限概述 文档归属 所有者(u):拥有此文件/目录的用户-user 所属组(g):拥有此文件/目录的组-group 其他用户(o):除所...

    py3study
  • python中的有序字典

     字典是python开发中的一种常用的数据结构,但是它在迭代时并不是按照元素的顺序进行,可能在某些场景下无法满足我们的需求,这就引入了有序字典

    py3study
  • 使用Typescript重写axios

    使用typescript-library-starter脚手架创建项目ts-axios

    lilugirl
  • OD条件与消息断点的设置方法

    用户2135432
  • Linux 用Sendmail架设Mail服务器

      人们在互联网上最常使用的就是电子邮件了,很多企业用户也经常使用免费的电子邮件系统。今天我就给大家介绍一种在Red Hat Linux 9.0环境下运行的邮件...

    阳光岛主
  • 饿了么丝滑无缝过度搜索栏的实现

    用户1907613
  • 003.Ansible基础使用

    Ansible命令行执行方式有:Ad-Hoc、Ansible-playbook两种,Web方式其官方提供付费产品Tower。Ad-Hoc主要用于临时命令的执行,...

    木二
  • 网易云音乐的消息队列改造之路

    网易云音乐自2013年上线后,业务保持了高速增长。云音乐除了提供好听的音乐外,还留下了我们在乐和人上的美好回忆。本文整理自网易云音乐消息队列负责人林德智在近期 ...

    用户1516716
  • 网易云音乐的消息队列改造之路

    网易云音乐自2013年上线后,业务保持了高速增长。云音乐除了提供好听的音乐外,还留下了我们在乐和人上的美好回忆。本文整理自网易云音乐消息队列负责人林德智在近期 ...

    哲洛不闹

扫码关注云+社区

领取腾讯云代金券