Server mirror image generation method and device, electronic equipment and computer storage medium

By automatically importing container images during the operating system installation process, the problem of traditional business installation and deployment relying on manual operations is solved, and an efficient automated installation and deployment process is achieved.

CN121967434APending Publication Date: 2026-05-01BEIJING HONGTENG INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING HONGTENG INTELLIGENT TECH CO LTD
Filing Date
2024-10-29
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Traditional business installation and deployment rely on manual operation, with low automation, resulting in a time-consuming, labor-intensive, and inefficient installation process.

Method used

When installing the operating system, the original image file of the target architecture is obtained, the compressed file of the container image to be deployed is added to the original image file, the bootloader configuration file is modified, an automated installation configuration file is added, and a server image is generated to achieve automatic import of the container image.

Benefits of technology

It enables automatic deployment of container images, improving the efficiency of business installation and deployment, especially in environments without internet connection or with unstable networks, it can automatically complete the deployment of container images and simplify the installation process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121967434A_ABST
    Figure CN121967434A_ABST
Patent Text Reader

Abstract

The invention discloses a server mirror image generation method and apparatus, an electronic device and a computer storage medium. The method comprises the steps of obtaining an original mirror image file of a target architecture; adding the compressed file of the to-be-deployed container mirror image to the original mirror image file; modifying a bootstrap program configuration file in the original mirror image file, and adding the automatic installation configuration file to the original mirror image file; the bootstrap program configuration file comprises bootstrap mode configuration information of an automatic installation configuration file, and the automatic installation configuration file comprises installation mode configuration information of a compressed file; and generating a server mirror image based on the updated original mirror image file. By adopting the scheme, the server mirror image capable of automatically importing the container mirror image can be generated, so that when the operating system is installed in the to-be-deployed server subsequently, the container mirror image can be automatically deployed in the to-be-deployed server, additional manual configuration is not needed, an automatic installation and deployment process is realized, and the operation efficiency is improved. And the business installation and deployment efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and computer storage medium for generating server images. Background Technology

[0002] Traditional business installation and deployment typically rely on manual operations by users. For example, after users complete the operating system installation using a minimal installation disc, they still need to manually import the container images required for business operation using commands such as `docker load` on the open-source platform Docker. This process is characterized by low automation, time-consuming and labor-intensive installation, and inefficient business installation and deployment. Summary of the Invention

[0003] This application provides a method, apparatus, electronic device, and computer storage medium for generating server images, which can automatically import container images during operating system installation to achieve efficient business installation and deployment.

[0004] In a first aspect, embodiments of this application provide a method for generating a server image, the method comprising:

[0005] Obtain the raw image file of the target architecture;

[0006] Add the compressed file of the container image to be deployed to the original image file;

[0007] Modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file; the bootloader configuration file includes the boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes the installation method configuration information of the compressed file;

[0008] Generate a server image based on the updated original image file.

[0009] In one possible implementation, the automated installation configuration file also includes installation method configuration information for the system kernel parameter configuration file and installation method configuration information for the resource limit parameter configuration file;

[0010] Adding the automated installation configuration file before the original image file also includes the following methods:

[0011] Add the system kernel parameter configuration file and resource limit parameter configuration file to the original image file.

[0012] In one possible implementation, the automated installation configuration file also includes service disable configuration information and / or service auto-start configuration information.

[0013] In one possible implementation, the method of adding the compressed file of the container image to be deployed to the original image file also includes:

[0014] Obtain the container image to be published and test it.

[0015] The container image to be released after passing the test is compressed to form a compressed file of the container image to be deployed.

[0016] In one possible implementation, before generating the server image based on the updated original image file, the method further includes:

[0017] Update the old software installation package and its dependencies in the original image file to the new software installation package and its dependencies.

[0018] Update the package manager data in the original image file based on the new software installation package and its dependent packages.

[0019] In one possible implementation, the package manager data in the original image file is updated based on the new software installation package and its dependencies, including:

[0020] Add the package name of the new software installation package to the installation manifest file of the original image file;

[0021] Based on the package name of the new software installation package, update the dependency relationships between the new software installation package and its dependent packages in the package manager data.

[0022] In one possible implementation, the new software installation package and its dependencies include one or more of the following: a new kernel installation package and its dependencies, a new container service installation package and its dependencies, and a new tool installation package and its dependencies.

[0023] Secondly, embodiments of this application provide a server image generation apparatus, the apparatus comprising:

[0024] The acquisition module is used to obtain the raw image file of the target architecture;

[0025] The update module is used to add the compressed file of the container image to be deployed to the original image file; modify the bootloader configuration file in the original image file, and add the automated installation configuration file to the original image file; the bootloader configuration file includes the boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes the installation method configuration information of the compressed file;

[0026] The generation module is used to generate a server image based on the updated original image file.

[0027] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory; wherein the memory stores a computer program, the computer program being adapted to be loaded by the processor and execute the method steps provided in the first aspect of embodiments of this application.

[0028] Fourthly, embodiments of this application provide a computer storage medium storing a plurality of instructions adapted for loading by a processor and executing the method steps provided in the first aspect of embodiments of this application.

[0029] The aforementioned server image generation method, apparatus, electronic device, and computer storage medium obtain the original image file of the target architecture; add the compressed file of the container image to be deployed to the original image file; modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file; the bootloader configuration file includes boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes installation method configuration information of the compressed file; and generate a server image based on the updated original image file. The entire server image generation process, by packaging the container images required by the business into the original image file of the target architecture, modifying the bootloader configuration file in the original image file, and adding the automated installation configuration file to the original image file, can generate a server image that can automatically import container images based on the updated original image file. This allows the container images to be automatically deployed to the server to be deployed when installing the operating system, without the need for additional manual configuration, thus achieving automated installation and deployment processes and improving the efficiency of business installation and deployment. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 A schematic diagram illustrating the application environment of a server image generation method provided as an exemplary embodiment of this application;

[0032] Figure 2 A schematic flowchart illustrating a method for generating a server image, provided as an exemplary embodiment of this application;

[0033] Figure 3 A flowchart illustrating another method for generating a server image provided as an exemplary embodiment of this application;

[0034] Figure 4A schematic diagram of the architecture of automated installation configuration information contained in an automated installation configuration file, provided as an exemplary embodiment of this application;

[0035] Figure 5 A schematic diagram of the directory structure of a server image file provided for an exemplary embodiment of this application;

[0036] Figure 6 A schematic diagram of a server image generation apparatus provided for an exemplary embodiment of this application;

[0037] Figure 7 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this application. Detailed Implementation

[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0039] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0040] The server image generation method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, the image generation terminal 10 communicates with the image generation server 20 via a network. A data storage system can store the data that the image generation server 20 needs to process. The data storage system can be integrated onto the image generation server 20 or placed on a cloud or other network server. The image generation server 20 obtains the original image file of the target architecture, adds the compressed file of the container image to be deployed to the original image file, modifies the bootloader configuration file in the original image file, and adds the automated installation configuration file to the original image file. Based on the updated original image file, it generates a server image. The bootloader configuration file includes boot method configuration information for the automated installation configuration file, and the automated installation configuration file includes installation method configuration information for the compressed file.

[0041] It is worth noting that the image generation terminal 10 is a front-end device used to operate and control the image generation server 20, and it can be, but is not limited to, various personal computers, laptops, and tablets. The image generation server 20 is used to generate server images that will run on the server to be deployed, and it can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0042] In one embodiment, such as Figure 2 As shown, a method for generating a server image is provided, which can be applied to... Figure 1 The following steps are used as an example to illustrate the application environment shown:

[0043] S201: Obtain the raw image file of the target architecture.

[0044] The original image file of the target architecture refers to all the original files in the minimum installation CD image of the target architecture (e.g., CentOS 7.8x64), including but not limited to basic operating system files, kernel files, and some basic tools.

[0045] Optionally, the developer can mount the minimum installation CD image of the target architecture on the image generation server 20 through the image generation terminal 10, and save all the original files (i.e. the original image file) in the CD image to a specified directory, so that the image generation server 20 can obtain the original image file of the target architecture.

[0046] For example, the developer pre-downloads the CentOS 7.8x64 minimal installation CD image through the image generation terminal 10, creates a mount point on the image generation server 20, and then uses the mount command to mount the CentOS 7.8x64 minimal installation CD image on the image generation server 20. All the original files in the CD image are saved to the image data directory / data / ISO / , so that the image generation server 20 can obtain the original image file of the CentOS 7.8x64 architecture.

[0047] In this embodiment, by using the original image file of the target architecture, all the basic files required to install the operating system of the target architecture can be easily obtained, which effectively simplifies the server image generation process and improves the efficiency of server image generation.

[0048] S202: Add the compressed file of the container image to be deployed to the original image file.

[0049] Optionally, in response to the configuration operation input by the developer through the image generation terminal 10, the image generation server 20 packages the container image to be deployed during business runtime into a compressed file and adds it to the data subdirectory of the original image file to ensure that the container image can be automatically deployed during the subsequent operating system installation process.

[0050] Understandably, since the original image file usually contains multiple subdirectories for organizing different types of file data, after saving the original image file to a specified directory (such as the image data directory / data / ISO / mentioned above), the subdirectories of the original image file are also the subdirectories visible under that specified directory.

[0051] For example, in response to the configuration operation input by the developer through the image generation terminal 10, the image generation server 20 packages the container image to be deployed into a compressed file in .tgz format and adds the compressed file to the / data / subdirectory of the image data directory / data / ISO / , so that the server to be deployed can automatically deploy the container image required for business operation based on the compressed file of the container image to be deployed stored in this subdirectory.

[0052] In this embodiment, by adding the compressed file of the container image to be deployed to the original image file, the container image can be automatically deployed to the server to be deployed when the operating system is installed on the server to be deployed, without the need for additional manual configuration, which effectively improves the efficiency of business installation and deployment.

[0053] S203: Modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file.

[0054] The bootloader configuration file includes boot method configuration information for the automated installation configuration file, and the automated installation configuration file includes installation method configuration information for the compressed file of the container image to be deployed.

[0055] Specifically, the aforementioned bootloader configuration files include, but are not limited to, Legacy bootloader configuration files and UEFI bootloader configuration files; the aforementioned automated installation configuration files include, but are not limited to, Kickstart configuration files. Understandably, the server to be deployed can obtain the boot method from the automated installation configuration file through the bootloader configuration file, and automate the Linux system installation process using the installation method configuration information in the automated installation configuration file.

[0056] Optionally, in response to the developer's configuration operation, the image generation server 20 modifies the bootloader configuration files in the isolinux boot subdirectory and EFI boot subdirectory of the original image file, and adds the automated installation configuration file to the isolinux boot subdirectory of the original image file to ensure that the server to be deployed can perform automated installation based on the modified bootloader configuration file and the added automated installation configuration file.

[0057] For example, in response to a developer's configuration operation, the image generation server 20 modifies the bootloader configuration file isolinux.cfg in the / data / ISO / isolinux / directory, and adds brain.cfg after the inst.ks= parameter of this bootloader configuration file for use as a Legacy boot configuration file. Additionally, it modifies the bootloader configuration file grub.cfg in the / data / ISO / EFI / BOOT / directory, and adds brain.cfg after the inst.ks= parameter of this bootloader configuration file for use as a UEFI boot configuration file. Then, it adds the automated installation configuration file brain.cfg to the / data / ISO / isolinux / directory of the original image file, ensuring that the server to be deployed can correctly use the brain.cfg Kickstart configuration file to achieve automated installation in both Legacy and UEFI boot modes.

[0058] It is worth noting that this embodiment only describes a preferred implementation of the present application. In practical applications, the automated installation configuration file can be added to the original image file first, and then the bootloader configuration file in the original image file can be modified. The present application embodiment does not limit the order of modifying the bootloader configuration file and adding the automated installation configuration file.

[0059] In this embodiment, by modifying the bootloader configuration file in the original image file and adding the automated installation configuration file to the original image file, the efficiency, consistency, and automation level of business installation and deployment can be significantly improved, achieving efficient and reliable business installation and deployment.

[0060] S204: Generate a server image based on the updated original image file.

[0061] Optionally, the image generation server 20, in response to server image generation and configuration commands input by developers, uses the genisoimage tool to generate a server image and uses the isohybrid tool to make the generated server image compatible with both traditional Legacy boot methods and modern UEFI boot methods. The impantisomd5 tool is used to embed MD5 checksum information into the generated server image to verify the integrity and consistency of the server image before installation or distribution.

[0062] For example, the image generation server 20 uses the genisoimage tool to generate a server image based on the command entered by the developer: genisoimage-joliet-long-V "CD-ROM volume label"-o server image file generation location-b isolinux / isolinux.bin-cisolinux / boot.cat-no-emul-boot-boot-load-size 4-boot-info-table-RJv-cache-inodes-T-eltorito-alt-boot-e images / efiboot.img-no-emul-boot / data / ISO. Based on the command entered by the developer: isohybrid-v ISO server image file generation location, the isohybrid tool makes the generated server image compatible with both traditional Legacy boot methods and modern UEFI boot methods. Based on the command entered by the developer: imvantisomd5 server image file generation location, the imvantisomd5 tool embeds MD5 checksum information into the generated server image to verify the integrity and consistency of the server image before installation or distribution.

[0063] In this embodiment, by using the genisoimage tool to generate a customized server image, a series of preset configuration tasks can be automatically executed during operating system installation, thus simplifying the installation and deployment process. By using the isohybrid tool, the generated server image can support both Legacy and UEFI boot modes, enhancing the image file's versatility and compatibility. By embedding MD5 checksum information into the server image using the impltisomd5 tool, the integrity and consistency of the image file can be ensured during transmission and distribution, preventing data tampering or corruption and improving the server image's security.

[0064] The aforementioned method for generating server images involves packaging the container images required for the business into the original image file of the target architecture, modifying the bootloader configuration file in the original image file, and adding an automated installation configuration file to the original image file. Based on the updated original image file, a server image that can automatically import container images can be generated. This allows the container images to be automatically deployed to the server to be deployed when installing the operating system, without the need for additional manual configuration. Especially in environments without internet access or with unstable network connections, users do not need to download container images from a remote repository. They can directly use the server image generated in this embodiment to automatically complete the deployment of container images during the operating system installation process, achieving automated installation and deployment processes and effectively improving the efficiency of business installation and deployment.

[0065] In one embodiment, such as Figure 3 As shown, another method for generating server images is provided, which can be applied to... Figure 1 The following steps are used as an example to illustrate the application environment shown:

[0066] S301: Obtain the raw image file of the target architecture.

[0067] Specifically, S301 is the same as S201, and will not be repeated here.

[0068] S302: Obtain the container image to be published and test it.

[0069] Optionally, the image generation server 20 pulls the container image to be published from the image repository and imports it into the Docker service for testing.

[0070] S303: Compress the container image to be released after it has passed the test to form a compressed file of the container image to be deployed.

[0071] Optionally, the image generation server 20 packages the tested and released container image into a .tgz compressed file, thus forming a compressed file of the container image to be deployed. For example, after the container image to be released passes testing, the image generation server 20 packages all container images under the / var / lib / docker directory (i.e., the tested and released container images) into a compressed file called docker.tgz, which is the container image to be deployed, and saves it to the data subdirectory of the original image file, / data / ISO / data / .

[0072] In this embodiment, by acquiring and testing the container image to be released, and using the tested container image as the deployment image, it is possible to ensure that the deployment image meets quality and security requirements, thereby improving its quality. By compressing the tested container image into a compressed file of the deployment image, resource utilization can be optimized and the subsequent deployment process simplified. The above method not only ensures the quality and security of the deployment image but also improves resource utilization and the efficiency of subsequent installation and deployment using the generated server image.

[0073] S304: Add the compressed file of the container image to be deployed to the original image file.

[0074] Specifically, S301 is the same as S201, and will not be repeated here.

[0075] S305: Add the system kernel parameter configuration file and resource limit parameter configuration file to the original image file.

[0076] The system kernel parameter configuration file contains a series of key-value pairs used to set parameters for kernel runtime. These parameters affect kernel behavior, such as network settings and memory management. The resource limit parameter configuration file also contains a series of key-value pairs used to set user resource limits, such as the maximum number of open files and the maximum number of processes.

[0077] Optionally, in response to the developer's configuration operation, the image generation server 20 adds system kernel parameter configuration files and resource limit parameter configuration files to the data subdirectory of the original image file.

[0078] For example, in response to the developer's configuration operation, the image generation server 20 adds a configuration file named / data / ISO / data / sysctl / 80-brain.conf to the / data / ISO / data / directory of the original image file to save system kernel parameters, and adds a configuration file named / data / ISO / data / ulimit / 80-brain.conf to the / data / ISO / data / directory to save resource limit parameters.

[0079] In this embodiment, by adding the system kernel parameter configuration file and resource limit parameter configuration file to the original image file, the system can automatically run according to the state defined in the configuration file when the operating system is installed on the server to be deployed, without the need for manual configuration by the user, which can significantly improve the efficiency and reliability of business installation and deployment.

[0080] S306: Modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file.

[0081] The bootloader configuration files include, but are not limited to, Legacy boot configuration files and UEFI boot configuration files; the automated installation configuration files include, but are not limited to, Kickstart configuration files.

[0082] Optionally, in response to the developer's configuration operations, the image generation server 20 modifies the bootloader configuration files in the isolinux boot subdirectory and EFI boot subdirectory of the original image file, and adds the automated installation configuration file edited by the developer to the isolinux boot subdirectory of the original image file. This ensures that the server to be deployed can perform automated installation based on the modified bootloader configuration file and the added automated installation configuration file. It is worth noting that the automated installation configuration file edited by the developer includes Anaconda configuration information, specifically including configuration information for the installation method of compressed files, the installation method of system kernel parameter configuration files, the installation method of resource limit parameter configuration files, service disabling configuration information, and service auto-start configuration information. The installation method configuration information for compressed files includes the installation path configuration information for compressed files; the installation method configuration information for system kernel parameter configuration files includes the installation path configuration information for system kernel parameter configuration files; and the installation method configuration information for resource limit parameter configuration files includes the installation path configuration information for resource limit parameter configuration files.

[0083] Specifically, the automated installation configuration file uses the `firewall--disabled` and `selinux--disabled` options to disable the firewalld and SELinux services, respectively. This ensures that these services are disabled on the server to be deployed during the installation process, reducing potential security conflicts and improving system performance. Simultaneously, the automated installation configuration file uses `services--enabled="docker"` to enable automatic Docker service startup on the server, simplifying the workflow and improving deployment efficiency. In addition, the automated installation configuration file also adds the following installation configuration information during the %post--nochroot stage: extract / data / ISO / data / docker.tgz to the / mnt / sysimage / var / lib / directory to make the compressed file of the container image to be deployed effective; copy / data / ISO / data / sysctl / 80-brain.conf to / mnt / sysimage / etc / sysctl.d / to make the above system kernel parameter configuration file effective; copy / data / ISO / data / ulimit / 80-brain.conf to / mnt / sysimage / etc / security / limits.d / to make the above resource limit parameter configuration file effective.

[0084] It is understood that this embodiment only describes a preferred implementation of this application. The installation method configuration information of the compressed file is not limited to the above three installation path configuration information, and may also include permission configuration information, environment variable configuration information, log configuration information, etc., which can be set according to business needs. This application embodiment does not limit this.

[0085] Please see Figure 4This is a schematic diagram of the architecture of the automated installation configuration information contained in the automated installation configuration file. In this configuration file, the firewalld service is disabled via `firewall--disabled`, the SELinux service is disabled via `selinux--disabled`, and the Docker service is added to start automatically at boot via `services--enabled="docker"`. Furthermore, in the `%post--nochroot` stage of the automated installation configuration file, the compressed file of the container image to be deployed is made effective by extracting ` / data / ISO / data / docker.tgz` to the ` / mnt / sysimage / var / lib / ` directory; the system kernel parameter configuration file is made effective by copying ` / data / ISO / data / sysctl / 80-brain.conf` to ` / mnt / sysimage / etc / sysctl.d / `; and the resource limit parameter configuration file is made effective by copying ` / data / ISO / data / ulimit / 80-brain.conf` to ` / mnt / sysimage / etc / security / limits.d / `.

[0086] In this embodiment, by modifying the bootloader configuration file in the original image file and adding an automated installation configuration file containing installation method configuration information for compressed files, system kernel parameter configuration files, resource limit parameter configuration files, service disabling configuration information, and service auto-start configuration information to the original image file, it can be ensured that the server to be deployed can immediately start running the required services after installing the server image and run according to the preset configuration, thereby achieving efficient and reliable business installation and deployment.

[0087] S307: Update the old software installation package and its dependencies in the original image file to the new software installation package and its dependencies.

[0088] Optionally, the image generation server 20 adjusts the RPM packages in the original image file in response to the developer's configuration operation. Specifically, the image generation server 20 obtains the new software installation package and its dependencies, saves the new software installation package and its dependencies to the package subdirectory of the original image file, and deletes the old software installation package and its dependencies from the package subdirectory of the original image file.

[0089] The new software installation package and its dependencies include one or more of the following: the new kernel installation package and its dependencies, the new container service installation package and its dependencies, and the new tool installation package and its dependencies.

[0090] For example, in response to the developer's configuration operation, the image generation server 20 obtains the kernel package of kernel version 3.10.0-1160 and its dependencies, and saves them together to the / data / ISO / Packages directory. It also obtains the container service installation packages docker-ce-19.03, containerd.io-1.6.28, and docker-compose-plugin-2.25, along with their dependencies, and saves them together to the / data / ISO / Packages directory. Finally, it obtains the net-tools, iproute, and nmon tool installation packages and their dependencies, and saves them together to the / data / ISO / Packages directory. Finally, it deletes the older kernel packages and their dependencies that are no longer needed from the / data / ISO / Packages directory.

[0091] S308: Update the package manager data in the original image file based on the new software installation package and its dependent packages.

[0092] Optionally, the image generation server 20 updates the package manager data in the original image file repository data subdirectory in response to the developer's configuration operation. Specifically, this could be updating the package manager data in the original image file repository database (i.e., the repo database).

[0093] In one embodiment, updating the package manager data in the original image file based on the new software installation package and its dependent packages includes: adding the package name of the new software installation package to the installation manifest file of the original image file; and updating the dependency relationships between the new software installation package and its dependent packages in the package manager data based on the package name of the new software installation package.

[0094] Optionally, in response to the developer's configuration operation, the image generation server 20 updates the installation manifest file *minimal-x86_64-comps.xml in the repository data subdirectory / repodata / of the original image file. This installation manifest file adds the package names of the new versions of software packages such as docker-ce, docker-ce-cli, net-tools, iproute, and nmon that need to be installed. Then, in response to the createrepo-g repository database update command, the image generation server 20 updates the package manager data in the repo database according to the updated installation manifest file. This ensures that the names, versions, dependencies, and other metadata of all packages and their dependencies in the package subdirectory of the original image file are correctly recorded. This allows the subsequent Kickstart configuration file (i.e., the brain.cfg file mentioned above) to determine which packages need to be installed and how to install them based on this metadata.

[0095] It's worth noting that in this embodiment, when editing the installation manifest file, only the package name of the newly added software installation package needs to be added; it's not necessary to add the package names of the dependent packages corresponding to the new software installation package or manually delete the package names of the old software installation packages. When updating the repository database using the repository database update command, the repository database can automatically update the metadata such as the names, versions, and dependencies of all software packages and their dependent packages in the original image file's package subdirectory based on the package name of the new software installation package.

[0096] In this embodiment, by adding the package name of the new software installation package to the installation manifest file of the original image file and updating the original image file repository database using the repository database update command, the server to be deployed can automatically install the specified RPM package based on the package manager data in the server image file, improving installation efficiency and avoiding the possibility of errors during manual installation. Furthermore, using the server image provided in this application for business installation and deployment can also solve the problem that users cannot obtain the software installation packages and their dependencies required for business operation in environments without internet access or with unstable network connections. Users can directly use the server image generated in this embodiment to automatically complete the installation of the software installation packages and their dependencies required for business operation during the operating system installation process, effectively improving the efficiency of business installation and deployment.

[0097] S309: Generate a server image based on the updated original image file.

[0098] Specifically, S309 is the same as S204, and will not be repeated here.

[0099] The aforementioned method for generating server images involves compressing the tested, pre-release container image into a compressed file of the container image to be deployed. Adding this compressed file to the original image file ensures the quality and security of the container image, improves resource utilization, and enhances the efficiency of subsequent installation and deployment using the generated server image. By modifying the bootloader configuration file in the original image file and adding the automated installation configuration file, it is ensured that the server to be deployed can immediately start running the required services after installing the server image and operate according to the preset configuration, achieving efficient and reliable business installation and deployment. Adding the package name of the new software installation package to the installation manifest file of the original image file and updating the original image file's repository database using the repository database update command effectively improves installation efficiency and avoids the possibility of errors during manual installation. Furthermore, using the server image provided in this application for business installation and deployment can also solve the problem that users cannot obtain the container image, software installation package and its dependent packages required for business operation in environments without internet connection or with unstable network connection. Users can directly use the server image generated in this embodiment to automatically complete the installation of the software installation package and its dependent packages required for business operation during the operating system installation process, realizing an automated installation and deployment process and effectively improving the efficiency of business installation and deployment.

[0100] To explain in detail the technical solution of the server image generation method of this application, specific application examples will be used below. Figure 5 The entire process is described, and it specifically includes the following steps:

[0101] 1. Developers use the image generation terminal to mount the CentOS 7.8x64 minimal installation CD image on the image generation server, and save all files in the CD image as the original image file to the / data / ISO / directory, so that the image generation server can obtain the original image file of the target architecture.

[0102] 2. The image generation server responds to the container image pull (docker pull) command, pulls the container image to be published from the image repository, and imports it into the Docker service for testing.

[0103] 3. The image generation server responds to the configuration operations entered by the developers through the image generation terminal, compresses the tested container image to be released, forms a compressed file docker.tgz of the container image to be deployed, and saves it to the / data / ISO / data / directory.

[0104] 4. In response to the configuration operations entered by developers through the image generation terminal, the image generation server creates a system kernel parameter configuration file / data / ISO / data / sysctl / 80-brain.conf in the data subdirectory of the original image file to save the system kernel parameters; and creates a resource limit parameter configuration file / data / ISO / data / ulimit / 80-brain.conf to save the resource limit parameters.

[0105] 5. The image generation server responds to the configuration operations entered by developers through the image generation terminal by modifying the bootloader configuration file / data / ISO / isolinux / isolinux.cfg in the isolinux boot subdirectory of the original image file, adding brain.cfg after the inst.ks= parameter for use as the Legacy boot configuration file; and modifying the bootloader configuration file / data / ISO / EFI / BOOT / grub.cfg in the EFI boot subdirectory of the original image file, adding brain.cfg after the inst.ks= parameter for use as the UEFI boot configuration file.

[0106] 6. In response to the configuration operations entered by developers through the image generation terminal, the image generation server creates an automated installation configuration file (Kickstart configuration file) / data / ISO / isolinux / brain.cfg in the isolinux boot subdirectory of the original image file. This automated installation configuration file includes Anaconda configuration, which specifically includes:

[0107] 6.1. Disable the firewalld service using firewall--disabled and disable the SELinux service using selinux--disabled.

[0108] 6.2. Add the Docker service to start automatically on boot by using services--enabled="docker".

[0109] 6.3. In the %post--nochroot stage of the automated installation configuration file, add the following configuration information:

[0110] 6.3.1. Make the compressed file of the container image to be deployed effective by decompressing the compressed file / data / ISO / data / docker.tgz to the / mnt / sysimage / var / lib / directory.

[0111] 6.3.2. Make the system kernel parameter configuration file effective by copying the system kernel parameter configuration file / data / ISO / data / sysctl / 80-brain.conf to / mnt / sysimage / etc / sysctl.d / .

[0112] 6.3.3. Make the resource limit parameter configuration file effective by copying the resource limit parameter configuration file / data / ISO / data / ulimit / 80-brain.conf to / mnt / sysimage / etc / security / limits.d / .

[0113] 7. The image generation server responds to the configuration operations entered by developers through the image generation terminal, updating the old software installation package and its dependencies in the original image file to the new software installation package and its dependencies. This specifically includes:

[0114] 7.1 Obtain the kernel package of kernel version 3.10.0-1160 and its dependent packages, and save them together to the / data / ISO / Packages directory.

[0115] 7.2 Obtain the container service installation packages docker-ce-19.03, containerd.io-1.6.28, and docker-compose-plugin-2.25, along with their dependencies, and save them together to the / data / ISO / Packages directory.

[0116] 7.3 Obtain the installation packages for net-tools, iproute, and nmon tools, along with their dependencies, and save them together to the / data / ISO / Packages directory.

[0117] 7.4 Delete old kernel packages and their dependencies that are no longer needed in the / data / ISO / Packages directory.

[0118] 8. The image generation server responds to the configuration operations entered by developers through the image generation terminal, and updates the package manager data in the original image file according to the new software installation package and its dependent packages. Specifically, it performs the following processing:

[0119] 8.1 Edit the installation manifest file in the / data / ISO / repodata / directory, and add the installation packages of the latest versions of docker-ce, docker-ce-cli, net-tools, iproute, nmon and other software that need to be installed, as well as their dependencies.

[0120] 8.2 Use the createrepo -g command to update the repo database in the / data / ISO / repodata / directory.

[0121] 9. Generate a server image based on the updated original image file. The directory structure of the final generated server image file is as follows: Figure 5 As shown. Understandably, Figure 5 The directory structure shown is the subdirectory structure under the / data / ISO / directory. The files in the directories / CentOS_BuildTag / , / EULA / , / GPL / , / images / , / RPMM-GPG-KEY-Centos-7 / , and / RPM-GPG-KEY-CentOS-Testing-7 / are all files included in the original image file, and will not be described further here.

[0122] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0123] Based on the above-mentioned method for generating server images, such as... Figure 6 As shown in the illustration, this application also provides a server image generation apparatus 600 for implementing the above-described server image generation method. The server image generation apparatus 600 includes:

[0124] Module 601 is used to obtain the original image file of the target architecture;

[0125] Update module 602 is used to add the compressed file of the container image to be deployed to the original image file; modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file; the bootloader configuration file includes the boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes the installation method configuration information of the compressed file;

[0126] Generation module 603 is used to generate a server image based on the updated original image file.

[0127] In one possible implementation, the automated installation configuration file also includes installation method configuration information for the system kernel parameter configuration file and the resource limit parameter configuration file; the update module 602 is also used to add the system kernel parameter configuration file and the resource limit parameter configuration file to the original image file.

[0128] In one possible implementation, the automated installation configuration file may also include service disable configuration information and / or service auto-start configuration information.

[0129] In one possible implementation, the update module 602 is specifically used to obtain the container image to be released, test the container image to be released, and compress the container image to be released after passing the test to form a compressed file of the container image to be deployed.

[0130] In one possible implementation, the update module 602 is further configured to update the old version of the software installation package and its dependent packages in the original image file to the new version of the software installation package and its dependent packages; and update the package manager data in the original image file according to the new version of the software installation package and its dependent packages.

[0131] In one possible implementation, the update module 602 is specifically used to add the package name of the new software installation package to the installation manifest file of the original image file; and based on the package name of the new software installation package, update the dependency relationship between the new software installation package and its dependent packages in the package manager data.

[0132] In one possible implementation, the new software installation package and its dependencies include one or more of the following: a new kernel installation package and its dependencies, a new container service installation package and its dependencies, and a new tool installation package and its dependencies.

[0133] This application also provides an electronic device, which can be a server, and its internal structure diagram can be as follows: Figure 7As shown, this electronic device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores server image data. The I / O interfaces allow the processor to exchange information with external devices. The communication interface allows communication with external terminals via a network connection. The processor executes computer programs to implement a method for generating a server image.

[0134] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0135] In one possible implementation, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0136] Obtain the raw image file of the target architecture;

[0137] Add the compressed file of the container image to be deployed to the original image file;

[0138] Modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file; the bootloader configuration file includes the boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes the installation method configuration information of the compressed file;

[0139] Generate a server image based on the updated original image file.

[0140] In one possible implementation, the automated installation configuration file also includes installation method configuration information for the system kernel parameter configuration file and the resource limit parameter configuration file; when the processor executes the computer program, it also performs the following steps: adding the system kernel parameter configuration file and the resource limit parameter configuration file to the original image file.

[0141] In one possible implementation, the automated installation configuration file may also include service disable configuration information and / or service auto-start configuration information.

[0142] In one possible implementation, the processor, while executing the computer program, also performs the following steps: obtaining the container image to be released, testing the container image to be released, and compressing the container image to be released after passing the test to form a compressed file of the container image to be deployed.

[0143] In one possible implementation, when the processor executes the computer program, it also performs the following steps: updating the old version of the software installation package and its dependencies in the original image file to the new version of the software installation package and its dependencies; and updating the package manager data in the original image file according to the new version of the software installation package and its dependencies.

[0144] In one possible implementation, the processor, when executing the computer program, also performs the following steps: adding the package name of the new software installation package to the installation manifest file of the original image file; and updating the dependency relationships between the new software installation package and its dependent packages in the package manager data based on the package name of the new software installation package.

[0145] In one possible implementation, the new software installation package and its dependencies include one or more of the following: a new kernel installation package and its dependencies, a new container service installation package and its dependencies, and a new tool installation package and its dependencies.

[0146] This application also provides a computer storage medium storing instructions that, when run on a computer or processor, cause the computer or processor to perform one or more steps in the above embodiments. If the constituent modules of the above-described electronic device are implemented as software functional units and sold or used as independent products, they can be stored in the above-described computer-readable storage medium.

[0147] In one possible implementation, a computer storage medium is provided on which a computer program is stored, and when the computer program is executed by a processor, it performs the following steps:

[0148] Obtain the raw image file of the target architecture;

[0149] Add the compressed file of the container image to be deployed to the original image file;

[0150] Modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file; the bootloader configuration file includes the boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes the installation method configuration information of the compressed file;

[0151] Generate a server image based on the updated original image file.

[0152] In one possible implementation, the automated installation configuration file also includes installation method configuration information for the system kernel parameter configuration file and the resource limit parameter configuration file; when the computer program is executed by the processor, the following steps are also performed: adding the system kernel parameter configuration file and the resource limit parameter configuration file to the original image file.

[0153] In one possible implementation, the automated installation configuration file may also include service disable configuration information and / or service auto-start configuration information.

[0154] In one possible implementation, when the computer program is executed by the processor, it also performs the following steps: obtaining the container image to be released, testing the container image to be released, and compressing the container image to be released after passing the test to form a compressed file of the container image to be deployed.

[0155] In one possible implementation, when the computer program is executed by the processor, it also performs the following steps: updating the old version of the software installation package and its dependencies in the original image file to the new version of the software installation package and its dependencies; and updating the package manager data in the original image file according to the new version of the software installation package and its dependencies.

[0156] In one possible implementation, when the computer program is executed by the processor, the following steps are also performed: adding the package name of the new software installation package to the installation manifest file of the original image file; and updating the dependency relationship between the new software installation package and its dependent packages in the package manager data according to the package name of the new software installation package.

[0157] In one possible implementation, the new software installation package and its dependencies include one or more of the following: a new kernel installation package and its dependencies, a new container service installation package and its dependencies, and a new tool installation package and its dependencies.

[0158] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer storage medium or transmitted through the computer storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state drives (SSDs)).

[0159] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. Unless otherwise specified, the technical features of this embodiment and its implementation can be combined arbitrarily.

[0160] The embodiments described above are merely preferred embodiments of this application and are not intended to limit the scope of this application. Any modifications and improvements made by those skilled in the art to the technical solutions of this application without departing from the spirit of this application should fall within the protection scope defined by the claims.

[0161] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims

1. A method for generating a server image, characterized in that, The method includes: Obtain the raw image file of the target architecture; Add the compressed file of the container image to be deployed to the original image file; Modify the bootloader configuration file in the original image file and add the automated installation configuration file to the original image file; the bootloader configuration file includes the boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes the installation method configuration information of the compressed file; A server image is generated based on the updated original image file.

2. The method as described in claim 1, characterized in that, The automated installation configuration file also includes installation method configuration information for the system kernel parameter configuration file and installation method configuration information for the resource limit parameter configuration file; Before adding the automated installation configuration file to the original image file, the method further includes: Add the system kernel parameter configuration file and the resource limit parameter configuration file to the original image file.

3. The method as described in claim 1, characterized in that, The automated installation configuration file also includes service disable configuration information and / or service auto-start configuration information.

4. The method as described in claim 1, characterized in that, The method further includes adding the compressed file of the container image to be deployed to the original image file before adding the compressed file: Obtain the container image to be published, and test the container image to be published; The container image to be released, after passing the test, is compressed to form a compressed file of the container image to be deployed.

5. The method as described in claim 1, characterized in that, Before generating the server image based on the updated original image file, the method further includes: Update the old version of the software installation package and its dependencies in the original image file to the new version of the software installation package and its dependencies. Update the package manager data in the original image file according to the new software installation package and its dependent packages.

6. The method as described in claim 5, characterized in that, The step of updating the package manager data in the original image file according to the new software installation package and its dependent packages includes: Add the package name of the new software installation package to the installation manifest file of the original image file; Based on the package name of the new software installation package, update the dependency relationship between the new software installation package and its dependent packages in the package manager data.

7. The method as described in claim 5, characterized in that, The new software installation package and its dependencies include one or more of the following: the new kernel installation package and its dependencies, the new container service installation package and its dependencies, and the new tool installation package and its dependencies.

8. A server image generation apparatus, characterized in that, The device includes: The acquisition module is used to obtain the raw image file of the target architecture; The update module is used to add the compressed file of the container image to be deployed to the original image file; modify the bootloader configuration file in the original image file, and add the automated installation configuration file to the original image file; the bootloader configuration file includes the boot method configuration information of the automated installation configuration file, and the automated installation configuration file includes the installation method configuration information of the compressed file; The generation module is used to generate a server image based on the updated original image file.

9. An electronic device, characterized in that, include: A processor and a memory; the memory stores a computer program, and the processor executes the computer program to implement the method steps of any one of claims 1-7.

10. A computer storage medium, characterized in that, The computer storage medium stores a plurality of instructions adapted for loading by a processor and executing the method steps as claimed in any one of claims 1-7.