Useful Solaris 11 commands

Changing the IP address of a Host
Altering the network configuration has changed significantly in Solaris 11. Administrators of Solaris 10 systems are used to changing the configuration files /etc/hosts, /etc/hostname., /etc/netmasks, /etc/defaultrouter and /etc/resolv.conf. While this procedure was certainly quite odd compared to modern UNIX-systems experienced Solaris administrators were used to it. When upgrading to Solaris 11 they were in for a big surprise. Solaris has switched to a “profile based” configuration. In the following example we create a profile labeled “stk” and in the last step we switch from the automatic DHCP-based profile “Automatic” enabled during the installation process to “stk”.

root@solaris:~# netcfg create ncp stk
root@solaris:~# netcfg
netcfg> select ncp stk
netcfg:ncp:stk> create ncu phys net0
Created ncu 'net0'. Walking properties ...
activation-mode (manual) [manual|prioritized]> manual
mac-address>
autopush>
mtu>
netcfg:ncp:stk:ncu:net0> end
Committed changes
netcfg:ncp:stk> create ncu ip net0
Created ncu 'net0'. Walking properties ...
ip-version (ipv4,ipv6) [ipv4|ipv6]> ipv4
ipv4-addrsrc [dhcp|static]> static
ipv4-addr> 10.0.2.4/23
ipv4-default-route> 10.0.2.1
netcfg:ncp:stk:ncu:net0> end
Committed changes
netcfg:ncp:stk> exit
root@solaris:~#

Activate network configuration

netadm enable -p ncp stk

Changing DNS settings
To add a name server to the above configuration

svcadm enable dns/client
svccfg -s dns/client setprop config/nameserver = 8.8.8.8
svcadm refresh dns/client

Installing X11
A standard text-based installation of Solaris 11 lacks X11 support by default.

pkg install SUNWarc SUNWbtool SUNWhea SUNWlibms SUNWmfrun SUNWxorg-client-programs SUNWxorg-clientlibs SUNWxwfsw pkg://solaris/SUNWxwplt truetype/fonts-core

For a fully fledged X11 desktop environment type

pkg install solaris-desktop

Installing a (S)AMP stack
Many popular web services run on a standard LAMP setup (Linux, Apache, MySQL, PHP). Obviously, with the exception of Linux, we would like to run all of these on Sun systems as well. Fortunately, Sun offers a complete AMP stack with all required bindings set up properly. Unfortunately, the components which come with the AMP stack on a current Solaris 11.3 are quite dated (Apache 2.2, MySQL 5.5.43, PHP 5.3.29). Nonetheless it is possible to run Moodle 2.6 and WordPress 4.8.5 right “out of the box” without too much headache.

pkg install group/feature/amp

The MySQL Monitor needs to installed manually if desired

pkg install database/mysql-55/client

Start the Apache web server permanently

svcadm -v enable /network/http:apache22

Creating Solaris Boot Environments (“BE”)
Boot Environments are like snapshots available in many hypervisors. BEs allow to freeze the system state at any given time while the system is running allowing for easy recovery e.g. after a failed software upgrade.

root@chlodomer:~# beadm create SystemState010717
root@chlodomer:~# beadm list
BE Flags Mountpoint Space Policy Created
-- ----- ---------- ----- ------ -------
SystemState010717 - - 385.5K static 2017-07-01 14:47
solaris NR / 13.61G static 2017-01-14 21:50
solaris-backup-1 - - 47.52M static 2017-01-14 23:01
solaris-backup-2 - - 53.23M static 2017-01-19 22:45
solaris-backup-3 - - 404.5K static 2017-06-27 14:18
root@chlodomer:~#