Getting Started with OpenSolaris using VMWare

From Genunix

By Bill Rushmore
Posted on: 27 Feb 2006

(The original article is published on the opensolaris.org site. Please post your comments in the discussion page.)

Contents

Getting Started

So you want to try out OpenSolaris, but you don't have a machine available. Then VMware is what you need. Even if you do, VMware is great tool to get help you get started with OpenSolaris and can be a great tool to help you on your kernel hacking efforts. VMware Workstation 5.5 has "experimental" support for Solaris, but I have found that OpenSolaris actually runs quite well with it. This article will take you through the steps to get OpenSolaris up and running on VMware and assumes that you are new to VMware and OpenSolaris. This article will also be helpful if you are just interested in Solaris on VMware.

First, you need to get yourself a copy of VM Workstation. It will run on Windows and some Linux distros. You really don't need super impressive hardware to get started. My first test machine has only 512 mb of memory and is limited with disk space which requires me to run off an external USB drive. In both cases the performance is tolerable. But, of course, the more memory, disk, and CPUs you have the better.

You may be wondering, so what is VMware? VMware is an application that emulates a PC or runs as a virtual machine (VM). So basically when you run OpenSolaris on VMware, it acts as its own dedicated box, when actuality, it is running as an application on Windows or Linux. Hardware, such as NICs and video cards, is emulated in VMware, which can be your saviour if your underlying hardware isn't yet supported by Solaris.

Once VM Workstation is installed, start by creating a new virtual machine.

Creating the Virtual Machine

  1. File -> New-> Virtual Machine
  2. On the first selection screen, just choose the typical configuration; after all, if you need "custom", then you probably don't need this article.
    Figure 1
    Enlarge
    Figure 1
  3. Now check "Sun Solaris" and select "Solaris 10 (experimental)" or if you are lucky enough to have a 64-bit machine "Solaris 10 64-bit (experimental)".
    Figure 2
    Enlarge
    Figure 2
  4. The next step will ask where you want to save your VM settings and log files. Think about this for a second before you accept the defaults. On Windows, the default is in the "My Documents" folder, which isn't always the best choice. It is a good idea to keep the VM's disk image file with the settings so this folder is going to get big. Another thing to think about is organization. You will probably be getting hooked on this virtual machine thing, and you'll want to keep it organized. Think also about a good naming scheme. For now, a good name would be "OpenSolaris_base", and put it on a partition with lots of space.
    Figure 3
    Enlarge
    Figure 3
  5. The next step is to determine what kind of networking you will set up. The best choice is bridged. With this choice, Solaris will be just another node on the network. However, if you are unable to assign your instance its own IP address or if you want to move the VM to different networks, then select NAT.
    Figure 4
    Enlarge
    Figure 4
  6. Now you need to determine how much disk space you want to allocate. The default is 8Gb, but you may want to double that because you'll need some space to OpenSolaris builds. I recommend that you do not allocate all the disk space now unless you have massive free disk space and you want to get every little bit of speed out of the VM. But just remember that having all the disk pre-allocated might get in the way later when you start doing things like cloning images. Also, select "Split into 2 GB files" if you plan on moving the VM around since it will make it easier to zip it up or put it onto DVD-R's.
    Figure 5
    Enlarge
    Figure 5
  7. Before you start the VM, you may want to edit the virtual machine settings that were just built. Particularly for the amount of memory allocated to the VM especially if you plan on building OpenSolaris. Allocate as much memory to the VM as you can spare.
    Figure 6
    Enlarge
    Figure 6

Installing Solaris

Now get yourself a copy of Solaris Express. You should download the DVD ISO image -- yes, even if you don't have a DVD burner : you won't actually need to create a physical copy of the image. Once you have the Solaris Express ISO file go back into the VM settings. Select the CD-ROM and choose "Use ISO image" and enter the path to the ISO file. Since VMware is emulating a DVD-ROM device, it just mounts the ISO and the VM will think it is a physical drive.

Once you have ISO mounted it is time to start up the VM. You'll notice the screen looks a lot like your PC when it starts up, Figure 7. Eventually you'll get to the Solaris install screens.

  1. To start off you'll be setting up networking on the VM's network interface, pcn0. One thing to keep in mind is that if you select DHCP and you are using the NAT networking scheme you'll need to edit the /etc/default/dhcpagent file to keep your hostname from getting automatically assigned by the DHCP server once you have it up and running.
  2. After the network and time zone information is complete, you'll be asked about the installer options.
  3. On the first screen just select "standard".
  4. Next select "Manually eject CD/DVD" since you need a reminder to point to a new ISO if needed (but if you took my advice on the DVD you won't need to worry).
  5. Select "yes" for automatic reboot if you want.
  6. The next screen of interest is the disk partitioning. First, let Solaris use the entire disk. Then let the installer do an auto-layout. It will ask you to select the file systems for auto-layout. I recommend one for / and one for swap if you are new to this stuff. I really don't care for the way auto-layout sets things up, but it is easy to customize its defaults. Just hit F4 and adjust accordingly. First of all, the swap is probably too small if you want to do an OpenSolaris build. Also, the root slide is too small and /export/home takes up too much space for our needs. Since this is a test system, here is what I do. I get rid of home slice and then set swap to 2048 MB then the rest to /. Here's a trick to do that if you don't want to do math. First set / to 0 then set it to the "Free" number on the last line.
  7. That's pretty much it for the configuration steps -- time to sit back and let the install complete.

Fixing the Screen Size

After the install completes, you will run into your first problem. During the install, the screen is at a normal size with no problems, but the first time Solaris boots up the screen resolution is too small at 640x480. Somehow, Solaris wasn't able to use the same resolution it used during the install, so you'll need to run "kdmconfig" to fix this. You'll need to log in to the Solaris console in text before the CDE login screen appears. If you miss it, I suggest you log in to a CDE session; it will be a little easier to manage with the small screen size. Here you can reboot and try again or run kdmconfig from a maximized terminal window, the only caveat being you won't be able to test your new setup.

  1. Once you are at the command line, run "kdmconfig" as root. The first choice you'll have is Xorg or Xsun. Both will work. If you're a Linux fugitive then Xorg setup should be old hat. Otherwise, just select Xsun to get started because it is a little easier to set up. You might want to experiment with Xorg later on.
  2. Once you have chosen Xsun from the first screen in kdmconfig, next you need to choose your video card and monitor options. For running Xsun under VMware, you should choose "XF86-VMWARE Vmware SVGA virtual video cards".
  3. Next select the first MultiFrequency monitor, the one that is 100khz and can do 1600x1200 @80hz. For the screen size, just leave it at 17-inch.
  4. Now you can pick a resolution. The minimum you should choose is probably 1024x768, but think about the screen resolution you are currently running on the host desktop and adjust accordingly.
  5. Check the settings you just entered and then save and test the configuration. You will get a chance to try out the resolution. If it looks good, then accept the settings; otherwise, try experimenting with different settings. If the VM screen seems way too big, then try to change the monitor type. Don't forget the keyboard and pointing device settings if yours is different than the defaults.
  6. Reboot your new VM to make sure the changes you've made are acceptable. If all went well, you'll see a properly sized login screen.

Final Touches

Before you do anything else, make sure you make a snapshot of the VM you just created. This is very important because when you start experimenting with OpenSolaris development, it's quite possible that you can inadvertently make changes that will prevent your VMware image from booting -- of course, the host operating system will not be affected at all. Optionally, before you take a snapshot you can create a default user account first. The easiest way for the novice is to log in as root and then run "smc" from the command line. Once you have the new account set up and tested, shut down the virtual machine. Click on the "Clone this virtual machine" icon. You have the option of a full clone or linked clone. For the first image I suggest using a full clone so you can put the backup in a nice and safe place.

Any time you log in to a windowing-system desktop, don't do anything else until you disable the screen saver. Otherwise, you'll have a locked screen that won't unlock. There is a bug in current Solaris Express builds with the screen saver that affects certain video cards, and the virtual video card in VMware is one of them. That said, even when the bug gets fixed, you may not want to be running a screen saver in VMware anyway (since the host OS probably has it's own screen saver).

If you are only interested in Solaris Express you can stop. However, you're probably interested in getting the OpenSolaris source distribution or BFU archives and will want to install that. I highly recommend -- actually I INSIST -- that you clone your working VM before you BFU it. Even if you are an expert at the build process, you never know what kind of bug is waiting for you in the latest release. Remember that OpenSolaris is essentially experimental and Solaris on top of VMware is also experimental.

If you need more help with OpenSolaris, I suggest you visit the OpenSolaris and the VMware forums. Both are filled with smart people willing to help. Also check on the VMware workstation help. Believe it or not, it has information specific to installing Solaris on VMware.

-- By Bill Rushmore

Contributors/Reviewers: Ignacio Marambio Catán, Dennis Clarke, Tim Foster, Felipe Salum