Making Your Own Images

Images for Xen, VServers or Zones

A Cloudmin image is really just a compressed copy of the contents of a virtual system's filesystem, which means that it is quite possible to create your own images to supplement those that are available for download. This can be useful if you want to create multiple systems with your own customized configuration or special software installed, or if you just want to clone an existing server.

The first step to creating an image is getting a virtual system (running on Xen, VServers or Zones) setup the way you want. We recommend againsts creating any Virtualmin domains on a system to image though, as they would be duplicated on all new systems you create from it, which is likely to cause confusion or clashes. Also, configuration files that contain the IP address of the system will not be updated when a new system is created from the image, except for /etc/hosts and network config files like /etc/sysconfig/network-scripts/ifcfg-eth0 .

Once your source system has been prepared, the steps to create an image from it are :

  1. In the left frame, select the system from the drop-down menu.
  2. Click on System Operations -> Create System Image, which will open the creation form.
  3. In the Unique ID for image field, select New image and enter an ID like xen-centos5-lamp. The Cloudmin standard is for the image ID to be made up of three parts, separated by - characters :
    • The virtual system type, like xen
    • The linux distribution or OS in the image, like centos5
    • The software installed, like base or virtualmin or lamp
  4. Alternately, you can select Overwrite old image and choose an existing image of the same type that you want to replace from the adjacent menu.
  5. In the Description for image field, enter a short title for your image, like CentOS 5 with Apache and MySQL
  6. If you are replacing an image, in the Version number field enter a new version for the image you will be creating. Versions are a useful way of tracking images with the same ID if you are running multiple Cloudmin servers, but are not mandatory.
  7. Click the Create Image Now button.

Image creation can take several minutes, but Cloudmin will show you the progress as it proceeds. If the virtual system was running before you started imaging, it will be shut down (so that the filesystem can be safely copied), and then started up again after the process is complete.

If the source system has Virtualmin Pro installed, any licence information in /etc/virtualmin-license or other repository-related files will be replaced before the image is created. When a new system is created from the image, the correct Virtualmin serial number and key will be put back into those files.

Images are by default stored on the Cloudmin master system in the /var/webmin/server-manager directory. Make sure that this is on a filesystem with plenty of disk space, as an image with the full Virtualmin stack can consume up to 500 MB. Each image is stored in a 2 or more files whose names start with the ID you entered, and you can copy images to other Cloudmin master systems simply by transferring those files.

Image Storage Locations

Cloudmin allows you to customize the locations in which images are stored, instead of just using the default directory on the master system. This can be useful if the master is low on disk space, or if you have geographically distributed host systems and want to avoid copying every image across the country when creating new virtual systems.

To change the default image storage location, the steps to follow are :

  1. Open the Cloudmin Settings category on the left menu, and click on Image Storage Locations
  2. Click on the Default location entry.
  3. To use a different directory on the host, enter it in the Directory on Cloudmin master field.
  4. To store images elsewhere, select Directory on system , choose a system from the menu, and enter a path.
  5. Click the Save button.
  6. Any images already on the Cloudmin master will remain there - this new setting only applies to images created or downloaded from now on.

To add an additional image storage location, the steps to follow are :

  1. Open the Cloudmin Settings category on the left menu, and click on Image Storage Locations
  2. Click the Add a new image storage location link.
  3. Enter a name for the location in the Location description field.
  4. Check the Directory on system radio button, choose a system from the menu, and enter a path with plenty of free space.
  5. If you want this storage location to be used only by systems in some location groups, select them in the For location groups field.
  6. Click the Save button.
  7. To copy some existing images to this new location, click on New System Images on the left menu.
  8. Check the boxes next to the images you want copied, then click the Copy Selected To All Storage Locations button.

Images for EC2

Amazon's EC2 service also supports images, also know as AMIs. Unlike images for virtual system types such as Xen, these are not stored on your Cloudmin master system - instead, they are stored in the Amazon S3 file storage space for one of your EC2 accounts.

Cloudmin supports the creation and management of EC2 images just as it does for regular images, but with a few small differences. To create an image, you must first have a running EC2 instance that has been setup the way you want, from which the image will be made.

Once your source system has been prepared, the steps to create an image from it are :

  1. In the left frame, select the system from the drop-down menu.
  2. Click on Create EC2 Image, which will open the creation form.
  3. In the S3 bucket for image field, enter a unique directory name for the image data files, such as centos5-virtualmin.
  4. From the Save under S3 account menu select the EC2 account that will own this image.
  5. In the Size of image filesystem field enter the size of the root filesystem for virtual systems that will be created from this image. This should be large enough to store the domains that you want to host on created systems - but remember that Amazon charges for S3 storage by the megabyte, so creating a huge image could be costly.
  6. If you want the image to be available to other EC2 users, change Make image publicly available? to Yes. This should not be done for images containing commercial software like Virtualmin Pro.
  7. Click the Create Image button.

Image creation can take several minutes, but Cloudmin will show you the progress as it proceeds. The source EC2 system will not be shut down during imaging, but you should minimise use of it in order to avoid inconsistencies in the filesystem state.

If the source system has Virtualmin Pro installed, any licence information in /etc/virtualmin-license or other repository-related files will be replaced before the image is created. When a new EC2 system is created from the image, the correct Virtualmin serial number and key will be put back into those files.