Created
November 5, 2019 21:15
-
-
Save mcornea/b3f8c2eabd9c08ca5627a851f9da8d30 to your computer and use it in GitHub Desktop.
create_vm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Run the following commands on the hypervisor host. Any host used for InfraRed virt deployments should do the job. | |
## Download RHEL8 beta image | |
curl -o /var/lib/libvirt/images/rhel-guest-image-8.0-1690.x86_64.qcow2 http:///rhel-guest-image-8.0-1690.x86_64.qcow2 | |
## Downloag libguestfs appliance to allow virt-customize on RHEL7 hypervirosr | |
curl -o /tmp/libguestfs_appliance.tar.gx http://download.libguestfs.org/binaries/appliance/appliance-1.40.1.tar.xz | |
tar -C /tmp/ -xvf /tmp/libguestfs_appliance.tar.gx | |
## Create the disk file to be used for the standalone VM | |
qemu-img create -f qcow2 /var/lib/libvirt/images/standalone.qcow2 100G | |
## Prepare disk image | |
export LIBGUESTFS_PATH=/tmp/appliance | |
export LIBGUESTFS_BACKEND=direct | |
virt-resize --expand /dev/sda3 /var/lib/libvirt/images/rhel-guest-image-8.0-1690.x86_64.qcow2 /var/lib/libvirt/images/standalone.qcow2 | |
virt-customize -a /var/lib/libvirt/images/standalone.qcow2 --root-password password:redhat --selinux-relabel | |
virt-customize -a /var/lib/libvirt/images/standalone.qcow2 --selinux-relabel --run-command 'yum remove -y cloud-init' | |
## Create standalone VM | |
virt-install --name standalone \ | |
--disk path=/var/lib/libvirt/images/standalone.qcow2,device=disk,bus=virtio,format=qcow2,cache=unsafe \ | |
--boot hd \ | |
--network network:default \ | |
--network network:default \ | |
--virt-type kvm \ | |
--cpu host-passthrough \ | |
--ram 24576 \ | |
--vcpus 8 \ | |
--os-variant rhel7 \ | |
--import \ | |
--noautoconsole \ | |
--autostart \ | |
--vnc \ | |
--rng /dev/urandom |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment