OpenSolaris 2008.11 Paravirtualized domU on Xen 3.1.2

| | Comments (0) | TrackBacks (0)
After scouring the internet for a definite solution, I found many. Here is another to add to the list. This is for a paravirtualized Opensolaris 2008.11 domU 64bit.

The system I am using is the most recently updated CentOS 5.2 X86_64 running the CentOS xen package which is v3.1.2 (even though it still says 3.0.4 in the RPM name.. gg CentOS)
First, you will need to create the directory for the opensolaris guest I am using /vm/opensolaris for the purposes of this blog entry.

Next, you can download the Opensolaris 2008.11 Live CD from here.

The fastest way is to go into your vm directory (eg. /vm/opensolaris) and do:

wget http://dlc.sun.com/osol/opensolaris/2008/11/osol-0811.iso

After the file has downloaded you will need to grab the kernel and ramdisk from it.
Mount the iso on /mnt (or any other directory).

mount -o loop,ro /vm/opensolaris/osol-0811.iso /mnt

Once the file is mounted, copy the following files to your opensolaris directory.

cp /mnt/platform/i86xpv/kernel/amd64/unix /vm/opensolaris
cp /mnt/boot/x86.microroot /vm/opensolaris


Now you must setup either a disk image or lvm for the new vm, if you are creating a disk image do:

dd if=/dev/zero of=/vm/opensolaris/root.img bs=1G count=10

This creates a 10GB image for use as the root drive.

Now you must create the initial install config file in the opensolaris directory called opensolaris-install.cfg with the following contents: note that the disk= and extra= lines are split up here, but should all be on one line without the "\"

name = "opensolaris"
vcpus = 1
memory = 1024
kernel = "/vm/opensolaris/unix"
ramdisk = "/vm/opensolaris/x86.microroot"
extra = "/platform/i86xpv/kernel/amd64/unix -B \
console=ttya,livemode=text"
disk = ['file:/vm/opensolaris/osol-0811.iso,6:cdrom,r',\
'file:/vm/opensolaris/root.img,0,w']
vif = ['']
on_shutdown = "destroy"
on_reboot = "destroy"
on_crash = "destroy"

Now you can start the install procedure starting the domU with a console.

xm create -c /vm/opensolaris/opensolaris-install.cfg

You should see the following:

Using config file "/vm/opensolaris/opensolaris-install.cfg".
Started domain opensolaris
v3.1.2-92.1.22.el5 chgset 'unavailable'
SunOS Release 5.11 Version snv_101b 64-bit
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Hostname: opensolaris
Remounting root read/write
Probing for device nodes ...
NOTICE: xdf@6: failed to read feature-barrier
NOTICE: xdf@0: failed to read feature-barrier
Preparing live image for use
Done mounting Live image
USB keyboard
 1. Albanian                      22. Latvian                      
 2. Belarusian                    23. Macedonian                   
 3. Belgian                       24. Malta_UK                     
 4. Bulgarian                     25. Malta_US                     
 5. Croatian                      26. Norwegian                    
 6. Czech                         27. Polish                       
 7. Danish                        28. Portuguese                   
 8. Dutch                         29. Russian                      
 9. Finnish                       30. Serbia-And-Montenegro        
10. French                        31. Slovenian                    
11. French-Canadian               32. Slovakian                    
12. Hungarian                     33. Spanish                      
13. German                        34. Swedish                      
14. Greek                         35. Swiss-French                 
15. Icelandic                     36. Swiss-German                 
16. Italian                       37. Traditional-Chinese          
17. Japanese-type6                38. TurkishQ                     
18. Japanese                      39. TurkishF                     
19. Korean                        40. UK-English                   
20. Latin-American                41. US-English                   
21. Lithuanian                   
To select the keyboard layout, enter a number [default 41]:

Here you can just press enter to continue if you are using a US keyboard

 1. Chinese - Simplified         
 2. Chinese - Traditional        
 3. English                      
 4. French                       
 5. German                       
 6. Italian                      
 7. Japanese                     
 8. Korean                       
 9. Portuguese - Brazil          
10. Russian                      
11. Spanish                      
To select desktop language, enter a number [default is 3]:

Here you can press enter again for English

User selected: English
Configuring devices.
Mounting cdroms
Reading ZFS config: done.

opensolaris console login:


Now you are at the login prompt for the Live CD. To make the install easier, you can setup a VNC server to connect to for a graphical install.

First, you will need to login with the credentials jack/jack (username/password).

opensolaris console login: jack
Password:
Sun Microsystems Inc.   SunOS 5.11     snv_101b       November 2008
jack@opensolaris:~$


Now that you are logged in, you will have to setup the VNC server. You will need to create a user vnc directory, copy some files, then run the VNC server and setup a VNC password:

jack@opensolaris:~$ mkdir .vnc
jack@opensolaris:~$ cp .Xclients .vnc/xstartup
jack@opensolaris:~$ vncserver

You will require a password to access your desktops.

Password:
Verify:
xauth:  creating new authority file /jack/.Xauthority

New 'opensolaris:1 ()' desktop is opensolaris:1

Starting applications specified in /jack/.vnc/xstartup
Log file is /jack/.vnc/opensolaris:1.log


jack@opensolaris:~$

Now you will need to find your ip so you can connect, reminder that you may need to add your xen network bridge in the config file if you don't see an IP.

jack@opensolaris:~$ ifconfig -a

You will be looking for an IP that isn't the loopback, for me the device name was xnf0 and was below lo0 (the loopback).

Now you can VNC from any client to IPADDRESS:1 to get the desktop.

Go through the install steps and wait until you get to the screen that it asks for a reboot. Before rebooting you will need to find the ZFS ID for the bootfs in rpool. Open the terminal in the VNC session (along the top bar) and type:

pfexec zdb -vvv rpool | grep bootfs

You will see a line that appears below that will say:

bootfs = NUMBER

Remember that number as we will need it for the runtime config. Note that after the bootfs line comes up you can press Ctrl+C to cancel out (or you will wait for quite a while).

Now you can restart the VM, when you click restart the opensolaris domain should shutdown.

Check with xm list to see if it has been shutdown then create a new config called opensolaris.cfg in the opensolaris vm directory with the following: note that the extra line is split up here, but should all be on one line without the "\".

name = "opensolaris"
vcpus = 1
memory = 1024
kernel = "/vm/opensolaris/unix"
ramdisk = "/vm/opensolaris/x86.microroot"
extra = '/platform/i86xpv/kernel/amd64/unix -B \
console=ttya,zfs-bootfs=rpool/56,bootpath="/xpvd/xdf@0:a"'
disk = ['file:/vm/opensolaris/root.img,0,w']
vif = ['']
on_shutdown = "destroy"
on_reboot = "destroy"
on_crash = "destroy"



Now this is where the rpool ZFS ID comes in handy. In the extra line you will see that there is an entry that says "bootfs=rpool/56", this is what my ID is so just replace 56 with whatever your ID was.

Now you can create the VM again using the new config

xm create -c /vm/opensolaris/opensolaris.cfg

And that should be it! If you have any questions, please feel free to ask them. I remember having a hard time figuring out issues during boot.

I am not sure how stable this is, but atleast it runs.

你可能感兴趣的:(unix,centos,UP,sun,Go)