Starting With Solaris From A Linux Point of View
By seapegasus on Feb 19, 2009
A few weeks ago, Arun wrote in his blog about how to install OpenSolaris on Virtual Box. Let me add some OpenSolaris usage tips that I collected over time (so if I forget them, I can go back to my blog). ;) They are intended for users who already have prior experience with Linux and the command line in general.
When I say "Solaris" below, I mean OpenSolaris 2008.11, here is how to upgrade from OpenSolaris 2008.05 to 2008.11.\*
Processes and commands
The Linux top command displays the list of running processes. On Solaris this command is called prstat.
If you're looking for one particular process (e.g. firefox), use pgrep -l firefox; if looking for processes by one user (joe), use pgrep -l -u joe. If looking for both, combine them to a quick pgrep -lu joe firefox.
Solaris has no sudo command like Linux's "substitute user do" to execute one-off commands with admin permissions. On Solaris, use su to 'assume the identity' of another local user, including the root user, if you know the password. In contrast to sudo, you're responsible for exiting back to your own identity. So, before changing config files, type su - to become root. Including the dash argument will also update your shell environment (most visibly, the commandline prompt will say 'root' so you can actually tell which of your shells is the root shell).
You install a .pkg file with the pkgadd -d name command (usually as the superuser).
One tip (luckily) not from personal experience: On Linux, you kill an amock running process by killing its process ID (pid); if the Linux user doesn't want to look up the pid(s), she can use killall name to kill all processes with that name: Basically a handy shorthand for grepping the process list and killing them individually.
On Solaris, this "kill by name" command is called pkill. The Solaris killall command however, well, kills all processes, period. You might as well shutdown and discard all unsaved changes...! You have been warned. :-p
Devices and media
If you "insert a DVD" (using Virtual Box's ability to mount disks from the host drive, or ISO images) it will show up under /media/CDROM. I haven't tried USB media yet (probably not supported?)
You can get an overview of devices and drivers (disk drives, mice, network and graphic cards) from the main menu: System > About OpenSolaris > Devices. E.g. my network card driver is e1000g, so I know in the file system, my first network interface will be represented as /dev/e1000g0 (see "ipconfig" tip below).
I don't suggest to mess around with device tables, it's just good to know files like /etc/mnttab and /etc/vfstab in case you want to look up a device path for another config file. (Strangely I don't see my hard drive's /dev path though, is that because it's virtual...?)
If your audio (e.g. on a MacBook, Core Audio + ICH driver) doesn't work, get drivers from Open Sound.
The shared folders feature is not available for the Mac/Solaris host/guest combo. I use the network (ftp, scp, or simply mail) to get files out or in of the VirtualBox.
Another way to get files from the Mac Finder to Solaris: Put the files in a folder, use the Apple Disk Utility to create a disk image (.dmg) from the folder, use the same utility to convert the .dmg to a DVD master image (.cdr), rename .cdr to .iso, then use VirtualBox's Virtual Media Manager menu mount the disk image as a Solaris medium, and access it from the /media directory. Phew... If you know an easier way, please leave a comment. =-)
If Solaris does not seem to use the network interface, check whether Virtual Box is set to use the "host interface" (for me the setting defaulted to NAT).
Solaris uses the nwamd demon to auto-detect and use DHCP on your network, and it even detects wireless networks, very useful. There is a Network control panel, but if you're just a user running Solaris on a notebook or PC, look for other sources of the problem before you fiddle with nwamd:
Use the command ifconfig -a to see whether the DHCP server assigned you an IP address. (Hint: Look up the name in the device list (see above), e.g. e1000g0. The IP address stands next to the word 'inet'. LOOPBACK and 127.0.0.1 don't count!) If not, check the cables and whether other PCs can access the same DHCP network.
If you do have an IP address but still cannot open any web pages, test whether you can browse to a web page by its IP address: Use the host command on another machine to obtain a test address. (E.g. typing host www.sun.com returns 220.127.116.11.) If the browser is able to open the web page by its IP address (e.g. http://18.104.22.168) then you know you are online - but your name servers are not configured!
In this case, open the file /etc/resolve.conf and add entries for name servers. (You need to be the superuser to edit the file, see su above.) Copy the name servers' IP addresses from another machine (I got them from the Mac's Network System Preferences), or ask your admins.
More about using and configuring Solaris, for example installing it on a Virtual Box and more info on nwamd.
Read the OpenSolaris Observatory blog to stay up-to-date.
\*) This method seems to have worked for many, it trashed my VirtualBox though. If you want to save time and already have an OpenSolaris 2008.11 DVD, use that, upgrading is not faster than a fresh install.