This is just a summary of what was believed to work; a lot of key information here is inaccurate
All commands should be performed as the vms user. Use sudo -iu vms to become this user first.
Note: as we are using the "system" namespace, insert "–connect qemu:///system" after the "virsh" command.See the explanation here.
Three stages:
e.g.: to clone apple to peach use:
virsh list virsh list --all virsh start apple virsh suspend apple virt-clone -o apple -n peach -f /var/lib/libvirt/vms/images/peach.qcow2 virsh list
Note the format of the command:
Keep this page updated with changes to the Base OS. Use the vms user to pause the VM when changes are complete.
virsh suspend base-v(#)
Then clone the VM using the following
virt-clone -o base-v(old VM Number) -n base-v(New VM Number) -f /var/lib/libvirt/vms/images/base-v(New VM Number).qcow2
You will need to remove the old VM using the following commands
virsh destroy base-v(Old vm number)
virsh undefine base-v(old vm number)
Please also remember to remove the corresponding qcow 2 file from vms home directory/images.
Installed minimal Cent OS 7 system.
Created users Darren, Dave, and Wayne
Change SSH to go through port 22022
Restricted SSH Root and pasword logins.
Installed semanage to change the ssh port.
Added firewall rule to allow traffic through port 22022.
added ssh keys for all users to authorized_keys file.
Added all users to an admin group.
Admin group granted sudo access in a new file located in /etc/sudoers.d
file name 10-admin, file reads as
%admin ALL=(ALL) NOPASSWD:ALL
IP assigned as 78.129.208.29
Changed IP Address to 78.129.208.174
Other Tweaks done by Dave:
Yum Updates Completed
Create Virtual Machines using the following changing parts that identify to be changed.
New script created to auto create a VM this is located in the VMS user directory located var/lib/libvirt/vms
./installer.sh
virt-install \ --name linuxmail \ --ram=1024 \ --vcpus=1 \ --disk path=/var/lib/libvirt/images/IMAGENAME.qcow2,bus=virtio,size=10 \ --cdrom /var/lib/libvirt/images/PATH/TO/OS.iso \ --network bridge=eth0,mode=bridge,model=rtl8139,target dev=macvtap2 \ --graphics vnc,port=5910(change this),listen=78.129.208.78,password=Qwerty1234 \ --boot cdrom,hd,menu=on
You will need to upload a certified ISO such as CentOS, Red Hat, Windows etc to the libvirt/images directory in order to use the iso - currently in /var/spool/iso
Note: possible to install from the network rather than downloaded ISO using:
virt-install \ --name centos7 \ --ram 2048 \ --disk path=/var/lib/libvirt/images/centos7.qcow2,size=8 \ --vcpus 1 \ --os-type linux \ --os-variant centos7 \ --network bridge=virbr0 \ --graphics none \ --console pty,target_type=serial \ --location 'http://mirror.i3d.net/pub/centos/7/os/x86_64/' \ ## network install --extra-args 'console=ttyS0,115200n8 serial' ## -- should provide a console window to install into
(copied from https://raymii.org/s/articles/virt-install_introduction_and_copy_paste_distro_install_commands.html#toc_5)
<blockquote>
Be careful not to change or add any network adaptors as this can cause connectivity issues on the host machine. Just use the adaptor in bridge mode allowing eth0 to pass through on MACVTAP2.
</blockquote>
If you would like to follow the install using a program such as VNCViewer. You will need to keep the following line in making sure that the appropriate port is open on the host machine. Please also change the password to your choosing.
--graphics vnc,port=5910(change this),listen=78.129.208.78,password=Qwerty1234 \
NB: 7.3 and above require a minimum of 2G ram for initramfs to be unpacked successfully during install otherwise you run into and 'out of space' error
On the guest VM if you are unable to console in. You can try the following on the guest.