Wednesday, 24 September 2014

CentOS 6 DOMU under NetBSD/xen in 15 minutes

A while ago I wrote a quick post on setting up CentOS 5.x under NetBSD/xen
I've long since updated all the CentOS instances to 6.x, but I found I needed to install a fresh version and as the procedure was slightly different, here are some notes :)

Converting an existing NetBSD install to Xen DOM0

  • Install xenkernel42 and xentools42 from pkgsrc
  • Extract  kern-XEN3_DOM0.tgz into /netbsd.dom0 (leave /netbsd alone)
  • Add the following to /boot.conf - adjust 512M to the amount to reserve for the DOM0
menu=Xen 512M:load /netbsd.dom0 console=pc;multiboot /usr/pkg/xen41-kernel/xen.gz dom0_mem=512M noreboot
  • Add the following to /etc/rc.conf
xencommons=YES
xenwatchdog=YES
  • Create /etc/ifconfig.bridge0 with the following - replace bge0 with a suitable Ethernet interface
create
!brconfig $int add bge0 up
  • Reboot and select the Xen option
  • Edit /boot.cfg and change the default= entry to the number of the Xen option

To mis-quote Ken Arnold: "Now that we have a NetBSD DOM0, it would be nice to do something with it, unless you have the social life of a kumquat in which case just running the DOM0 may be enough in itself :)"

Onto setting up the DOMU!

Setting up a CentOS 6 DOMU

The easiest option it to run the standard CentOS install iso in a xen hvm (Hardware Virtual Machine) guest, and then after install switch it to a pv (ParaVirtualised) guest. The big advantage of this is it should work for pretty much any guest OS - if the guest does not support xen, just leave it as an hvm guest!

The follow assume all files are in /opt/xen. Adjust to taste
  • Download the latest CentOS 6 install iso
  • Create a file onto which to install. The below is 20G (20480M)
dd if=/dev/zero of=centos6.img bs=1m count=20480
  • Create a config file 'centos6.cfg' for installing
name = "centos"
memory = "512"
disk = [ 'file:/opt/xen/centos6.img,xvda,w', 'file:/opt/xen/boot.iso,hdc:cdrom,r'
]
vif = [ mac=02:00:00:00:00:01, 'bridge=bridge0', ]
vcpus = 2
builder='hvm'
boot='d'
vnc=1
vncunused=1
  • Start the domain to install, and then connect to the console using vncviewer. If you are running this remotely on a server you can 'ssh -Y in to proxy the X connection back to your local host
xm create centos && vncviewer :0.0
  • Complete the CentOS install, then adjust centos.cfg as vmlinuz & initrd are not needed
name = "centos"
memory = "512"
disk = [ 'file:/opt/xen/centos6.img,xvda,w', ]
vif = [ mac=02:00:00:00:00:01, 'bridge=bridge0', ]
vcpus = 2

Points to note

  • NetBSD/xen does not yet handle modules. If you need pf or ipf you will need to compile your own DOM0 kernel
  • Not all X drivers run as well under DOM0, the above was done on a server where X was not required
  • If the original NetBSD installation was before 5.0 and has been upgraded you will need to ensure the boot program must be updated
  • If anyone hits any issues with any of the above, drop me a message & I'll be happy to try to help :)

1 comment:

  1. Wow, that easy! I will have to try this out :-)

    ReplyDelete