Install libvirt, which will pull in all other required packages:
$ sudo zypper install -y libvirt
Once completed, don't forget to start the libvirt daemon:
$ sudo systemctl start libvirtd
Next up, we define a sample guest. We will install SLES12SP3, and use a virtual disk backed by an image file in our host's filesystem.To do so, create a file sles12.xml with the following content:
<domain type='kvm'>
<name>sles12</name>
<memory unit='GiB'>4</memory>
<vcpu>2</vcpu>
<os>
<type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
</os>
<iothreads>1</iothreads>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>preserve</on_crash>
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' io='native' cache='none' iothread='1'/>
<source file='/var/lib/libvirt/images/sles12.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/var/lib/libvirt/images/SLE-12-SP3-Server-DVD-s390x-GMC-DVD1.iso'/>
<target dev='sda' bus='scsi'/>
<readonly/>
<boot order='1'/>
</disk>
<interface type='direct'>
<source dev='enccw0.0.f500' mode='bridge'/>
<model type='virtio'/>
</interface>
<console type='pty'>
<target type='sclp'/>
</console>
<memballoon model='none'/>
</devices>
</domain>
Modify the highlighted parts as follows (in sequence):- image file location: Path to where the image file backing your virtual disk resides. Note that this file is defined in the next step, might grow, and sufficient free space should be available.
- ISO file location: ISO image of the Linux distribution to install in the guest. Could be any Linux distribution supported by the host distro as a guest.
- Network link: Name of the host's networking device. If in doubt, check the output of the following command: ip link show up
$ sudo qemu-img
create -f qcow2 /var/lib/libvirt/images/sles12.img 8G
Formatting '/var/lib/libvirt/images/sles12.img', fmt=qcow2 size=8589934592
encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
Define the guest and start it (which will boot the ISO image), connecting to the console: $ sudo virsh define sles12.xml
$ sudo virsh start --console sles12
This will bring up the installer. Configure to your liking, and complete the guest installation.Finally, we need to modify the guest definition to boot from its virtual disk rather than the ISO image - or we would be prompted to re-install the guest on each restart.
To do so, run
and either remove the entire <disk> element, or the indicated <boot> element only:$
sudo virsh shutdown sles12
$ sudo virsh edit sles12
<disk type='file' device='cdrom'>
<source file='/var/lib/libvirt/images/SLE-12-SP3-Server-DVD-s390x-GMC-DVD1.iso'/>
<target dev='sda' bus='scsi'/>
<readonly/>
<boot order='1'>
</disk>
No comments:
Post a Comment