LoginSignup
6
4

More than 5 years have passed since last update.

CentOS7で"locale: Cannot set LC_CTYPE to default locale: No such file or directory"

Last updated at Posted at 2016-10-31

概要

macでvagrantを起動すると、下記のエラーが出る。
このままだと、pythonのanaconda3系のインストールが失敗してしまうので、対処したメモ。OSはCentOS7。

vagrantログイン時のエラー内容

Welcome to your Vagrant-built virtual machine.
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

localeコマンドの実行時のエラー内容

[vagrant@localhost ~]$ 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

対処法

下記コマンドでlocaleコマンド実行時のエラーは出なくなり、anacondaのインストールもできるようになった。

  • 日本語 + UTF-8にする場合
$ localectl set-locale LANG=ja_JP.utf8
$ echo "export LC_CTYPE='ja_JP.UTF-8'" >> ~/.bash_profile;
  • 英語 + UTF-8にする場合
$ localectl set-locale LANG=en_US.utf8
$ echo "export LC_CTYPE='en_US.UTF-8'" >> ~/.bash_profile;
$ source ~/.bash_profile

時計を合わせる

  • 日本時間にする
$ sudo cp /usr/share/zoneinfo/Japan /etc/localtime
  • 時刻を手動で合わせる
$ sudo date MMDDhhmmYYYY

[参考]
http://weblabo.oscasierra.net/vagrant-centos6-japanize/

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4