Ask Your Question
0

How to setup a basic CentOS virtual machine with libvirt

asked 2014-01-09 04:32:38 -0500

Lioobayoyo gravatar image

Hello,

I would like to install a CentOS 6.5 virtual machine on my machine, only with command line tools and basic networking capabilities, i.e a way to have http and ssh connections between the host (Fedora 19) and the CentOS guest.

Being still quite noobish to the nix world, I experienced some trouble.

I first did an unsuccessful attempt to install virtualbox.

I then found this page on the fedoraporject.org wiki : /wiki/Getting_started_with_virtualization?rd=Virtualization_Quick_Start#Using_virtualization_on_Fedora

(can't post full links for the moment)

I followed the instructions, installed the packages needed (libvirt ...), and enabled virtualization in my BIOS. I installed my VM from the iso CentOS-6.5-x86_64-minimal.iso (with virt-install --prompt )

While the installation went all right, if I halt the VM I absolutely don't know how to restart it. The webpage I used apparently doesn't mention it, and having a look at virsh or virt-manager manual was not yielding help for me (but maybe because I don't know how to read it properly)

the virsh list doesn't show anything but an empty list. i tried to find the machine I created using find / -name name_of_vm_as_prompted_during_virt-install and found nothing

besides, while my guest is running, no network interface is there (except lo), despite the wiki stating that there should be a basic networking interface created by default that would allow me to have connection between guest and host. However on my host I have

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 8e:3d:7c:b3:44:bf  txqueuelen 0  (Ethernet)

which, I guess, should be encouraging.

My knowledge on VM is quite limited and so is my understanding of networking.

My questions : 1) How to access my created but closed VM 2) How to set up the basic network capabilities 3) since I have 2 questions, should I split them into two separate threads ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-01-09 15:29:25 -0500

Lioobayoyo gravatar image

Ok, finally working like a charm

Answer to 1)

Using virt-manager GUI kept trace of my created VM and I'm able to start it again. Still interested in the way to do it via CLI tools though.

Answer to 2)

It was just a CentOS installation configuration misunderstanding, not related to libvirt (which had already done its job, see libvirt installation instructions about network, I don't remember where I got them but there are pretty straightforward for basic config).

I just missed the "Configure network" button on installation screens. ( Window size problem on my side ). CentOS doesn't auto-configurate its network devices anymore apparently. Or config manually after install, see for exemple : wiki.centos.org (slash) FAQ/CentOS6#head-b67e85d98f0e9f1b599358105c551632c6ff7c90

edit flag offensive delete link more

Comments

1

Answer to 1) use virt-install for installation (example https://ask.fedoraproject.org/question/28922/sas-drive-on-fedora-8/ , it uses a bridge https://ask.fedoraproject.org/question/35039/bridged-networking-not-working-in-kvm-on-f19/ - an important concept in virtualization) and vncviewer/virsh to control the VM, e.g. "virsh -c qemu:///system list --all; virsh --connect qemu:///system start f8; vncviewer `virsh vncdisplay f8`" . See http://libvirt.org/virshcmdref.html for more virsh commands

marcindulak gravatar imagemarcindulak ( 2014-01-15 06:36:14 -0500 )edit
1

answered 2014-01-12 06:25:48 -0500

ssteflea gravatar image

You can use qemu if you want to do it all in CLI. Here is a link with more information: http://www.linux-kvm.org/page/HOWTO

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-01-09 04:32:38 -0500

Seen: 3,372 times

Last updated: Jan 12 '14