エロサイトの作り方

2013年11月から勉強しながらエロサイトを作っています。

WordPress開発用Vagrantを入れる

WordPressのテーマ開発に便利なVagrantというものがあって、便利そうなので入れてみました。

インストール

日本語のREADMEにインストール手順が詳しく書いてあるし、楽勝だろうと思ってたら…

[2013-12-17T04:05:55+00:00] INFO: Running report handlers
[2013-12-17T04:05:55+00:00] INFO: Report handlers complete
[default] Checking for host entries
[default] Forcing shutdown of VM...
[default] Destroying VM and associated drives...
/Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:107:in `digest': can't convert nil into String (TypeError)
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:107:in `hexdigest'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:107:in `signature'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:70:in `block in getHostEntries'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:69:in `each'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:69:in `getHostEntries'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:33:in `block in addHostEntries'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:32:in `each'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/HostsUpdater.rb:32:in `addHostEntries'
    from /Users/hentai-kun/.vagrant.d/gems/gems/vagrant-hostsupdater-0.0.11/lib/vagrant-hostsupdater/Action/UpdateHosts.rb:18:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/builtin/call.rb:57:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/runner.rb:61:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/action/runner.rb:61:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/machine.rb:147:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.2.7/lib/vagrant/batch_action.rb:63:in `block (2 levels) in run'

見事にエラーですね。

ところどころ気になる出力があって、

Installing Virtualbox Guest Additions 4.2.16 - guest version is 4.2.12

Installing the Window System drivers[FAILED] (Could not find the X.Org or XFree86 Window System.) An error occurred during installation of VirtualBox Guest Additions 4.2.16. Some functionality may not work as intended.

VirtualBox本体のバージョンがGuest Additionsより古みたいです。

本体を更新すれば何とかなりそう。

VirtualBoxのアップデート

VirtualBoxのサイトから最新版の3.4.3をダウンロードしてインストール。

そして、再度vagrant upしてみる。

$ vagrant up
Vagrant has detected that you have a version of VirtualBox installed
that is not supported. Please install one of the supported versions
listed below to use Vagrant:

4.0, 4.1, 4.2

またエラー。

今度はVagrantがVirtualBox 4.2までしか対応していないと。

Vagrantも古かったみたいですね。

Vagrantのアップデート

というわけで、Vagrantのサイトから最新版の1.4.0をダウンロードしてインストール。

そして、三度vagrant upしてみる。

$ vagrant up

The following plugins were installed with a version of Vagrant
that had different versions of underlying components. Because
these component versions were changed (which rarely happens),
the plugins must be uninstalled and reinstalled.

To ensure that all the dependencies are properly updated as well
it is _highly recommended_ to do a `vagrant plugin uninstall`
prior to reinstalling.

This message will not go away until all the plugins below are
either uninstalled or uninstalled then reinstalled.

The plugins below will not be loaded until they're uninstalled
and reinstalled:

sahara, vagrant-hostsupdater, vagrant-vbguest
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

Vagrant:
* Unknown configuration section 'hostsupdater'.

おおっと、またエラー。

今度はVagrantのプラグインが何やら問題みたい。

Vagrantプラグインのアップデート

saharavagrant-hostsupdatervagrant-vbguestのプラグインを一度アンインストールしてから再度インストールしてくれ、というようなことが書いてありますね。

$ vagrant plugin uninstall sahara
$ vagrant plugin uninstall vagrant-hostsupdater
$ vagrant plugin uninstall vagrant-vbguest
$ vagrant plugin install sahara
Installing the 'sahara' plugin. This can take a few minutes...
Installed the plugin 'sahara (0.0.16)'!
$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Installed the plugin 'vagrant-vbguest (0.10.0)'!
$ vagrant plugin install vagrant-hostsupdater
Installing the 'vagrant-hostsupdater' plugin. This can take a few minutes...
Installed the plugin 'vagrant-hostsupdater (0.0.11)'!

今度はどうだー。

$ vagrant up
...

[default] Setting hostname...
[default] Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ifdown eth1 2> /dev/null

Stdout from the command:



Stderr from the command:

ダメだったー('A`)

Vagrantにパッチを当てる

Vagrant1.4.0でCentOS6.5(Redhat系VM)のprivate_networkがうまく設定されない - Qiita [キータ]

に書いてありました。

Vagrantのバグのようです。

修正済みconfigure_networks.rbを反映させる

$ cd /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/guests/redhat/cap
$ sudo mv configure_networks.rb configure_networks.rb.v1.4.0-backup
$ sudo curl -O https://raw.github.com/mitchellh/vagrant/master/plugins/guests/redhat/cap/configure_networks.rb

ようやく起動

$ vagrant up

これでいけました。