Fixing `bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)` on Ubuntu 20.04 Server

This error happens when your SSH client forwards your local locale environment variables to the remote server which doesn’t have the specific locale you requested.

You will need to use sudo or be root to run these commands.

Generate locale:

locale-gen en_US.UTF-8

Set locale by doing the following. This command also generates the /etc/default/locale:

update-locale LANG=en_US.UTF-8

Now restart the system.

References: