lar*_*cai 17 centos locale docker
在我的裸 centos6.5 系统中,它是一个docker容器,en_US.utf-8缺少语言环境:
bash-4.1# locale -a
C
POSIX
Run Code Online (Sandbox Code Playgroud)
通常在 Ubuntu 中有locale-gen执行此操作的命令:
# locale-gen en_US.UTF-8
# echo 'LANG="en_US.UTF-8"' > /etc/default/locale
Run Code Online (Sandbox Code Playgroud)
我怎么能在centos 6.5中做到这一点?
cuo*_*glm 34
locale-gen中不存在Centos/Fedora。
您必须使用localedef:
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)
来自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.
Run Code Online (Sandbox Code Playgroud)
我根据答案@Gnouc 提供了额外的信息(localedef应在 centos 中使用)
这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}
Run Code Online (Sandbox Code Playgroud)
localedef删除内部命令,glibc-common应重新安装包含此命令的软件包
yum reinstall glibc-common
Run Code Online (Sandbox Code Playgroud)
肯定会增加尺寸
| 归档时间: |
|
| 查看次数: |
49037 次 |
| 最近记录: |