- 追加された行はこの色です。
- 削除された行はこの色です。
** 動作環境 [#k9bb21a2]
- Windows 7 (32bit)
- Oracle VM VirtualBox 5.0.16
- Cygwin
** 仮想マシン作成・起動 [#of04b149]
- CentOS7.0(64bit)のbox(テンプレート)を追加
$ vagrant box add CentOS7.0 https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.1.0/centos-7.0-x86_64.box
- boxのテンプレート一覧: http://www.vagrantbox.es/
- box一覧表示
$ vagrant box list
CentOS7.0 (virtualbox, 0)
- 仮想マシン用ディレクトリ作成
$ mkdir ~/MyVagrant
$ cd MyVagrant
$ mkdir CentOS7.0
$ cd CentOS7.0
- vagrantの初期化
$ vagrant init CentOS7.0
A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant.
- Vagrantfileを編集してIP記述行のコメントアウトを解除
$ vi Vagrantfile
--------------------
config.vm.network "private_network", ip: "192.168.33.10"
--------------------
- boxを利用して仮想マシン起動
$ vagrant up
- SSH接続確認
$ vagrant ssh
Welcome to your Vagrant-built virtual machine.
[vagrant@localhost ~]$
- 状態確認
$ vagrant status
- 停止
$ vagrant halt
** Webサーバーの設定 [#a3ebb2f3]
$ sudo yum -y install httpd
$ sudo systemctl start httpd.service // Apacheを起動
$ sudo systemctl enable httpd.service // Apacheを常時起動
$ sudo systemctl stop firewalld // ファイアーウォールを停止
$ sudo systemctl disable firewalld // ファイアーウォールを常時停止
$ ps aux | grep httpd
** Hello World! [#x1b47fcc]
$ cd /var/www/html
$ vi hello.js
--------------------
alert("Hello World!");
--------------------
- &color(red){※};hello.jsが保存できない(4/5)
** CentOS 7のロケールを変更 [#w638878c]
- 動作環境 &color(red){※};OS X上でVagrant upしたCentOS 7はデフォルトでロケールがドイツ語
-- OS X 10.11 El Capitan
-- Vagrant 1.8.1
-- VirtualBox 5.0.20 r106931
- 現在のロケールを確認(デフォルトはドイツ語)
$ localectl status
System Locale: LANG=de_DE.UTF-8
VC Keymap: de
X11 Layout: de
- 使用可能なロケール(英語)一覧表示
$ localectl list-locales | grep en_US
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
- ロケールの変更
$ sudo localectl set-locale LANG=en_US.utf8
- ロケールの変更確認
$ cat /etc/locale.conf
LANG=en_US.utf8
- 使用可能なKeycap(US)一覧表示
$ localectl list-keymaps | grep us
......
us
us-acentos
us-alt-intl
us-altgr-intl
us-colemak
us-dvorak
us-dvorak-alt-intl
us-dvorak-classic
us-dvorak-intl
us-dvorak-l
us-dvorak-r
us-dvp
us-euro
us-hbs
us-intl
us-mac
us-olpc2
us-workman
us-workman-intl
......
- Keycapの変更
$ sudo localectl set-keymap us
- Keycapの変更確認
$ cat /etc/vconsole.conf
KEYMAP=us
- 変更の反映
$ source /etc/locale.conf
$ localectl status
System Locale: LANG=en_US.utf8
VC Keymap: us
X11 Layout: us
X11 Model: pc105+inet
X11 Options: terminate:ctrl_alt_bksp