locale-gen command in centos6
51,371
Solution 1
locale-gen
is not present in Centos/Fedora
.
You must use localedef
:
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
From man localedef
:
NAME
localedef - define locale environment
SYNOPSIS
localedef [-c][-f charmap][-i sourcefile][-u code_set_name] name
DESCRIPTION
The localedef utility shall convert source definitions for locale cate‐
gories into a format usable by the functions and utilities whose opera‐
tional behavior is determined by the setting of the locale environment
variables defined in the Base Definitions volume of
IEEE Std 1003.1-2001, Chapter 7, Locale. It is implementation-defined
whether users have the capability to create new locales, in addition to
those supplied by the implementation. If the symbolic constant
POSIX2_LOCALEDEF is defined, the system supports the creation of new
locales. On XSI-conformant systems, the symbolic constant
POSIX2_LOCALEDEF shall be defined.
Solution 2
I provided extra information based on answer @Gnouc (localedef
shall be used in centos)
The centos docker
is a special image which provides minimal packages, see script https://github.com/dotcloud/docker/blob/master/contrib/mkimage-yum.sh
rm -rf "$target"/usr/{{lib,share}/locale,{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive}
Inside command localedef
is removed, glibc-common
package which include this shall be reinstalled
yum reinstall glibc-common
surely the size will be increased
Related videos on Youtube
Author by
larrycai
Updated on September 18, 2022Comments
-
larrycai over 1 year
In my bare centos6.5 system, which is a
docker
container,en_US.utf-8
locale is missing:bash-4.1# locale -a C POSIX
Normally in Ubuntu there is command
locale-gen
to do this:# locale-gen en_US.UTF-8 # echo 'LANG="en_US.UTF-8"' > /etc/default/locale
How can I do this in centos 6.5?
-
larrycai almost 10 yearsthank,
yum whatprovides */localedef
reports forglibc-common
package, while/usr/bin/localedef
doesn't exist. strange, because of docker ? -
cuonglm almost 10 years@larrycai: I'm not sure, haven't seen this problem before. What result
ldd /usr/bin/localedef
. -
larrycai almost 10 yearsthe file doesn't exist, only
locale
command. If u know docker, you can rundocker run -i -t centos bash
to check as well. -
Edward J Beckett over 8 yearsThanks sir ~ I was getting quite annoyed by the odd chars :)
-
Kevin Johnson over 6 years
yum reinstall glibc-common
made localedef available for me on Amazon Linux2.17-196.172.amzn1
Docker container: hub.docker.com/r/ambakshi/amazon-linux and allowed me to get elixir installed. -
devstructor over 2 yearsIt didn't work for me in ubi8 out of the box. To make it work you have to install
glibc-locale-source
package. Otherwise localedef will complain:[error] character map file UTF-8 not found: No such file or directory