Minimal OpenSolaris 2009.06

October 6th, 2009 by Jonathan Leave a reply »

os_fan_button_white_lrg_rndAfter toying around with OpenSolaris for a couple of months, I started wondering what it would take to slim down the default installation to something more appropriate for a server — You know, no X, GNOME, or any of the other good stuff. Some searching on Google lead me to some instructions for a minimal install of OpenSolaris 2008.11. Instead of starting out with a Live CD, I did a normal installation, booted in to that, and then followed these steps below (note: make sure to perform these tasks as either root or super-user).

Create new zfs volume and mount it in /a:

This will be the new root volume once we’re done installing our packages.

zfs create rpool/ROOT/opensolaris-minimal
zfs set mountpoint=legacy rpool/ROOT/opensolaris-minimal
zfs set canmount=noauto rpool/ROOT/opensolaris-minimal

mkdir /a
mount -F zfs rpool/ROOT/opensolaris-minimal

Create the install image:

export PKG_IMAGE=/a
pkg image-create -F -a opensolaris.org=http://pkg.opensolaris.org $PKG_IMAGE
pkg refresh

Once that’s setup, I use the same methodology from the guy mentioned in the above link:

Contents of pkg.txt:

SUNWcsd
SUNWcs
SUNWzone
SUNWcsl
SUNWlibsasl
SUNWlibms
SUNWpr
SUNWlxml
SUNWzlib
SUNWtls
SUNWopenssl
SUNWpool
SUNWzfs
SUNWsmapi
SUNWtecla
SUNWckr
SUNWpicl
SUNWmd
SUNWinstall-libs
SUNWwbsup
SUNWgccruntime
SUNWcar
SUNWcakr
SUNWusbs
SUNWusb
SUNWaudd
SUNWkvm
SUNWos86r
SUNWrmodr
SUNWpsdcr
SUNWpsdir
SUNWcnetr
SUNWesu
SUNWkey
SUNWnfsckr
SUNWnfsc
SUNWgss
SUNWgssc
SUNWbip
SUNWbash
SUNWloc
SUNWsshcu
SUNWsshd
SUNWssh
SUNWtoo
SUNWzfskr
SUNWipf
SUNWrtls
SUNWipkg
SUNWpython-pyopenssl
SUNWpython-cherrypy
SUNWadmr
SUNWadmap
SUNWadmlib-sysid
SUNWPython
SUNWbzip
SUNWxwrtl
SUNWTk
SUNWTcl
SUNWlexpt
SUNWperl584core
SUNWinstall-libs
SUNWbeadm
SUNWvim
SUNWscreen

Package installation:

for pkg in `cat pkg.txt`; do pkg install $pkg; done

And now for some initial configurations:

# seed the initial smf repository
cp $PKG_IMAGE/lib/svc/seed/global.db $PKG_IMAGE/etc/svc/repository.db
chmod 0600 $PKG_IMAGE/etc/svc/repository.db
chown root:sys $PKG_IMAGE/etc/svc/repository.db

# setup smf profiles
ln -s ns_files.xml $PKG_IMAGE/var/svc/profile/name_service.xml
ln -s generic_limited_net.xml $PKG_IMAGE/var/svc/profile/generic.xml
ln -s inetd_generic.xml $PKG_IMAGE/var/svc/profile/inetd_services.xml
ln -s platform_none.xml $PKG_IMAGE/var/svc/profile/platform.xml

# mark the new system image as uninstalled
sysidconfig -b $PKG_IMAGE -a /lib/svc/method/sshd
touch $PKG_IMAGE/etc/.UNCONFIGURED

# copy over the vfstab
cp -p /etc/vfstab $PKG_IMAGE/etc/vfstab

# copy over the current passwd, group, shadow, and user_attr to the new image
cp -p /etc/passwd $PKG_IMAGE/etc/passwd
cp -p /etc/shadow $PKG_IMAGE/etc/shadow
cp -p /etc/user_attr $PKG_IMAGE/etc/user_attr
cp -p /etc/group $PKG_IMAGE/etc/group

# copy of my existing host sshd keys
cp -p /etc/ssh/*key* $PKG_IMAGE/etc/ssh

# configure /dev in the new image
devfsadm -r $PKG_IMAGE
ln -s ../devices/pseudo/sysmsg@0:msglog $PKG_IMAGE/dev/msglog

# copy the grub files
rsync -avr --progress /boot/grub $PKG_IMAGE/boot/

# update the boot archive in the new image
bootadm update-archive -R $PKG_IMAGE

# update to the latest version of grub (this command generated
# some errors which i ignored).
$PKG_IMAGE/boot/solaris/bin/update_grub -R $PKG_IMAGE

# change our active boot environment
beadm activate opensolaris-minimal

Once that’s completed, I’ll also modify grub’s menu.lst file to disable the graphical boot sequences, here’s what the finished file will look like (/rpool/boot/grub/menu.lst):

#splashimage /boot/grub/splash.xpm.gz
#background 215ECA
timeout 30
default 0
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
#splashimage /boot/solaris.xpm
#foreground d25f00
#background 115d93
#---------------------END BOOTADM--------------------
title opensolaris-minimal
bootfs rpool/ROOT/opensolaris-minimal
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
module$ /platform/i86pc/$ISADIR/boot_archive
#============ End of LIBBE entry =============

After that, I’ll umount the volume (/a) and reboot the system. Once as soon as I know that everything installed properly, I’ll use the beadm command to destroy the old boot environment, leaving me with a minimal(ish) install of OpenSolaris!

Advertisement

Leave a Reply