centos6의 locale-gen 명령 인 맨체

docker컨테이너 인 맨체 centos6.5 시스템 에서 en_US.utf-8로케일이 누락되었습니다.

bash-4.1# locale -a
C
POSIX

일반적으로 우분투에는 다음과 같은 명령 locale-gen이 있습니다.

# locale-gen en_US.UTF-8
# echo 'LANG="en_US.UTF-8"' > /etc/default/locale

centos 6.5에서 어떻게해야합니까?



답변

locale-gen에 없습니다 Centos/Fedora.

다음을 사용해야합니다 localedef.

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

보낸 사람 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.

답변

@Gnouc 답변을 기반으로 추가 정보를 제공했습니다 ( localedefcentos로 사용해야 함)

centos docker최소한의 패키지를 제공하는 특별한 이미지, 스크립트를 볼 수 있습니다 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}

내부 명령 localedef이 제거되면 glibc-common이를 포함하는 패키지를 다시 설치해야합니다.

yum reinstall glibc-common

확실히 크기가 증가합니다