Skip to content

Instantly share code, notes, and snippets.

@jampajeen
Created November 21, 2015 13:02
Show Gist options
  • Save jampajeen/841d4eed4da3e6c758bf to your computer and use it in GitHub Desktop.
Save jampajeen/841d4eed4da3e6c758bf to your computer and use it in GitHub Desktop.
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@EinsDreiDreiSiebenX
Copy link

@joshgies-xad
Copy link

joshgies-xad commented May 1, 2023

+1 for mosamadi solution. It resolved it for me on Amazon Linux 2.
Thank you @mosamadi !

[joshgies@ec2-54-226-27-205 payments-np101 ~]$ sudo su -
Last login: Mon May 1 18:57:54 UTC 2023 on pts/0
-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory
[root@ec2-54-226-27-205 payments-np101 ~]$ exit
logout
[joshgies@ec2-54-226-27-205 payments-np101 ~]$ sudo -s
[root@ec2-54-226-27-205 payments-np101 joshgies]$
[root@ec2-54-226-27-205 payments-np101 joshgies]$ man localedef
man: can't set the locale; make sure $LC_* and $LANG are correct
[root@ec2-54-226-27-205 payments-np101 joshgies]$ sudo localedef -i en_US -f UTF-8 en_US.UTF-8
[root@ec2-54-226-27-205 payments-np101 joshgies]$ exit
exit
[joshgies@ec2-54-226-27-205 payments-np101 ~]$ sudo su -
Last login: Mon May 1 18:58:02 UTC 2023 on pts/0

@ans1genie
Copy link

adding that to your .profile (.zprofile, .. or somilar) is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment