Now, you have installed the KVM software and required drivers on the host operating systems. You also configured bridged based networking which will provide direct access to the Internet. It is time to create your first guest operating systems. For demonstration purpose you will install CentOS Linux v5.5 using the Internet using virt-manager GUI tool.
The virt-manager is the easiest way to install guest operating system using CDROM or Internet. It is a a desktop tool for managing virtual machines. It provides the ability to control the lifecycle of existing machines (bootup/shutdown,pause/resume,suspend/restore), provision new virtual machines, manage virtual networks, access the graphical console of virtual machines, and view performance statistics. You need to use this tool locally or remotely over the ssh session.
Step # 1: Download CentOS Linux Network Installation CD
Visit the official website and grab CentOS network installation disk and store it in /opt or /tmp directory. The wget command can be used to download an ISO file quickly:
# cd /tmp
# wget http://mirrors.hns.net.in/centos/5.5/isos/x86_64/CentOS-5.5-x86_64-netinstall.iso
Step #2: Creating CentOS Linux Guests With virt-manager
Type the following command at local server
# virt-manager
OR run virt-manager remotely over the ssh session, enter:
# ssh -X -C root@kvmserver42.nixcraft.in
# virt-manager
Sample outputs:
Within minutes you will see a vnc window and with guest operating system installation process as follows:
Now, just follow on screen installation instructions and install CentOS as per your requirements. The above procedure can be repeated for MS-Windows, OpenBSD, FreeBSD and all other supported guest operating systems.
- CentOS / Redhat: Install KVM Virtualization Software
- CentOS / Redhat: KVM Bridged Network Configuration
- KVM virt-manager: Install CentOS As Guest Operating System
- KVM virt-install: Install FreeBSD / CentOS As Guest Operating System
- KVM: Install CentOS / RHEL Using Kickstart File (Automated Installation)
- Troubleshooting KVM Virtualization Problem With Log Files
- KVM Virsh: Redirect FreeBSD Console To A Serial Port
- KVM: Starting / Stopping Guest Operating Systems With virsh Command
- Linux KVM: Disable virbr0 NAT Interface
- FreeBSD / OpeBSD Running in KVM Does Not Accept FTP Traffic
- KVM: Start a Virtual Machine / Guest At Boot Time
- KVM virt-install: Install OpenBSD As Guest Operating System
- Linux KVM: OpenBSD Guest Hangs At Starting tty Flags
- KVM Virtualization: Start VNC Remote Access For Guest Operating Systems
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 16 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hmm, running this on Ubuntu 10.04 as host. Get as far as Installation method during the CentOS install and we stop. Choose Local CDRom and it can’t find it. Choose Hard Drive and only the new virtual drives are seen – cannot see host machine drives to pick up the ISO file from.
(That’s apart from the fact that on Ubuntu a lot of the virtualisation option screens don’t match up to your images – but that’s only a by the by.)
Ubuntu host has an updated cutting edge version of KVM so images will not match exactly. This tutorial is tested and used on RHEL / CentOS based systems only. Having said that there should not be *any problem* for installing Debian or Ubuntu as host and any guest. Just put your centos guest cd/dvd into actual drive and click on use CDROM/DVD option > Forward and it should work. If you’ve more question I suggest you use our forum @ nixcraft.com.
Erm yes. I was rather trying to avoid having to burn the iso onto disc. Which is why I was interested in your article. Thanks anyway
Just copy your bootable iso-images into /var/lib/libvirt/images they’ll show up and are accessible while creating a new VM.
Thanks for the great KVM HOWTO.
I have a few questions to ask.
I am running CentOS 5.5 x86_64 on a HP Blade . I have installed all the KVM packages as detailed in your HOWTO. But the host shows me a booted xen kernel. Linux 2.6.18-194.17.1.el5xen #1 SMP Wed Sep 29 13:30:21 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Also virt-manger shows me a running instance of a xen guest Domain-0. On trying to create a new virtual instance I am allowed only a paravirtualised instance and not a fully virtualised one since virt-manger claims that the hardware does not support full virtualisation.
The CPU is a Intel(R) Xeon(R) CPU E5310 @ 1.60GHz Quad Core
The output of grep vmx /proc/cpuinfo is “fpu tsc msr pae cx8 apic mtrr cmov pat clflush acpi mmx fxsr sse sse2 ss ht syscall lm constant_tsc pni vmx ssse3 cx16 lahf_lm”
All help appreciated
Ashraf
I figured what was wrong after pursuing the issue on googacle :)
First time setting up virtualisation. Done it with virtualbox only till date.
KVM does not need a specialised kernel like Xen does. It runs off the mainline kernel.
This article clued me in on that http://blog.codemonkey.ws/2008/05/truth-about-kvm-and-xen.html
My installation was booting the xen kernel and therefore I was having above issues.
So I edited my /boot/grub/menu.lst to boot the mainline kernel and in virt-manager I deleted the Xen connection.
Restarted virt-manager and am ready to go.
Ashraf
Still stymied. This processor even though it supports virtualisation at the hardware level seems to have a problem with/within the kernel. I have no idea about this. I am unable to setup full virtualisation of any sort. Even VirtualBox claims it can run only a 32bit OS and not the 64bit that I want to.
I know this is an old thread, but for the benefit of others, I would suggest that you need to enable virtualisation in the BIOS
Yep. Two things:
1. Make sure you are using the mainline kernel.
2. Make sure your bios has the virtualization bits set.
I ran into the same issue when i started playing a few months back.
hi,
I cant run virt-manager remotely over the ssh session, I tried :
# ssh -X -C root@kvmserver42.nixcraft.in
# virt-manager
but I rece’ error msg stating
root@ubox:~# virt-manager
ERROR:root:Unable to initialize GTK: could not open display
Traceback (most recent call last):
File “/usr/share/virt-manager/virt-manager.py”, line 413, in
main()
File “/usr/share/virt-manager/virt-manager.py”, line 289, in main
raise RuntimeError(_(“Unable to initialize GTK: %s”) % str(e))
RuntimeError: Unable to initialize GTK: could not open display
Traceback (most recent call last):
File “/usr/share/virt-manager/virt-manager.py”, line 420, in
_show_startup_error(str(run_e), “”.join(traceback.format_exc()))
File “/usr/share/virt-manager/virt-manager.py”, line 61, in _show_startup_error
import gtk
File “/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py”, line 69, in
_init()
File “/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py”, line 57, in _init
warnings.warn(str(e), _gtk.Warning)
gtk.GtkWarning: could not open display
am just a newbie, please guide !! host: Ubuntu 10.04 Desktop version guest1: ubuntu server guest2:win2k3 server
THANKS!!
Hi,
I have follow this howto and stuck on starting virt-manager i get a error:
Traceback (most recent call last):
File “/usr/share/virt-manager/virt-manager.py”, line 376, in ?
_show_startup_error(str(run_e), “”.join(traceback.format_exc()))
File “/usr/share/virt-manager/virt-manager.py”, line 52, in _show_startup_error
import gtk
File “/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py”, line 76, in ?
_init()
File “/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py”, line 64, in _init
_gtk.init_check()
RuntimeError: could not open display
It seems a vnc error but yum install vnc gtk-vnc didn’t help?
Some one know how to solved this issue?
System centos 64bits 5.5
greetz
Hi,
Have you ever tried gluster based storage for VM files ? I have been trying to do so, however doesn’t seem to be working. DomU hangs when i try to do an install, and even kvm isn’t working
gluster 3.2
centos 5.6
Thanks
Hi,
I’m getting a ‘no hypervisor options available’ message in virt-manager under CentOS 6.
Has anyone run in to that?
I have an Intel i5 second gen proc.
Thanks,
Scott
Same issue when tried to run virt-manager, as shown below
Traceback (most recent call last):
File “/usr/share/virt-manager/virt-manager.py”, line 376, in ?
_show_startup_error(str(run_e), “”.join(traceback.format_exc()))
File “/usr/share/virt-manager/virt-manager.py”, line 52, in _show_startup_error
import gtk
File “/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py”, line 76, in ?
_init()
File “/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py”, line 64, in _init
_gtk.init_check()
RuntimeError: could not open display
Any help is very much appreciated.
lawrence
Are you trying to access a headless box?
If so, you need to forward your display. If you have windows, there is an app (free) called Xming.
I’m hianvg the same CD problem. I tried Anonymous’ add hardward solution. I can’t select ‘Normal Disk Partition’ as it is unavailable. I am running 64 bit if that helps.