User Tools

Site Tools


unix:freebsd:system_builds:linux_xen_domu

Create FreeBSD DOMU on Linux Xen 4

These are my notes. Modify for your system. I do the initial install over VNC, then set up console (see references for other approaches).

  • My Xen DOM0 has a bunch of space on /home to put ISO's
  • I use LVM as a back end for the storage. The VG for that is named vg0.
  • I have remmina (a VNC client) set up with a default for a VNC to localhost:6 (ie, vnc to localhost port 5906)

Preparation

# Connect to DOM0. Might as well port forward for VNC
ssh -L localhost:5906:localhost:5901 user@DOM0.IP
sudo su # become root
# make someplace to store ISO
mkdir -p /home/xen-store/isos
cd /home/xen-store/isos
# Download an ISO install, either CD or DVD into /home/xen-store
# See https://www.freebsd.org/where.html
# find image, right click and copy URL; place in next step
wget https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/11.2/FreeBSD-11.2-RELEASE-amd64-disc1.iso.xz
# uncompress image
xz -d FreeBSD-11.2-RELEASE-amd64-disc1.iso.xz
Create an LV in /dev/vg0
lvcreate -L 20G -n freebsd vg0
# ensure there is nothing bootable on our new image
dd if=/dev/zero of=/dev/vg0/freebsd bs=2048 count=1

Create /etc/xen/freebsd.hvm.

freebsd.hvm
builder = "hvm"
name = "freebsd"
memory = 4096
vcpus = 12
vif = [ 
         'bridge=xenbr0',
         # or you can set values. MAC must be unique in the network
         # 'mac=00:16:3E:FB:3E:10,vifname=freebsd0,bridge=xenbr0',
      ]
disk = [ 
         'phy:/dev/vg0/freebsd,hda,w',
         'file:/home/xen-store/FreeBSD-11.2-RELEASE-amd64-disc1.iso.xz,hdc:cdrom,r' 
      ]
boot = "cd" # Boot to hard disk image
usbdevice = 'tablet'
vnc = 1
vncdisplay=1
# serial = "pty"

Install FreeBSD

Ready to start the virtual for the first time. When you are done with the install, it will try to reboot into the image again, so you must let it, then destroy it (last two steps).

xl create /etc/xen/freebsd.hvm
  1. open Remmina or some VNC client on your local machine to localhost:5906
  2. Perform installation
  3. Make it easy on yourself and set at least one user as member of additional group wheel
  4. When done, let it reboot

If it reboots into the CD, then there is an issue. Simply kill it, then destroy it and remove change the boot line to boot = 'c'

xl destroy freebsd
  1. Restart your vnc session (it goes away when you reboot)
  2. Find your IP
  3. ssh to the server
  4. become root vi su

Optional

If you want to use xl console, do the following:

On DOMU

  • edit /boot/loader.conf
  • insert line
console="comconsole"

On DOM0

  • uncomment last line in /etc/xen/freebsd.hvm (remove the pound sign at the beginning)
  • serial = "pty"
  • Reboot DOMU. Now, you can use xl console (or xl create … -c) in addition to VNC/
unix/freebsd/system_builds/linux_xen_domu.txt · Last modified: 2018/11/09 22:10 by 127.0.0.1