CentOS7 System Locale 변경하기

System Story/CentOS 7 2015. 12. 9. 16:51

Centos7 등 Redhat Enterprise Linux 7 계열의 Linux 는 버전업이 되면서 아래와 같이 System Locale 설정 방법과 Config 위치가 변경되었다.

 

따라서 Redhat Enterprise Linux 7 계열의 OS 설치후 Aplication 요구조건등에 의한 System Default Locale 의 변경이 필요하다면 아래와 같이 확인 및 변경 가능하다.

 

1. Centos6 System Locale 확인 및 변경

 

[root@Centos6 ~]#
[root@Centos6 ~]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
[root@Centos6 ~]#
[root@Centos6 ~]#
[root@Centos6 ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
[root@Centos6 ~]#
[root@Centos6 ~]#
[root@Centos6 ~]# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
[root@Centos6 ~]#
[root@Centos6 ~]#
[root@Centos6 ~]#
[root@Centos6 ~]# locale -a | more
aa_DJ
aa_DJ.iso88591
aa_DJ.utf8
aa_ER
aa_ER@saaho
aa_ER.utf8
aa_ER.utf8@saaho
aa_ET
aa_ET.utf8
af_ZA
af_ZA.iso88591
af_ZA.utf8
am_ET
am_ET.utf8
an_ES
an_ES.iso885915
an_ES.utf8
ar_AE
ar_AE.iso88596
ar_AE.utf8
ar_BH
ar_BH.iso88596
ar_BH.utf8

 

... 중략

 

 

 

2. Centos7 OS Version 정보 확인 및 System Locale 정보 확인하기

 

[root@centos7 ~]#
[root@centos7 ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.0.1406 (Core)
Release: 7.0.1406
Codename: Core
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# localectl status
   System Locale: LANG=en_US.utf8
       VC Keymap: us
      X11 Layout: us
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
[root@centos7 ~]#

 

 

3. System 에서 지원하는 Locale 리스트 확인하기 (예시 : 한글 locale)

 

[root@centos7 ~]#
[root@centos7 ~]# localectl list-locales | grep -i ko
ko_KR
ko_KR.euckr
ko_KR.utf8
kok_IN
kok_IN.utf8
korean
korean.euc
ru_RU.koi8r
ru_UA.koi8u
tg_TJ.koi8t
uk_UA.koi8u
[root@centos7 ~]#
[root@centos7 ~]# locale -a | grep -i ko
kok_IN
kok_IN.utf8
ko_KR
ko_KR.euckr
ko_KR.utf8
korean
korean.euc
ru_RU.koi8r
ru_UA.koi8u
tg_TJ.koi8t
uk_UA.koi8u
[root@centos7 ~]#

 

 

4. 변경된 System Locale 설정파일 확인 및 System Locale 변경하기

 

[root@centos7 ~]#
[root@centos7 ~]# cat /etc/locale.conf
LANG=en_US.utf8

[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# localectl set-locale LANG=ko_KR.euckr
[root@centos7 ~]#
[root@centos7 ~]# localectl status
   System Locale: LANG=ko_KR.euckr
       VC Keymap: us
      X11 Layout: us
[root@centos7 ~]#
[root@centos7 ~]# cat /etc/locale.conf
LANG=ko_KR.euckr
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# su -l
Last login: Wed Dec  9 13:48:09 KST 2015 on pts/0

[root@centos7 ~]#
[root@centos7 ~]# locale
LANG=ko_KR.euckr
LC_CTYPE="ko_KR.euckr"
LC_NUMERIC="ko_KR.euckr"
LC_TIME="ko_KR.euckr"
LC_COLLATE="ko_KR.euckr"
LC_MONETARY="ko_KR.euckr"
LC_MESSAGES="ko_KR.euckr"
LC_PAPER="ko_KR.euckr"
LC_NAME="ko_KR.euckr"
LC_ADDRESS="ko_KR.euckr"
LC_TELEPHONE="ko_KR.euckr"
LC_MEASUREMENT="ko_KR.euckr"
LC_IDENTIFICATION="ko_KR.euckr"
LC_ALL=
[root@centos7 ~]#

 

 

5. export Bash 내장 명령을 활용한 일시적인 System Locale 변경하기

 

[root@centos7 ~]#
[root@centos7 ~]# export LANG=C
[root@centos7 ~]# export LC_ALL=C
[root@centos7 ~]#
[root@centos7 ~]# locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=C
[root@centos7 ~]#
[root@centos7 ~]#

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Trackbacks 0 : Comments 0

Write a comment