Openstack镜像服务glance安装

创建glance数据库

1进入数据库

$ mysql -u root -p

2 Create the glance databese 创建一个glance数据库

MariaDB [(none)]> CREATE DATABASE glance;

3 Grant 给数据库赋予权限

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \

  IDENTIFIED BY 'GLANCE_DBPASS';

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \

  IDENTIFIED BY 'GLANCE_DBPASS';

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'用户名' \ IDENTIFIED BY 'GLANCE_DBPASS';

 

4 Source the admin credentials to gain access to admin-only CLI commands:

$ . admin-openrcz

 

5 创建服务:

Create the glance user:

$ openstack user create --domain default --password-prompt glance

User Password:

Repeat User Password:

 

Add the admin role to the glance user and service project:

$ openstack role add --project service --user glance admin

service为服务用户可更改

6创建glance服务:

$ openstack service create --name glance \

  --description "OpenStack Image" image

 

7 创建api镜像文件:

$ openstack endpoint create --region RegionOne \

  image public http://controller:9292

 

$ openstack endpoint create --region RegionOne \

  image internal http://controller:9292

 

$ openstack endpoint create --region RegionOne \

  image admin http://controller:9292

 

 

 

Install and configure components

8安装需要的包:

# yum install openstack-glance

编辑 /etc/glance/glance-api.conf 下的配置:

In the [database] section, configure database access:

[database]

# ...

connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance

GLANCE_DBPASS为自己的密码  controller为自己的ip

In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access:

[keystone_authtoken]

# ...

auth_uri = http://controller:5000

auth_url = http://controller:5000

memcached_servers = controller:11211

auth_type = password

project_domain_name = Default

user_domain_name = Default

project_name = service

username = glance

password = GLANCE_PASS

#controller为自己的ip

#glance_pass为自己的密码

#service为自己的服务用户

[paste_deploy]

# ...

flavor = keystone

 

9打开[glance_store] section, 开启此目录下的文件:

[glance_store]

# ...

stores = file,http

default_store = file

filesystem_store_datadir = /var/lib/glance/images/

编辑/etc/glance/glance-registry.conf 目录下的文件操作:

In the [database] section, configure database access:

[database]

# ...

connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance

GLANCE_DBPASS为自己的密码  controller为自己的ip

In the [keystone_authtoken] and [paste_deploy] sections, configure Identity service access:

[keystone_authtoken]

# ...

auth_uri = http://controller:5000

auth_url = http://controller:5000

memcached_servers = controller:11211

auth_type = password

project_domain_name = Default

user_domain_name = Default

project_name = service

username = glance

password = GLANCE_PASS

#controller为自己的ip

#glance_pass为自己的密码

#service为自己的服务用户

 [paste_deploy]

# ...

flavor = keystone

10初始化数据库:

# su -s /bin/sh -c "glance-manage db_sync" glance

开启glance

# systemctl enable openstack-glance-api

  systemctl enable openstack-glance-registry

# systemctl start openstack-glance-api

  systemctl start openstack-glance-registry

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值