---

How to fix locales in Debian/Ubuntu Linux VPS

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

What are Locales?
Locales are 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 based linux vps you can use the command below:

locale
To show all available locales in your linux 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 our Linux VPS Hosting customers we can help you fix your locales on your virtual server free of charge. Just contact us and some of our experts will complete your request immediately.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis