---
title: 安装命令简介
description: "HAF的安装，通过对外提供haf_installer脚本的方式实现。haf_installer将调用haf-tool命令行接口完成安装。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2200/bds/kunpengomnidata_20_0019.html
sourcePath: /source/zh/kunpengboostkithistory/2200/bds/kunpengomnidata_20_0019.html
indexId: 12aa13c7a5217db16325bfeb589f760426c98a55875a3baa1c673049e948c18b71
---
# 安装命令简介

#### HAF安装的实现方式

HAF的安装，通过对外提供haf_installer脚本的方式实现。haf_installer将调用haf-tool命令行接口完成安装。


#### 脚本的对外安装接口

- 主机节点：
  cd /home/omm/omnidata-software

  ./haf_installer -m <mode> -p <package> -t <target_dir> -s <communication_port>

  主机节点安装-p选项指定的软件包，并根据haf_host_install.conf文件内容，生成主机节点初始化证书。haf_host_install.conf文件在haf_installer脚本同目录的install-config文件夹中。 根据实际情况修改“/home/omm/omnidata-software”路径。

- 卸载节点：
  cd /home/omm/omnidata-software

  ./haf_installer -m <mode> -p <package> -t <target_dir> -w <ip_white_list> -j <java_home> -i <service_ip_duration> -s <communication_port>


卸载节点比主机节点多了三个选项，各个选项含义如表1所示。
**表1 haf_installer命令选项表**

| 选项 | 说明 | 主机节点 | 卸载节点 |
| --- | --- | --- | --- |
| \-m <mode> | host /lib用来表示在主机节点还是卸载节点安装。 | √ | √ |
| \-p <package> | 安装包，例如haf\-target\-1.3.0.tar.gz。 | √ | √ |
| \-t <target\_dir> | 软件包安装根目录。 | √ | √ |
| \-w <ip\_white\_list> | 白名单IP地址列表，支持IP地址或IP地址网段格式，多个值使用","分隔（格式样例：127.0.0.1,10.10.0.2,10.10.10.0/24，默认为空）。 说明： 白名单用于校验主机节点的IP地址，不在白名单的连接将被拒绝。若在IP地址白名单校验功能使能的情况下，未配置IP地址白名单，则卸载节点将会拒绝所有主机节点连接请求。 | x | √ |
| \-j <java\_home> | 节点Java安装路径。 若该项不配置，则安装时根据系统环境变量自动解析。 使用自定义的JAVA\_HOME，请配置该项。 使用系统的默认路径，可省略该项配置。 | x | √ |
| \-i <service\_ip\_duration> | 侦听卸载节点IP地址的网段信息（格式样例：10.10.0.0/24，默认为haf\_target\_install.conf中配置的选项）。 说明： 默认侦听IP地址网段与现场运行网段差异较大，建议根据系统情况进行配置。 | x | √ |
| \-s <communication\_port> | HAF服务通信端口，默认17531，主机节点和卸载节点应保持一致。 | √ | √ |


#### haf-tool对外提供的安装接口

- 主机节点：
  /home/omm/omnidata-install/haf-host/tools/haf-tool install

- 卸载节点：
  /home/omm/omnidata-install/haf-target/tools/haf-tool install 该接口主要提供给haf_installer脚本使用，不建议单独调用该接口。
