Virtualisation tutorial by R Botha on 2024/11/08 1) QEMU/KVM setup 2) Folder / drive for data 3) Sharing folder for VM 4) Set up Virtual machine - Linux 5) Link VM to shared data on Host 1) QEMU/KVM SETUP ----------------- sudo apt-get install virt-manager #Add user access to QEMU-KVM sudo usermod -a -G kvm roelf sudo nano /usr/lib/libvirt/libvirt-guests.sh #Edit shutdown to suspend or shutdown, depending on requirement, and on_boot to ignore / start ON_BOOT="ignore" ON_SHUTDOWN="suspend" Also check: https://www.brianlinkletter.com/2019/09/run-a-script-on-virtual-machines-when-the-host-is-shut-down/ 2) DATA DRIVE ON LINUX ----------------------- Install device, make sure the laptop boot is set up to be from OS drive blkid #Get data drive UUID witk blkid / disks app #add to /etc/fstab: UUID=8b2182cc-c30c-48a9-8928-39acc303e5ce /Data ext4 defaults 0 0 sudo mkdir /Data sudo mount /Data Structure on /Data • Work - maybe linked to Work Google • Work-Confidential – LOCAL Only • Personal - maybe linked to personal email • TEMP - To handle incoming data + sort into the other folders User permissions - set the necessary with chown and chmod Link in home folder: roelf@roelfl5:~$ ln -s /Data/Work/ WORK etc Now you have the places to load all your data: Work, Personal, etc 3) SHARING DATA DRIVE / FOLDER FOR VM ------------------------------------- #VM and SAMBA and sharing to Wi7 VM sudo nano /etc/samba/smb.conf #add to [global] section: usershare owner only = yes interfaces = 127.0.0.0/8 192.168.122.0/24 bind interfaces only = yes [Data] Comment = Samba Shared Directory path = /Data writable = yes guest ok = yes read only = no force user = roelf sudo service smbd restart sudo smbpasswd -a roelf (make same password as for Windows VM user roelf) 4) SET UP VM ------------ Linux: ------ Linuxmint xfce - Lightweight https://linuxmint.com/download.php Windows: -------- Install Drivers for Windows: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/ Link via CD drive Make sure Virtio drivers are used for all storage and networking devices! Change CD drive(s) to z:, y: etc BOTH: ----- HOST side: Make sire the qemu-ga is connected when client OS is running sudo virsh net-autostart default Test suspend option / integration with cmd on host: virsh list --all virsh managedsave Win7_RoelfL5 5) Link VM to Shared Data Drive ------------------------------- Browse for network drives on 192.168.122.1 - Link /Data to D: (Auto reconnect) or /Data (OS Dependent)