Help Center/ Application Operations Management/ Best Practices (2.0)/ Customizing OS Images to Automatically Connect UniAgent
Updated on 2024-10-30 GMT+08:00

Customizing OS Images to Automatically Connect UniAgent

This section describes how to package images for connecting UniAgent in the Linux and Windows environments.

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.

Packaging an Image in the Linux Environment

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

Prerequisites

Ensure that no UniAgent has been installed on the Linux host where the image is to be packaged.

Procedure

  1. Create an ECS by referring to ECS Getting Started.
  2. For example, in the CN North-Beijing4 region, download the install_uniagentd_self_OS.sh script to the /root directory of the ECS:

    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

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

  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:

    rm -f /root/install_uniagentd_self_OS.sh

    After the preceding steps are complete, you can create an image. Do not restart the Linux host before you create an image.

  5. Locate the target ECS and click 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. On the ECS, manually install the UniAgent by referring to Installing a UniAgent. Then check the UniAgent status on the UI.
  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

    Obtain the values of ${ak_info}, ${sk_info}, and ${master_info} from the manual installation page and replace them based on site requirements. Each AK/SK pair corresponds to a specific project.

  4. Locate the target ECS and click Create Image in the Operation column to create a private image. For details, see Creating an Image.

  5. Configure image information as required.