====== Making Your Own Images ====== ===== Images for Xen, VServers or Zones ===== A VM2 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 : - In the left frame, select the system from the drop-down menu. - Click on **Create System Image**, which will open the creation form. - In the **Unique ID for image** field, select **New image** and enter an ID like //xen-centos5-lamp//. The VM2 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// - 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. - In the **Description for image** field, enter a short title for your image, like //CentOS 5 with Apache and MySQL// - 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 VM2 servers, but are not mandatory. - Click the **Create Image Now** button. Image creation can take several minutes, but VM2 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 stored on the VM2 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 VM2 master systems simply by transferring those files. ===== 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 VM2 master system - instead, they are stored in the Amazon S3 file storage space for one of your EC2 accounts. VM2 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 : - In the left frame, select the system from the drop-down menu. - Click on **Create EC2 Image**, which will open the creation form. - In the **S3 bucket for image** field, enter a unique directory name for the image data files, such as //centos5-virtualmin//. - From the **Save under S3 account** menu select the EC2 account that will own this image. - 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. - 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. - Click the **Create Image** button. Image creation can take several minutes, but VM2 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.