Saturday, July 28, 2012

Solaris 11 Locale en_GB.UTF-8 / en_GB.ISO8859-1 / en_GB.ISO8859-15


When you install Solaris 11/11 from standard text installer cdrom, the en_GB-UTF-8 locales are not installed, even if you select British locales on install.

To make sure packages are have the correct localisation, IPS uses facet as a localisation personality.
$ pkg facet
FACETS VALUE
facet.locale.pt_BR True
facet.locale.es_ES True
facet.locale.en_US True
facet.locale.zh_TW True
facet.locale.zh_CN True
facet.locale.de_DE True
facet.locale.fr_FR True
facet.locale.it_IT True
facet.locale.ko_* True
facet.locale.ja_* True
facet.locale.es True
facet.locale.de True
facet.locale.zh True
facet.locale.ko True
facet.locale.it True
facet.locale.pt True
facet.locale.fr True
facet.locale.en True
facet.locale.ja True
facet.locale.* False



As you can see no en_GB is described and "facet.locale.* False" is a deny everything else rule. So let change this. I'm assuming you have a Solaris 11 repository already configured. Iinstall en_GB packages/files and creates a backup boot environment.

$ sudo pkg change-facet 'facet.locale.en_GB=True'

            Packages to update: 463      
       Create boot environment:  No
Create backup boot environment: Yes


PHASE                                          ITEMS
Image State Update Phase                         2/2 

Now lets make the en_GB.UTF-8 the default locale. Previously in Solaris 10 we would edit /etc/default/init. But as with many thing in Solaris 11 this has moved to SMF and /etc/default/init is read only.

$ sudo svccfg -s svc:/system/environment:init setprop \
     environment/LANG = astring: en_GB.UTF-8

$ sudo svcadm refresh svc:/system/environment

Now the system defaults to en_GB.UTF-8 for new processes, but remeber not children processes. So thing like cron and ssh have to be restarted, but I would go for a reboot.
$ sudo svcadm restart ssh
$ sudo svcadm restart cron


Settings for Non-UTF-8 locales (en_GB.ISO8859-15 / en_GB.ISO8859-1)

Non-UTF-8 locales such as en_GB.ISO8859-15 require the "system/locale/extra" package to be installed.
$ sudo pkg install system/locale/extra


$ sudo svccfg -s svc:/system/environment:init setprop \
     environment/LANG = astring: en_GB.ISO8859-15

Additional Options


These are set correctly on install, but added here for completeness.
$ svccfg -s keymap:default setprop keymap/layout = UK-English
$ svcadm refresh keymap
$ svcadm restart keymap

$ svccfg -s timezone:default setprop timezone/localtime= astring: GB
$ svcadm refresh timezone:default

No comments: