Help Center/ Application Operations Management/ Best Practices/ Automatically Connecting to UniAgent Using Custom Images
Updated on 2025-07-01 GMT+08:00

Automatically Connecting to UniAgent Using Custom Images

This section describes how to package images for connecting UniAgent in the Linux and Windows environments. By using the images, you can purchase an ECS and UniAgent will then be automatically installed on it.

Overview

An image is an Elastic Compute Server (ECS) or Bare Metal Server (BMS) template that contains OS or service data and may also contain proprietary software and application software, such as database software. Images are classified into public, private, Marketplace, and shared images.

Image Management Service (IMS) provides easy-to-use, self-service image management functions. You can use a public, private, or shared image to apply for ECSs. You can also create private images from existing ECSs or using external image files.

Constraints

UniAgent cannot be installed on the Linux host where the image is to be packaged. If the UniAgent has been installed on the Linux host, you need to uninstall the UniAgent before packaging the image.

Packaging an Image in the Linux Environment

In the Linux environment, you can package an image according to the following procedure:

  1. Create an ECS by referring to ECS Getting Started.
  2. Download the install_uniagentd_self_OS.sh script to the /root directory of the ECS:

    Download command: wget https://aom-uniagent-{region_id}.{obs_domain}/install_uniagentd_self_OS.sh

    For the CN North-Beijing4 region:
    wget https://aom-uniagent-cn-north-4.obs.cn-north-4.myhuaweicloud.com/install_uniagentd_self_OS.sh
                    {region_id}=cn-north-4
        {obs_domain}=obs.cn-north-4.myhuaweicloud.com

  3. In the /etc/init.d/ directory, set the install_uniagentd_self_OS.sh script to automatically start upon power-on:

    bash /root/install_uniagentd_self_OS.sh config

    If the AOMInstall startup script exists in the /etc/init.d/ directory, your setting is successful.

  4. Delete the configuration script. Then create an image. Do not restart the Linux host before you create an image.

    rm -f /root/install_uniagentd_self_OS.sh

  5. Locate the target ECS and choose More > Manage Image > Create Image in the Operation column to create a private image. For details, see Creating an Image.
  6. Configure image information as required.

Packaging an Image in the Windows Environment

In the Windows environment, you can only install the UniAgent, delete some files, and then package your private image.

  1. Create an ECS by referring to ECS Getting Started.
  2. Manually install a UniAgent on the ECS. Then check whether the installation is successful.
  3. Run the following command on the ECS after the UniAgent is installed:

    sc stop uniagentdservice
    && del /s/q C:\uniagentd\uniagentd.sn && rd /s/q C:\uniagentd\tmp C:\uniagentd\log C:\uniagentd\libexec && echo -e "${ak_info}\n${sk_info}\n${master_info}" > C:\uniagentd\conf\uniagentd.conf

    Note: Obtain the ${ak_info}, ${sk_info}, and ${master_info} parameters from the manual installation page. Replace them based on site requirements. You need to obtain the AK and SK of the corresponding project. For details, see Creating an Access Key.

  4. Locate the target ECS and choose More > Manage Image > Create Image in the Operation column to create a private image. For details, see Creating an Image.
  5. Configure the private image information as required.

Follow-Up Operations

After the private image is packaged, you can use the image to purchase an ECS and UniAgent will then be automatically installed on it. For details, see Purchasing an ECS Using a Private Image.