centos6의 locale-gen 명령

centos6의 locale-gen 명령

내 기본 centos6.5 시스템에서는 컨테이너 docker이고 en_US.utf-8로케일이 누락되었습니다.

bash-4.1# locale -a
C
POSIX

locale-gen일반적으로 Ubuntu에는 이를 수행하는 명령이 있습니다 .

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

Centos 6.5에서 어떻게 할 수 있나요?

답변1

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.

답변2

@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

사이즈는 확실히 늘어나겠죠

관련 정보