How to set all locale settings in Ubuntu
A remote installed application has some encoding problems and on my local machine it is running fine.
What is the best way to "copy" my locales to the remote machine?
The locales on my personal machine are configured like this:
$ locale
LANG=de_DE.UTF-8
LANGUAGE=de_DE:en
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL= 1 3 Answers
You can set locale manually using update-locale:
sudo update-locale LANG=de_DE.UTF-8 LC_MESSAGES=POSIXRead the man page for more information.
Alternatively, you can manually change your system's locale entries by modifying the file /etc/default/locale.
For example on a German system, to prevent system messages from being translated, you may use:
LANG=de_DE.UTF-8
LC_MESSAGES=POSIXNote: changes take effect only after a fresh login.
Source:
5The easier way
Export all locales into a file
locale > importOpen file and add export at the start of each line
Make it executable with the command
chmod ugo+rx importCopy to desired profile and execute
./import
There are some recommendations when configuring locales in remote machines
1) In Debian machines (remote machine), run the command (as root):
dpkg-reconfigure localesOn the first screen, select the desired locales. After that you will be prompted to choose which is the default locale. Select "none" (reference: ).
2) Configure your ssh service (/etc/ssh/sshd_config) to accept environment variables from the client:
uncomment the line:
AcceptEnv LANG LC_*Restart you ssh server, logoff and log back in and run the locale command. It must match your local machine's locale