We provide Alibaba Cloud Linux 2 virtual machine images for on-premises development and testing. To use the VM image, you need to do the following steps:
+ Step 1: Download the Alibaba Cloud Linux 2 VM Image;
+ Step 2: Prepare the seed.img Boot Image;
+ Step 3: Boot the New VM.
## Step 1: Download the Alibaba Cloud Linux 2 VM Image
Currently the image is available for QEMU/KVM virtualization platform only, the image format is `qcow2`, and `virtio` drivers are used in guest operating system.
To boot your new VM and get the configurations initialized, you should prepare a `seed.img` boot image, which will be used by [cloud-init](https://cloudinit.readthedocs.io/en/latest/), to set up network configrations, host name, YUM source, etc. It is highly recommended to read cloud-init documentations before getting started.
We use NoCloud data source in cloud-init, which requires a virtual disk drvier attached to VM, including two configuration files: `meta-data` and `user-data`.
+ Create a plain-text file named `meta-data`, fill the contents as follows:
```yaml
#cloud-config
#vim:syntax=yaml
local-hostname:alinux-host
# FIXME: does not work for systemd-networkd
#network-interfaces: |
# iface eth0 inet static
# address 192.168.122.68
# network 192.168.122.0
# netmask 255.255.255.0
# broadcast 192.168.122.255
# gateway 192.168.122.1
```
+ Create a plain-text file named `user-data`, fill the contents as follows:
name:Aliyun Linux - $releasever - Plus - mirrors.aliyun.com
# FIXME: This is a workaround for network settings since the steps in
# meta-data fail to work. Blame cloud-init or systemd-networkd :)
write_files:
-path:/etc/systemd/network/20-eth0.network
permissions:0644
owner:root
content:|
[Match]
Name=eth0
[Network]
Address=192.168.122.68/24
Gateway=192.168.122.1
# FIXME: this is also a workaround for network settings.
runcmd:
-ifdown eth0
-systemctl restart systemd-networkd
```
> You should at least adjust the network sections to match the real network configurations you have.
+ Create the `seed.img` with the tool `cloud-localds` provided in `cloud-utils` package:
Install `cloud-utils` package by:
```bash
yum install-y cloud-utils
```
Then execute the following command at the same directory level as the files `meta-data` and `user-data`:
```bash
cloud-localds seed.img user-data meta-data
```
to produce a `seed.img`. Note this image only includes configuration information required to boot the VM by cloud-init, it does not include the Alibaba Cloud Linux 2 operating system files.
You could also download a `seed.img` from the table provided in Step 1. Please avoid using it if network access is mandatory but your network configuration is not `192.168.122.0/24`.
## Step 3: Boot the New VM.
You should attach `seed.img` to a KVM virtual machine running with Alibaba Cloud Linux 2 on-premise image.
- If you created the VM with GUI, like virt-manager, please add a new virtual disk driver with `seed.img`, then boot the VM;
- If you created it with a Libvirt XML, you need to add the following section to the XML file:
```xml
<disktype='file'device='disk'>
<drivername='qemu'type='raw'/>
<sourcefile='/path/to/your/seed.img'/><!-- absolute path of seed.img -->
<targetdev='vdb'bus='virtio'/>
</disk>
```
- If you run the VM directly with a qemu-kvm command line, you should append the following options:
@@ -26,7 +26,7 @@ Current released version is Alibaba Cloud Linux OS version 2, or known as 'Aliyu
## 2. How to use
- Simply buy an ECS instance and get started: [chs](https://ecs-buy.aliyun.com/), [eng](https://ecs-buy-intl.aliyun.com/);
- Or download an on-premise virtual machine image and run on your own QEMU/KVM virtualization system, instructions could be found via [chs](https://github.com/alibaba/cloud-kernel/wiki/Aliyun-Linux-2-On-Premise-Image), [eng](image).
- Or download an on-premise virtual machine image and run on your own QEMU/KVM virtualization system, instructions could be found [here](https://www.alibabacloud.com/help/doc-detail/155430.htm).