Changing the default Solaris 11 locale

In Solaris 10 you had to edit the /etc/default/init file to chance the default locale, now with Solaris 11 it is defined in SMF:

To change the global system locale

  1. Using the locale command we can confirm what our current active global locale is set to:
    # locale
    LANG=en_US.UTF-8
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_ALL=
  2. To change the locale we use the svccfg command. In this example, we will change the locale to en_GB
    # svccfg -s svc:/system/environment:init \
        setprop environment/LANG = astring: en_GB.UTF-8
  3. Next we refresh the configuration:
    # svcadm refresh svc:/system/environment
  4. We need to reboot the server for the changes to take effect:
    # init 6
  5. After the reboot the new locale will be active:
    # locale
    LANG=en_GB.UTF-8
    LC_CTYPE="en_GB.UTF-8"
    LC_NUMERIC="en_GB.UTF-8"
    LC_TIME="en_GB.UTF-8"
    LC_COLLATE="en_GB.UTF-8"
    LC_MONETARY="en_GB.UTF-8"
    LC_MESSAGES="en_GB.UTF-8"
    LC_ALL=