---
title: 安装Heat
description: "Heat提供基于模板的编排服务。请在控制节点安装Heat。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengcpfs/ecosystemEnable/OpenStack/kunpengopenstacktrain_04_025.html
sourcePath: /source/zh/kunpengcpfs/ecosystemEnable/OpenStack/kunpengopenstacktrain_04_025.html
indexId: 61526090d3016b09559c974f9fdd87fe0f54c688f79c61b04e07bf186ad144e682
---
# 安装Heat

Heat提供基于模板的编排服务。请在控制节点安装Heat。

1. 创建数据库、服务凭证和API端点。

  a. 以root用户登录数据库。

```
mysql -u root -p
```


  b. 在数据库中，创建Heat数据库并授权。
    1 2 3 CREATE DATABASE heat; GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY 'HEAT_DBPASS'; GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY 'HEAT_DBPASS';

    将HEAT_DBPASS替换为Heat数据库用户的密码，请根据实际需求进行设置。密码中请勿包含字符“#@$”，支持特殊字符“&=- _ . + ! * ()”


  c. 退出数据库。

```
exit
```


  d. 创建服务凭证，创建Heat用户，并为其增加admin角色。

```
source
~
/.admin-openrc
openstack user create --domain default --password-prompt heat
openstack role add --project service --user heat admin
```


    密码中请勿包含字符“#@$”，支持特殊字符“&=- _ . + ! * ()”

  e. 创建Heat和heat-cfn服务及其对应的API端点。

```
openstack service create --name heat --description "Orchestration" orchestration
openstack service create --name heat-cfn --description "Orchestration"  cloudformation
openstack endpoint create --region RegionOne orchestration public http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration internal http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne orchestration admin http://controller:8004/v1/%\(tenant_id\)s
openstack endpoint create --region RegionOne cloudformation public http://controller:8000/v1
openstack endpoint create --region RegionOne cloudformation internal http://controller:8000/v1
openstack endpoint create --region RegionOne cloudformation admin http://controller:8000/v1
```


  f. 创建stack管理的额外信息，包括heat domain及其对应domain的admin用户heat_domain_admin、heat_stack_owner角色和heat_stack_user角色。

```
openstack domain create --description "heat stack" heat
openstack user create --domain heat --password-prompt heat_domain_admin
openstack role add --domain heat --user-domain heat --user heat_domain_admin admin
openstack role create heat_stack_owner
openstack role create heat_stack_user
```


    密码中请勿包含字符“#@$”，支持特殊字符“&=- _ . + ! * ()”

2. 安装Heat软件包。

```
yum install openstack-heat-api openstack-heat-api-cfn openstack-heat-engine
```


3. 修改Heat配置文件。

  a. 打开文件。

```
vi /etc/heat/heat.conf
```


  b. 按“i”进入编辑模式，添加如下内容。

```
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASSWORD@controller
heat_metadata_server_url = http://controller:8000
heat_waitcondition_server_url = http://controller:8000/v1/waitcondition
stack_domain_admin = heat_domain_admin
stack_domain_admin_password = HEAT_DOMAIN_PASSWORD
stack_user_domain_name = heat
[database]
connection = mysql+pymysql://heat:HEAT_DBPASS@controller/heat
# 配置Keystone认证信息，配置文件中默认没有[keystone_authtoken]模块参数，需要新增。
[keystone_authtoken]
www_authenticate_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 = heat
password = HEAT_PASSWORD
[trustee]
auth_type = password
auth_url = http://controller:5000
username = heat
password = HEAT_PASSWORD
user_domain_name = default
[clients_keystone]
auth_uri = http://controller:5000
```


    以下参数请根据实际情况修改： 将HEAT_DBPASS替换为Heat数据库密码。 将HEAT_PASSWORD替换为Heat用户密码。 将HEAT_DOMAIN_PASSWORD替换为heat_domain_admin用户密码。

  c. 按“Esc”键退出编辑模式，输入:wq!，按“Enter”键保存并退出文件。
4. 初始化Heat数据库表。

```
su -s /bin/sh -c "heat-manage db_sync" heat
```


5. 启动Heat服务。

```
systemctl enable openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
systemctl start openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service
```
