Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
15
Help us understand the problem. What is going on with this article?
@Kaisyou

CentOS7 LC_CTYPE: cannot change locale (UTF-8): No such file or directory

More than 3 years have passed since last update.

CentOS 7

*i18nのファイルを作るみたいなことが書いてあるサイトがたくさんあって試してみたが、できなかった、自分のはそれは関係なかった。
ので
http://stackoverflow.com/questions/22430747/locale-error-in-centos
ここを参考にしたら直りました。
以下日本語訳です。

CentOSを立ち上げると、いつも

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

というのがでたり、
localeコマンドをすると、

$ locale

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=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=

この二つがいつもでるので直したかった。

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

直す

viコマンドでenvironmentファイルを新規に作成する。

sudo vi /etc/environment

その中にこの2行を書くだけ。

aを押して挿入モードに。

LANG=en_US.utf-8
LC_ALL=en_US.utf-8

escキー(コマンドモードに)  →:wq     で保存

[root@localhost ~]# 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=en_US.utf-8
[root@localhost ~]# 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=en_US.utf-8

これでもうログインしたり、localeを見た時にエラーは出なくなる。

日本語の場合はen_USのところをja_JPに変えれば大丈夫だと思います。

15
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Kaisyou

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
15
Help us understand the problem. What is going on with this article?