Fix the locale warning on a new DigitalOcean droplet
If you’ve just created a new Ubuntu 14.04 DigitalOcean droplet and are installing or upgrading some packages, you’ll notice this annoying warning being shown in console:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
...
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
Don’t worry - it’s easy to fix - all you have to do is open the /etc/default/locale
file and replace its content
with the following lines:
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
Save, close & reboot the droplet - that’s it - the locale warning will no longer appear. Just consider replacing the default “en_US.UTF-8” locale with one that is right for you. You can find available locales on your system by running this command:
locale -a
Update: I originally noticed this locale issue on Ubuntu 14.04 DigitalOcean droplet, however, it is also present on Ubuntu 16.04. The fix, however, is the same!