Skip to content

Instantly share code, notes, and snippets.

@socketwiz
Last active September 30, 2017 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save socketwiz/6395583 to your computer and use it in GitHub Desktop.
Save socketwiz/6395583 to your computer and use it in GitHub Desktop.
SmartOS cheat sheet

Create a dvd or flash drive: http://wiki.smartos.org/display/DOC/Download+SmartOS

Boot the image on the hardware of your choice

It will ask you the following:

  1. ip or dhcp
  2. it will enumerate the disks it finds and ask you to type in the ones you want SmartOS to manage, type in the ones you want
  3. root password

Thats about as close to an install as it gets.

I think it will reboot after you answer those couple of questions, then you'll end up at a login prompt, login with the root password you entered above obviously.

IMGADM

Now you're ready to install an image or two, imgadm is your friend here. Read the [man page][1] for all the juicy details, but here are some basics: [1]: http://wiki.smartos.org/display/DOC/Managing+Images "man page"

imgadm avail: list all of the available images that you can install from. You'll probably want to just grep for ubuntu.

imgadm import <guid>: when you list available images, each one has a guid, copy and paste the one you want to install

imgadm list: lists all of the images that you have imported

VMADM

Now that you have imported the images you are interested in you are ready to install them. vmadm is your friend here, again read the [man page][1] for details but here are some basics. [1]: http://wiki.smartos.org/display/DOC/Using+vmadm+to+manage+virtual+machines "man page"

The first thing you have to do is create a json file template that describes each image you want to install. The easiest way to do this is man vmadm, go all the way to the bottom (shift+g), then work your way back up a couple of pages (ctrl+b) until you find the templates. There are two templates, they are separated by "brand", joyent and kvm. You will want joyent for smartos based machines and kvm for linux based machines. Create a new file somewhere and paste in the template. It is pretty self explanatory, but you'll want to change a couple of the fields like IP, net mask, gateway, alias, img_uuid, etc… You get the img_uuid from imgadm list, use the guid from the image that you want to install. Sysinfo will show you what you need for nic_tag. Once you have your template looking the way you want, try and install it

vmadm create -f <template_you_just_created>: if you're like me it will yell at you about something and you'll have to go tweak a setting you missed in the template file you created. Eventually it will do something useful.

vmadm list will show you all of the images that you have installed
zlogin <guid>: login to the image.

I think vmadm will also let you do the usual vm things like start, stop, suspend, etc...

KVM

vmadm info <zone> vnc
Use ChickenVNC, enter host and display port to access the kvm console.

ZFS
Command Description
zfs snapshot zones/<guid>@some_unique_name Create a snapshot of a VM where guid is the machine you want to snapshot, you can get it with vmadm list.
zfs rollback zones/<guid>@some_unique_name the inverse of the previous command.
zfs list -t snapshot Show the list of snapshots that have been taken
SOFTWARE
Command Description
pkgin up Updates the pkgin database. You should run this command before installing any new packages just in case.
pkgin ls Lists all the installed packages
pkgin av Lists all of the available packages
pkgin in Installs a package
pkgin rm Removes a package
pkgin se Searches for a package
pkgin With no additional arugments, lists all of the available pkgin commands.
pkg_add <*.tgz> Add a package

Joyent docs: http://wiki.smartos.org/display/DOC/Home

Package repository: http://pkgsrc.smartos.org/packages/SmartOS/trunk/All

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