大网数据广告活动
服务器运维问答

CentOS: set locale for user

· 52CE 我爱测

Maybe i don't understand about locales... But could You explain me: If I set locale using localectl: localectl set-locale LANG=en_US.UTF-8 I see in localectl output after this: System Locale: LANG=en_US.UTF-8 VC Keymap: us X11 La…

问题原文

原帖链接 · Serg · CC BY-SA 4.0

Maybe i don't understand about locales... But could You explain me:

If I set locale using localectl:

localectl set-locale LANG=en_US.UTF-8

I see in localectl output after this:

   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: us

The system locale now is en_US.UTF-8

But in locale output I still see this:

LANG=ru_RU.UTF-8
LC_CTYPE=ru_RU.UTF-8
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE=ru_RU.UTF-8
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

Is only one way to set user's locale - export it or add into .bash_profile file to save after rebooting?

已采纳解答

原帖链接 · asktyagi · CC BY-SA 4.0

You can do below:

Do below for global changes

/etc/default/locale – on Ubuntu/Debian
/etc/locale.conf – on CentOS/RHEL

For particular user, edit file ~/.bash_profile by adding:

LANG="<your selection>"
export LANG

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-10-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。