Note that if you followed my guide for services hardening you may want to turn the messagebus daemon back on. If the avahi daemon and zeroconf is disabled, you will need to edit /etc/libvirt/libvirtd.conf with the following:
mdns_adv=0The rest of the guide should apply to virtually everyone else:
- Edit /etc/libvirt/qemu.conf to allow the VNC server to listen on all ports:
vnc_listen='0.0.0.0'
- Restart the libvirt daemon:
service libvirtd restart
- If you don't already have one create the LVM partition that we will be our VM's hard-disk:
lvcreate -L20G -n lv_vm1 VolGroup
- Poke a hole in the firewall so we can connect via VNC to the server. You can choose any port you wish, but in this case we will be using port 7601. Make sure you change the network to match your own settings! Edit /etc/sysconfig/iptables
-A INPUT -m --state NEW -s 192.168.0.0/24 -m tcp -p tcp --dport 7601 -j ACCEPT
- Restart the firewall:
service iptables restart
- Run the installation command:
virt-install -n vm1 -r 512 --vcpus=2 --disk path=/dev/VolGroup/lv_vm1 -c /path/to/disk.iso -v --accelerate -w bridge:br0 --vnc --vncport=7601 --noautoconsole --os-type linux --osvariant rhel6
- Now use a VNC client to connect to your server by connecting to the firewall hole we created earlier. Follow through with the rest of the installation process.
- To start and stop your VM just use the virsh command. The VM has been configured to use port 7601 for VNC, so you can always connect to it using that port unless you close it.
virsh start vm1
Further reading
- This excellent series from 'How to forge'. Part 1 (Configuration), Part 2 (Connecting to Guest), Part 3 (Creating Guest with GUI), Part 4 (Command line tools), and Part 5 (LVM based guests).
- CentOS documentation on using virt-install
- This excellent guide by Blog Normation
- A beginners guide to LVM from How to Forge
- The isborken blog on headless VM management
- Allan Fied's blog on the topic
No comments:
Post a Comment
Thanks for contributing!! Try to keep on topic and please avoid flame wars!!