4.3. Managing images

Acronis Cyber Infrastructure allows you to upload ISO images and templates that can be used to create VM volumes. An ISO image is a typical OS distribution that needs to be installed on disk. In turn, a template is a ready volume in the QCOW2 format with an installed operating system and applications and a set minimum size. Many OS vendors offer templates of their operating systems under the name “cloud images”. For a list of guest OSes that are supported in virtual machines, refer to Supported guest operating systems.

4.3.1. Uploading and removing images

To add an image, do the following:

  1. On the Images screen, click Add image.

  2. In the Add image window, do the following:

    1. Click Browse and select a template or ISO file.

    2. Specify an image name to be shown in the admin panel.

    3. Select the correct OS type from the drop-down list.

      Important

      The OS type affects VM parameters such as hypervisor settings. VMs created from an image with an incorrect OS type may not work correctly, for example, they may crash.

    ../_images/compute_images1_ac.png
  3. Click Done to start uploading the image. Upload progress will be shown in the bottom right corner.

Note

If you select an image assigned to a placement, the created virtual machine will also be included in this placement. For more information, see the Administrator Guide.

To download or remove an image, click the ellipsis button next to it and click the desired action.

4.3.2. Creating volumes from images

You can create volumes from both ISO images and templates. Do the following:

  1. On the image panel, click Create volume.

  2. In the Create volume window, specify the volume name, size, and choose a storage policy.

    ../_images/compute_images2_ac.png
  3. Click Create.

The new volume will appear on the Volumes screen.

4.3.3. Mounting ISO images to virtual machines

Note

This feature is supported only for Linux virtual machines.

To mount an ISO image to a Linux VM, do the following:

  1. Create a volume from the ISO image, as described in Creating volumes from images.
  2. Attach the resulting volume to the desired VM, as described in Attaching and detaching volumes.

The mounted disk will appear inside the Linux VM.

4.3.4. Preparing templates

You may need to create a template in these cases:

  • to rescue a virtual machine
  • to create a VM accessible via SSH
  • to create a VM customizable with user data

In general, the actions to create a template from an ISO image are the following:

  1. Create a virtual machine from an ISO image (refer to Creating virtual machines).
  2. Install the guest OS using the built-in VNC console.
  3. Shut down the VM.
  4. Convert the VM boot volume to a template (refer to Creating images from volumes).

However, to be able to customize a VM or connect to it via SSH, you also need to install cloud-init and OpenSSH inside its template before the VM deployment. Preparation of such templates differs depending on the guest operating system and is described in the sections below.

4.3.4.1. Preparing Linux templates

As all Linux guests have OpenSSH Server pre-installed by default, you only need to make sure a Linux template has cloud-init installed.

The easiest way to get a Linux template with cloud-init installed is to obtain it from its official repository or build one with the diskimage-builder tool. For more information, refer to Creating Linux templates.

4.3.4.2. Preparing Windows templates

Windows guests have neither Cloudbase-Init nor OpenSSH Server pre-installed by default. You need to install and configure them manually. Do the following:

  1. Create a VM from a Windows image as described in Creating virtual machines.

  2. Log in to the VM and install the guest OS by using the built-in VNC console.

  3. Create a new administrator account that will be used for SSH connections and log in with it.

  4. If you need to install and configure OpenSSH Server, do the following:

    1. Run Windows PowerShell with administrator privileges and set the execution policy to unrestricted, to be able to run scripts:

      > Set-ExecutionPolicy Unrestricted
      
    2. Download OpenSSH Server (for example, from the GitHub repository), extract the archive into the C:\Program Files directory, and then install it by running:

      > & 'C:\Program Files\OpenSSH-Win64\install-sshd.ps1'
      
    3. Start the sshd service and set its startup type to “Automatic”:

      > net start sshd
      > Set-Service sshd -StartupType Automatic
      
    4. Open TCP port 22 for the OpenSSH service in the Windows Firewall:

      • On Windows 8.1, Windows Server 2012, and newer versions, run:

        > New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound \
        -Action Allow -DisplayName OpenSSH
        
      • On Windows 7, Windows Server 2008, and Windows Server 2008 R2, run:

        > netsh advfirewall firewall add rule name=sshd dir=in action=allow \
        protocol=TCP localport=22
        
    5. Open the C:\ProgramData\ssh\sshd_config file:

      > notepad 'C:\ProgramData\ssh\sshd_config'
      

      Comment out the following lines at the end of the file:

      #Match Group administrators
      #AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys
      

      Save the changes.

    6. Create the .ssh directory in C:\Users\<current_user> and an empty authorized_keys file inside it:

      > cd C:\Users\<current_user>
      > mkdir .ssh
      > notepad .\.ssh\authorized_keys
      

      Remove the .txt extension from the created file:

      > move .\.ssh\authorized_keys.txt .\.ssh\authorized_keys
      
    7. Modify the permissions for the created file to disable inheritance:

      > icacls .\.ssh\authorized_keys /inheritance:r
      
  5. Download Cloudbase-Init (for example, from the official site), launch the installation, and then follow the on-screen instructions:

    1. In the Configuration options window, enter the current username in the Username field:

      Important

      The user account password will be reset on the next VM startup. You will be able to log in with this account by using the key authentication method or you can set a new password with a customization script (refer to Creating virtual machines).

      ../_images/win_guests_ssh1.png
    2. When the installation is complete, do not run Sysprep and click Finish:

      ../_images/win_guests_ssh2.png
    3. Run Windows PowerShell with administrator privileges and open the file C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf:

      > notepad 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf'
      

      Add metadata_services and plugins on two lines:

      metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService,\
      cloudbaseinit.metadata.services.httpservice.HttpService
      plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,\
      cloudbaseinit.plugins.windows.ntpclient.NTPClientPlugin,\
      cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,\
      cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,\
      cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin,\
      cloudbaseinit.plugins.windows.licensing.WindowsLicensingPlugin,\
      cloudbaseinit.plugins.common.sshpublickeys.SetUserSSHPublicKeysPlugin,\
      cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,\
      cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin,\
      cloudbaseinit.plugins.common.userdata.UserDataPlugin,\
      cloudbaseinit.plugins.windows.winrmlistener.ConfigWinRMListenerPlugin,\
      cloudbaseinit.plugins.windows.winrmcertificateauth.ConfigWinRMCertificateAuthPlugin,\
      cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin
      

      Note

      Make sure to remove all backslashes in the lines above.

      Save the changes.

  6. Stop the VM.

  7. After the VM is shut down, convert its boot volume to a template (refer to Creating images from volumes).