Updated on 2024-08-07 GMT+08:00

Generating the Agent Installation Package or Installation Command

Use a Linux server to generate the agent installation command (Linux) or agent installation package (Windows).

Generating the Agent Installation Command (Linux)

  1. Log in to any Linux server.
  2. Run the following command to access the /tmp directory:

    cd /tmp

  3. Run the following commands in sequence to write the VPC endpoint IP address to the private_ip.conf file and the project ID to the project_id.conf file:

    echo "{VPC endpoint ip}" > private_ip.conf

    cat private_ip.conf

    echo "{project ID}" > project_id.conf

    cat project_id.conf

    Set the IP address and Project ID in the preceding command as required.

  4. Perform the following operations in sequence to generate installation commands:

    1. Run the following commands in sequence to generate the installation commands:
      • x86 RPM software package image:

        echo -e "# for Liunx x86 CentOS EulerOS OpenSUSE Fedora\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/x86/hostguard.x86_64.rpm' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && rpm -ivh hostguard.x86_64.rpm && rm -f hostguard_setup_config.conf && rm -f hostguard*.rpm" > x86_rpm_install.sh

      • x86 deb software package image:

        echo -e "# for Liunx x86 Ubuntu Debian\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/x86/hostguard.x86_64.deb' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && dpkg -i hostguard.x86_64.deb && rm -f hostguard_setup_config.conf && rm -f hostguard*.deb" > x86_deb_install.sh

      • ARM RPM software package image:

        echo -e "# for Liunx ARM CentOS EulerOS OpenSUSE Fedora UOS Kylin\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/arm/hostguard.aarch64.rpm' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && rpm -ivh hostguard.aarch64.rpm && rm -f hostguard_setup_config.conf && rm -f hostguard*.rpm" > arm_rpm_install.sh

      • ARM deb software package image:

        echo -e "# for Liunx ARM Ubuntu Debian\n\ncurl -k -O 'https://private_ip:10180/package/agent/linux/arm/hostguard.aarch64.deb' && echo 'MASTER_IP=private_ip:10180' > hostguard_setup_config.conf && echo 'SLAVE_IP=private_ip:10180' >> hostguard_setup_config.conf && echo 'ORG_ID=project_id' >> hostguard_setup_config.conf && dpkg -i hostguard.aarch64.deb && rm -f hostguard_setup_config.conf && rm -f hostguard*.deb" > arm_deb_install.sh

    2. Run the following command to replace the VPC endpoint IP address and project ID:

      The command needs to be run without modification.

      sed -i "s#private_ip#`cat private_ip.conf`#g" *install.sh && sed -i "s#project_id#`cat project_id.conf`#g" *install.sh

    • All the preceding five commands must be executed. The last command for replacing the VPC endpoint IP address and project must be executed at last.
    • The installation commands in x86_rpm_install.sh are suitable for images managed by the RPM software package in the x86 architecture, such as CentOS, EulerOS, OpenSUSE, and Fedora.
    • The installation commands in x86_deb_install.sh are suitable for images managed by the .deb software package in the x86 architecture, such as Ubuntu and Debian.
    • The installation commands in arm_rpm_install.sh are suitable for images managed by the RPM software package in the ARM architecture, such as CentOS, EulerOS, OpenSUSE, Fedora, UOS, and Kylin.
    • The installation commands in arm_deb_install.sh are suitable for images managed by the .deb software package in the ARM architecture, such as Ubuntu and Debian.

  5. View the generated installation command, which will be used to install agents on the third-party Linux servers.

    Figure 1 Linux installation commands

Generating an Agent Installation Package (Windows)

  1. Log in to any Linux server.
  2. Run the following command to access the /tmp directory:

    cd /tmp

  3. Run the following commands in sequence to generate the agent installation package for Windows servers:

    curl -k -O https://`cat private_ip.conf`:10180/package/agent/windows/hostguard_setup.exe && echo '[system]' > hostguard_setup_config.ini && echo 'master='`cat private_ip.conf`':10180' >> hostguard_setup_config.ini && echo 'slave='`cat private_ip.conf`':10180' >> hostguard_setup_config.ini && echo 'orgid='`cat /usr/local/hostguard/run/metadata.conf | grep -v enterprise_project_id | grep project_id | cut -d ":" -f 2 | cut -d " " -f 2` >> hostguard_setup_config.ini

    zip hostguard_setup.zip hostguard_setup.exe hostguard_setup_config.ini

    If the proxy server does not have zip commands, run the following command to install the zip plugin:

    yum install -y zip

  4. View the generated installation package, which will be used to install agents on the third-party Windows servers.

    Figure 2 Windows installation package