Showing posts with label opensolaris. Show all posts
Showing posts with label opensolaris. Show all posts

Monday, March 2, 2009

Create a zvol based hvm xvm

I have just created a Trixbox VM on my Opensolaris server (xVM/Xen).  It is currently a HVM and I will be looking into how I can paravirtualise it.

This really is disgustingly simple:

Create a 6GB zvol:
zfs create -V 6g array/xvm/trixbox

Create the VM:
virt-install --name Trixbox --ram 512 --file /dev/zvol/dsk/array/xvm/trixbox --vnc --hvm --os-type=linux os-variant=rhel5 --location /iso/trixbox.iso

Most of the options are self-explanatory:
--name Trixbox (the name of the VM)
--ram 512 (how much ram to allocate)
--file /dev/zvol/dsk/array/xvm/trixbox (uses the zvol device as hard disk)
--vnc (enables vnc access to the VM)
--hvm (specifies that the VM is a HVM, and not paravirtualised)
--os-type=linux os-variant=rhel5 (specifies that the VM is a rhel5 based linux VM)
--location /iso/trixbox.iso (uses this iso image as the installation media)

Easy peasy!

Thursday, February 26, 2009

VNCSERVER: Couldn't find "xauth" on your PATH

Attempting to run vncserver as non-root user gives me this error:
couldn't find "xauth" on your PATH
So I do a search for xauth:
find / -name xauth
which finds it in /usr/X11/bin

Also, knowing that when logged on as root I don't get this problem, I assume that root must have this in its path so I log on as root and run:
echo $PATH
This confirms that /usr/X11/bin is in the root users path.

I Log out of root session and add xauth to path:
PATH=$PATH:/usr/X11/bin && export PATH

vncserver now runs successfully but with some errors referring to permissions on the ~./vnc & ~./Xauthority folders.

For some reason root:root is owner of the .vnc in my root folder, presumably because I had run vncserver initially while su'ed from my non-root users session...

So:
pfexec -R marc:staff ~/.vnc
pfexec -R marc:staff ~/.Xauthority
Sorts that out!

vncserver -kill :1
vncserver
and all is working great!

Tuesday, February 24, 2009

How to enable xVM on Opensolaris 2008.11

Create a new boot environment called "xvm":
beadm create -a -d xvm xvm

Reboot into new "xvm" environment:
reboot

Download & install xVM packages:
pkg install xvm-gui SUNWvirt-manager SUNWxvm SUNWvdisk SUNWvncviewer

Modify xvm entry in /rpool/boot/grub/menu.lst to the following:
#============ End of LIBBE entry =============
title xvm
bootfs rpool/ROOT/xvm
kernel$ /boot/$ISADIR/xen.gz
module$ /platform/i86xpv/kernel/$ISADIR/unix /platform/i86xpv/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=text
module$ /platform/i86pc/$ISADIR/boot_archive
#============ End of LIBBE entry =============

Reboot into new "xvm" with xvm kernel:
reboot

Check xvm is enabled in kernel:
uname -a
Look for "i86xpv"

Enable xVM services:
svcadm enable -r xvm/virtd ; svcadm enable -r xvm/domains

References:

Using VNC Server on Opensolaris

To set the VNC server password:
vncpasswd

To start VNC server:
vncserver
note the display number, i.e.: myserver:1 = display 1


Connect to the VNC server:

From the VNC client, use the following syntax: servername:display number.  I.E.: for a server called "myserver" with VNC server running on display 1:
myserver:1

To stop VNC server:
vncserver -kill :[display number]
i.e.: to stop display 1:
vncserver -kill :1

Enable gnome desktop:

Using your favourite text editor edit the/.vnc/xstartup file in your home folder:
vi ~/.vnc/xstartup
disable TWM (Timeless Window Manager) by commenting out:
#twm &
Add the following lines at the end:
unset SESSION_MANAGER
gnome-session & 
"unset SESSION_MANAGER" disables gnomes check for other session managers.  "gnome-session &" starts the gnome desktop.


My xstartup file:
#!/bin/sh

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# twm &
unset SESSION_MANAGER
gnome-session &