How to Install KVM on Ubuntu 24.04 Step-by-Step

Ғылым және технология

In this video tutorial, we will cover how to install KVM (Kernel-based Virtual Machine) on Ubuntu 24.04 LTS system and demonstrate creating a virtual machine using the virt-manager application.
########## KVM Installation Steps on Ubuntu 24.04 ##############
1) Package Apt Repository Packages Index
sudo apt update
2) Check if Virtualization is enabled
egrep -c '(vmx|svm)' /proc/cpuinfo
Install the cpu-checker package
sudo apt install -y cpu-checker
Another way to check if KVM virtualization is enabled
kvm-ok
3) Install KVM on Ubuntu 24.04
sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils
4) Enable and start virtualization daemon
sudo systemctl enable --now libvirtd
sudo systemctl start libvirtd
Check virtualization daemon is running
sudo systemctl status libvirtd
5) Add Your Local User to the KVM and Libvirt Group
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
6) Create Network Bridge using netplan
Create a file with following content
sudo vi /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
ens33:
dhcp4: false
dhcp6: false
bridges:
br0:
interfaces: [ens33]
dhcp4: false
addresses: [192.168.2.120/24]
routes:
- to: default
via: 192.168.2.1
metric: 100
nameservers:
addresses: [8.8.8.8]
save and close the file.
sudo chmod 600 /etc/netplan/*.yaml
Now, run following command to apply above network changes
sudo netplan apply
7) Launch KVM Virt-Manager and Create Virtual Machines
#howto #kvm #virtualization #ubuntu
If you have found this tutorial informative and useful, kindly do subscribe our channel and like the video.
Web Site : www.linuxtechi.com
KZread Channel : / @linuxtechi9979
######################################
Thank you for Watching!!
######################################

Пікірлер: 5

  • @abdoelqayyum
    @abdoelqayyum22 күн бұрын

    nice .. can you install opnsense with this method ?

  • @jaqen_hgar
    @jaqen_hgar2 ай бұрын

    I just did this with the help of your guide last night. Instead of using a HDD image file i had a free SSD in my pc which i want to give to VM. I saw that it can be done by providing /dev/-devicename- in the vm device setup. And it works, and should be faster. However sometimes index name of that device changes after reboot. For example nvme1n1 become 2n1 or something stupid like that. Is there anything i can do to prevent this, because then my VM will not boot, since it is looking for a disk under the previous name.

  • @linuxtechi9979

    @linuxtechi9979

    2 ай бұрын

    Method 1: Use UUID (Universally Unique Identifier) Find the UUID or Label of the SSD: You can use the blkid command to find the UUID and label of your SSD. sudo blkid This will output something like: /dev/nvme1n1: UUID="abcd-1234" TYPE="ext4" PARTUUID="12345678-01" Note down the UUID (e.g., abcd-1234) or the label if it has one. Use the disk by its UUID like /dev/disk/by-uuid/abcd-1234 When setting up the VM device in your virtualization software (VirtualBox), use the /dev/disk/by-uuid/ syntax instead of the device name. Method 2: Create a Udev Rule for Persistent Symlink: Create a new udev rule file, for example /etc/udev/rules.d/99-persistent-ssd.rules: sudo nano /etc/udev/rules.d/99-persistent-ssd.rules Add the following rule, replacing UUID with the actual UUID of your SSD: KERNEL=="nvme*", SUBSYSTEM=="block", ENV{ID_FS_UUID}=="abcd-1234", SYMLINK+="my_ssd" Reload Udev Rules and Trigger: Reload the udev rules and trigger them: sudo udevadm control --reload-rules sudo udevadm trigger Use the Symlink in VM Configuration: Now, you can use /dev/my_ssd in your VM configuration instead of /dev/nvme1n1.

  • @jaqen_hgar

    @jaqen_hgar

    2 ай бұрын

    ​@@linuxtechi9979 Thank you, that is great. I will try it out. I would like to have reliable virtual windows 10 for few apps that i need for work, like solidworks, and some engineering simulation software, and rendering software. I am curious to compare cinebench score from native rendering to VM rendering. So i am working on understanding how to pass through different hardware, like nvidia gpu, usb devices and to really speed up the virtual machine since from time to time it feels quite slow, the lag is noticable even thou i provide a lot of resources. Sad truth is that due to professional software many of us cannot completely delete windows, but if we could just turn on a VM whenever we must we can get free from microsoft and their aggressive forced updates, driver reinstalls, defaulting settings, and ofcourse spyware.

  • @mindwis3
    @mindwis3Ай бұрын

    I don't think "apt update" installs the updates @1:37 , think you need to run 'apt upgrade' to actually update the binaries. now the prompt is left at "can be upgraded" .. not "have been upgraded". Lovely tone in your video, nice work. Actually i am wrong in the above... but it is good to run the upgrade command right after install.

Келесі