Skip to content

Instantly share code, notes, and snippets.

@othiym23
Created July 5, 2012 00:10
Show Gist options
  • Save othiym23/3050224 to your computer and use it in GitHub Desktop.
Save othiym23/3050224 to your computer and use it in GitHub Desktop.
Getting SmartOS working under vmware

If you prefer VirtualBox or aren't running OS X, here are some instructions and a script to help you get started with SmartOS under VirtualBox. If you use VirtualBox, skip the first section and read the section on how to get the Node.js SmartMachine up and running.

Running SmartOS under vmware Fusion

  1. Start by downloading the latest live image
  2. When you run the new VM wizard, select "Continue without disk" on the first screen of the wizard.
  3. Select Sun Solaris / Solaris 10 64-bit on the next screen.
  4. You're going to get dumped to a config screen when the live image starts up, choose DHCP for the networking and defaults for everything else.
  5. Pretty much the first thing you're going to want to do is figure out how to SSH into the box once it boots and creates its storage pools, because trying to do stuff in the virtual console is miserable. There's no cut and paste, and as far as I know there are no vmware tools for SmartOS. Because a bunch of this involves working with long UUIDs, you really want cut and paste (although try tab-completion -- I had some trouble with it a while ago, but @ryancnelson reminded me about it and it's working fine for me now).
    1. Run ifconfig -a and take a note of the e1000g0 interface's IP address (it'll be something like 172.16.178.xx).
    2. In a Terminal / iTerm window, ssh root@<ip address>

Installing the Node.js SmartMachine v1.3.3

  1. It's time to download the SmartMachine dataset / zone image, so read the SmartOS page on how that's done.
  2. You'll need to create /var/db/imgadm/sources.list, just like the wiki says.
  3. Run imgadm update.
  4. Run imgadm avail | grep node.
  5. I'm running the 1.3.3 image (UUID:f953e97e-4991-11e1-9ea4-27c6e7e8afda), which was the latest when I put together this gist. I know it has all the DTrace / mdb goodies in it (@dapsays didn't really go over the postmortem debugging stuff in his talk at NodeConf, but he's written about it before). Either way, copy a UUID for one of the zone images.
  6. Follow the instructions on the page to configure the zone, and for the IP address of the new image, just use another IP address on the same Class C network as the SmartOS host OS.
  7. It takes ~5 minutes for SmartOS to create the zone, and after that it'll be running.

Getting "local" access to the SmartMachine

There's one more tricky bit that's not super well-documented. It's generally easiest to just ssh straight into your new SmartMachine rather than using zlogin or vmadm login, but to do that, you need to grab a public ssh key and get it into the container.

  1. Make sure that you have an SSH public key available.
  2. scp ~/.ssh/id_dsa.pub root@<SmartOS host IP>: (or whatever you call your public key you use for this)
  3. ssh root@<SmartOS host IP>
  4. zlogin <huge UUID for SmartMachine, findable with 'vmadm list'>
  5. passwd node to set the node user's password inside the SmartMachine.
  6. Log out (you'll still be logged into the SmartOS host OS / live image).
  7. zlogin -l node <UUID>
  8. scp root@<SmartOS host IP>:id_dsa.pub ~/.ssh/authorized_keys (again, substitute filenames as needed).
  9. Log out of the SmartMachine (as root), log out of the SmartOS host, and then ssh node@<SmartMachine IP>.

After that, you'll be able to scp / rsync your code onto the SmartMachine, use git to check stuff out, whatever. The SmartMachine includes a pretty good set of tools out of the box. You can use pkgin and the like to install additional packages, but you can figure out how to do that on your own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment