Fixing Locale errors in Ubuntu

How to fix the following error when you are running apt-get update or installs.

    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
            LANGUAGE = (unset),
            LC_ALL = (unset),
            LC_MONETARY = "en_US.ISO8859-1",
            LC_NUMERIC = "en_US.ISO8859-1",
            LC_MESSAGES = "C",
            LC_COLLATE = "en_US.ISO8859-1",
            LC_CTYPE = "en_US.ISO8859-1",
            LC_TIME = "en_US.ISO8859-1",
            LANG = "en_GB.UTF-8"
    export LC_ALL="en_GB.UTF-8"
    export LANGUAGE="en_GB.UTF-8"
    export LANG="en_GB.UTF-8"
    printf "LANGUAGE="en_GB.UTF-8"nLC_ALL="en_GB.UTF-8"" >> /etc/default/locale
    dpkg-reconfigure locales

to test run

    echo | perl

this will generate the error if the locales are wrong.

Share