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

Поділитися
Вставка
  • Опубліковано 26 вер 2024
  • 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
    UA-cam Channel : / @linuxtechi9979
    ######################################
    Thank you for Watching!!
    ######################################

КОМЕНТАРІ • 19

  • @AbdirashidHussein-ij9iu
    @AbdirashidHussein-ij9iu Місяць тому +2

    Man you're saviour 😊😊😊 really thanka for your sharing your knowledge. I have been struggling for years 😮😮😮 for this really appreciate

  • @jbcollins1957
    @jbcollins1957 8 днів тому

    The tutorial was excellent but I ended up having a problem when I tried to ping the ip address of the guest machine from the host machine. Ping came as "4 packets transmitted, 0 received, 100% packet loss, time 3073ms".Have no idea how to fix problem. Your explainations were great and easy to understand.

  • @sparklst3f877
    @sparklst3f877 14 днів тому

    Thank you for very nice tutorial. What if I want to install macOS Sonoma instead?

  • @leon_-vv8un
    @leon_-vv8un 21 день тому

    hi, thank you for sharing how to configure kvm! I am using a laptop with wireless card only, no ethernet card could you show how to configure the bridge for computers with wireless only?

  • @nabalrai21
    @nabalrai21 8 днів тому

    the only problem i had is it doesn't show [ens33] in IP addr instead of it there is enp2s0

  • @ManfredWagner-y3v
    @ManfredWagner-y3v 26 днів тому

    apsolutly not able to install on 24.04.1 - it always says if i want to create a new VM "Error:No active Connection for this Installation" - so whats wrong.

    • @atishsaha6127
      @atishsaha6127 24 дні тому

      noticed this message shows only if i open virt-manager using gui...always have to run sudo virt-manager from terminal for it to work right.

  • @mindwis3
    @mindwis3 3 місяці тому +1

    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.

  • @voidd..
    @voidd.. 23 дні тому

    hi~
    i followed everything in this video , and at first it seems everything is working fine but after a few mins. i no longer have internet connection , can you me help me with this one .

    • @linuxtechi9979
      @linuxtechi9979  23 дні тому

      Hi,
      It appears like a network issue, please cross verify the network configuration like IP address, Gateway and DNS IP. Try to ping your gateway IP address and then DNS Server IP. If both are reachable then you should access internet otherwise check your underlay network.

  • @sonofman858
    @sonofman858 Місяць тому

    Hi at minute 8:27 of your video the lower part of the terminal says "Lines 1-22/22 (END) message which blocks my terminal and I am unable to remove it. Can you please tell me how you got rid of it to continue, as I am unable to proceed from there. thanks

    • @linuxtechi9979
      @linuxtechi9979  Місяць тому +1

      You can use ctlr+c to get rid of of that situation.

  • @105-maseerafatima5
    @105-maseerafatima5 20 днів тому

    how to enable virtualization in ubuntu 24.04? like I tried the rebooting one but it didn't worked

    • @linuxtechi9979
      @linuxtechi9979  20 днів тому

      When you enable VT Technology from Bios Settings then virtualization will be enabled automatically in Ubuntu OS.

  • @abdoelqayyum
    @abdoelqayyum 2 місяці тому

    nice .. can you install opnsense with this method ?

  • @jaqen_hgar
    @jaqen_hgar 3 місяці тому +1

    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  3 місяці тому

      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 3 місяці тому

      ​@@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.