How to fix locales in Debian/Ubuntu Linux VPS

Datetime:2016-08-22 23:54:46          Topic: Debian           Share

In the following article we’ll show you how to fix missing or improperly installed locales on a Debian or UbuntuLinux VPS .

What are Locales?

Localesare used by glibc and other locale-aware programs or libraries for rendering text, correctly displaying regional monetary values, time and date formats, alphabetic idiosyncrasies, and other locale-specific standards. They define language and country specific setting for your programs and shell sessions.

Show current locale settings in Linux VPS

To display the currently set locales and its related environmental setting in Debian or Ubuntu basedlinux vps you can use the command below:

locale

To show all available locales in yourlinux virtual server, run the following:

locale -a

Fixing Locales

Usually, locales on your linux vps may not be properly setup for many reasons and you may be getting the following errors while performing random tasks on the linux shell:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
  LANGUAGE = (unset),
  LC_ALL = (unset),
  LC_TIME = "ar_LY.UTF-8",
  LC_MONETARY = "ar_LY.UTF-8",
  LC_ADDRESS = "ar_LY.UTF-8",
  LC_TELEPHONE = "ar_LY.UTF-8",
  LC_NAME = "ar_LY.UTF-8",
  LC_MEASUREMENT = "ar_LY.UTF-8",
  LC_IDENTIFICATION = "ar_LY.UTF-8",
  LC_NUMERIC = "ar_LY.UTF-8",
  LC_PAPER = "ar_LY.UTF-8",
  LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
  LANGUAGE = (unset),
  LC_ALL = (unset),
  LC_TIME = "ar_LY.UTF-8",
  LC_MONETARY = "ar_LY.UTF-8",
  LC_ADDRESS = "ar_LY.UTF-8",
  LC_TELEPHONE = "ar_LY.UTF-8",
  LC_NAME = "ar_LY.UTF-8",
  LC_MEASUREMENT = "ar_LY.UTF-8",
  LC_IDENTIFICATION = "ar_LY.UTF-8",
  LC_NUMERIC = "ar_LY.UTF-8",
  LC_PAPER = "ar_LY.UTF-8",
  LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

To fix this, you need to execute the following commands:

apt-get install language-pack-en

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

export LANG=en_US
export LC_ALL=C

locale-gen $LANG
echo LANG=$LANG >> /etc/environment
echo LC_ALL=$LC_ALL >> /etc/environment

dpkg-reconfigure locales

If you’re one of ourLinux VPS Hosting customers we can help you fix your locales on yourvirtual server free of charge. Justcontact us and some of our experts will complete your request immediately.





About List