0

I am trying to install centos 8 on ubuntu 18.04 as a virtual machine. I have a wireless connection. When I run the following command:

chh2@chh2-cpu:~$ sudo virt-install  --name=chris_centos  --ram=2048  --vcpus=2  --cdrom=/var/lib/libvirt/images/CentOS-8.1.1911-x86_64-dvd1.iso --os-type=linux --os-variant=rhel7  --network network=default --graphics=spice  --disk path=/var/lib/libvirt/images/chris_centos.dsk,size=10

I get the following error message:

Starting install...
Allocating 'chris_centos.dsk'                         |  10 GB  00:00     
No protocol specified
Unable to init server: Could not connect: Connection refused

(virt-viewer:16144): Gtk-WARNING **: 16:41:23.769: cannot open display: :0
Domain installation still in progress. You can reconnect to 
the console to complete the installation process.

I am not sure why this is not working. Especially the --network option I am not clear about. There is plenty of information on the web how to configure this with a bridge (eth0) but not a lot on how to configure with wireless (DHCP). What I want to achieve is that my virtual machine can access my wlp3s0 wireless connection and I also want to be able to access the files system of the host (Ubuntu) from my virtual-machine (Centos). Would two seperate ip addresses for host and guest be reaching for the stars? I am a bit new to this so it would be great to get some help.

Christian Hick
  • 145
  • 2
  • 7
  • you set up the bridge to connect to the wireless interface on your host system, and then you have the vm connect to the bridge so that the vm acts as just another machine on your wireless network. The whole point of setting up a vm is to separate it from the filesystem of your host but you can share directories. im not seeing any documentation on a "--network" option. what are you trying to accomplish with that? – Gordster Jan 20 '20 at 06:40
  • My understanding is that I can only use a bridge if the host is connected via Ethernet. Please correct me if I am wrong. My host (Ubuntu) is wirelessly connected. I want to be able to use the internet on my virtual machine. I further want to be able to access the host directories from the virtual machine. So I am not sure how to configure the networking options (-w) in man virt-install. – Christian Hick Jan 20 '20 at 17:07
  • You can create a bridge using the wireless adapter. Please refer to this answer to see how it is done https://unix.stackexchange.com/a/159198/265429 – Gordster Jan 20 '20 at 19:35

1 Answers1

1

You can definitely setup a bridge using your wireless adapter. Please use this answer to see one example of how it was accomplished.

As far as using virt-install to create the VM. This is what I did. I will break it down so we can use it to correct your installation

virt-install -n lockss-vm2-cent8 -r 4096 --vcpus=3 --accelerate -v --disk path=/var/lib/libvirt/images/lockss-vm2-cent8.img,size=100 --nographics --network bridge=br0,mac=00:16:xx:xx:xx:xx -x "console=ttyS0" --location http://mirror.centos-example.com/centos/8/BaseOS/x86_64/os/

The "-n" option is for the name which you specified using "--name="

"-r" is for ram "--vcpus=" is for the virtual cpus (which you did correctly) "--accelerate -v" can be replaced by virt-type "--disk" is to specify the virtual drive associated with the vm "--nographics" is for specifying a headless installation.

"--network" is for specifying networking details about the VM. As you can see in my example, I specified the bridge adapter to be used and I set the mac address manually. There was a real mac address there but I put Xs for this example. I had to set the MAC address to a specific address because of how the network is setup in my office but you shouldn't have to include that at all, so just don't include it.

"console=ttyS0" is so I can access the VM over a virtual console connection by running virsh console <vmname>

"--location" is for specifying the installation media location. In this case the installation media was on a webserver

Hopefully my example helps you. It looks like you just need to create the bridge and then specify it with the --network option as I did.

Gordster
  • 174
  • 8
  • Thanks Gordster for taking the time, that has indeed helped. The only thing I am not sure about in your answer is what the mac address relates to after --network bridge=bro0 and how to find it in my configuration. – Christian Hick Jan 20 '20 at 21:04
  • @ChristianHick I gave my virtual adapter (on the VM) a specific address because of the settings on my network. There is a server that assigns IP address to specific MAC addresses so I had to set it to a specific address. You don't have to include that in your machine. A MAC address will be assigned automatically. – Gordster Jan 21 '20 at 16:09