# How to solve the "WARNING! Your environment specifies an invalid locale" Error

On logging into a remote server, I got an error that began with: WARNING! Your environment specifies an invalid locale.. This is how I fixed it:

I entered each one of these commands in the terminal. The last one reboots the server.

locale
export LANGUAGE=en_US.UTF-8; export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales
sudo shutdown -r 0