Windows+Vagrant+CentOS7をインストールする(/sbin/mount.vboxsfエラーの対処方法)

VirtualBox-4.3.20-96997-Win.exeをインストールする

vagrant_1.7.1.msiをインストールする

  • BOXファイルのダウンロード

http://www.vagrantbox.es/のCentOS7.0 x86_64 minimal (VirtualBoxGuestAddtions 4.3.14)をダウンロードする
https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box

  • CenOS7のインストール

以下のコマンドを実行する
>vagrant box add centos7 C:\Users\XXXX\Downloads\centos7.box
>vagrant init centos7
>vagrant up
すると、下記のエラーが発生する

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`
vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device
  • エラーの対処

localhost:2222にPuTTYSSHログイン
$ su -
# /etc/init.d/vboxadd setup

>vagrant halt
>vagrant up

CentOS6.5を日本語化する

■日本語パッケージのインストール
yum groupinstall "Japanese Support"

ロケールの追加
locale -a
で、ja_JP.utf8がないので
localedef -f UTF-8 -i ja_JP ja_JP.utf8
を実行する。
locale -aでja_JP.utf8が追加される。そこで、
vi /etc/sysconfig/i18n
#LANG="en_US.UTF-8"
LANG="ja_JP.UTF-8"
SYSFONT="latarcyrheb-sun16"
再起動
これでdateコマンドが日本語表示される

タイムゾーンの設定
dateコマンドを入力するとUTCになるのでJSTに変更する
cp /usr/share/zoneinfo/Japan /etc/localtime
vi /etc/sysconfig/clock
#ZONE="Etc/UTC"
ZONE="Asia/Tokyo"
これで、dateコマンドがJSTで表示される

■man の日本語化
yum install man-pages-ja

VagrantでCentOS6.5を使う

Windows8(64bit)にVagrant1.5.4をインストールし、CentOS6.5を入れる

■VertualBoxのインストール
https://www.virtualbox.org/
からVirtualBox 4.3.10 for Windows hostsをダウンロードしてインストール

Vagrantのインストール
http://www.vagrantup.com/
からvagrant_1.5.4.msiをダウンロードしてインストール

再起動して、バージョン確認
C:\Users\xxxx>vagrant -v
Vagrant 1.5.4

■CentOS6.5をインストール
http://www.vagrantbox.es/
からOSを探し、以下のコマンドを入力
vagrant box add centos65 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box
または、boxファイルをダウンロードしておき
vagrant box add centos65 C:\Users\fuse\Downloads\centos65-x86_64-20131205.box
vagrant init centos65
vagrant up

■ログイン
PuTTY
ホスト名:localhost
ポート:2222
SSHで接続

Vagrantの終了
vagrant halt

Windows8にVagrantをインストールしてCentOSを入れる

Windows8(64bit)にVagrant1.3.5をインストールし、CentOS6.4を入れる

Rubyのインストール
http://rubyinstaller.org/
からRuby 2.0.0-p247 (x64)をダウンロードしてインストール

■VertualBoxのインストール
https://www.virtualbox.org/
からVirtualBox 4.3 for Windows hosts をダウンロードしてインストール

Vagrantのインストール
http://www.vagrantup.com/
からVagrant_1.3.5.msiをダウンロードしてインストール

再起動して、バージョン確認

C:\Users\xxxx>vagrant -v
Vagrant 1.3.5

■CentOS6.4 x86_64 Minimalをインストール
以下のコマンドを入力
vagrant init centos64_64 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box
vagrant up

C:\Users\xxxx>vagrant init centos64_64 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box
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.

C:\Users\xxxx>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Box 'centos64_64' was not found. Fetching box from specified URL for
the provider 'virtualbox'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading or copying the box...
Extracting box...ate: 515k/s, Estimated time remaining: --:--:--)
Successfully added box 'centos64_64' with provider 'virtualbox'!
[default] Importing base box 'centos64_64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.

Guest Additions Version: 4.2.16
VirtualBox Version: 4.3
[default] Mounting shared folders...
[default] -- /vagrant

C:\Users\xxxx>

ssh接続
PuTTYlocalhost:2222 へ接続する
ユーザ名:vagrant パスワード:vagrant

VMの終了、起動
vagrant halt
vagrant up

VirtualBoxにCentOS6.3(64bit版)をインストールするときの設定

VirtualBoxを起動する。
[新規]ー[続ける]
名前:CentOS6.3
オペレーティングシステムLinux
バージョン:Other Linux
[続ける]

でインストールしていくと、
「This kernel requires an X86-64 CPU, but only detected an i686 CPU.」
というエラーになる。これを回避するには、

バージョン:Red Hat (64bit)

とすればよい。

Haskell Platform 2012.2.0.0 for Mac OS X をインストールする

1.Haskell Platform 2012.2.0.0 32bit.pkg をダブルクリック

Command Line Build Tools Required

と出たら、以下を実行する
 (1)Xcode4.3を起動する。
 (2)[Xcode]-[preferences…]-[Downloads]を選択。
 (3)Command Line Tools(154.6MB)の右端の[Install]をクリック。

再度、Haskell Platform 2012.2.0.0 32bit.pkg をダブルクリック

2.「Haskell Platform のインストール」ウィンドウが表示されるので、[続ける]-[続ける]-[インストール]と選択

3.「インストールが完了しました。」と出るので[閉じる]をクリック

Older Versions
There are older versions of GHC and/or Haskell Platform on this system.
Run the command line tool uninstall-hs to find out more and how to remove then.

と表示されたら、古いGHCバージョンをアンインストールする。

$ uninstall-hs
-- Versions found on this system
7.0.3
7.4.1
-- To remove a version and all earlier: uninstall-hs thru VERSION
-- To remove only a single version:     uninstall-hs only VERSION

$ uninstall-hs thru 7.0.3
-- Would remove version 7.0.3 and earlier
/Library/Frameworks/GHC.framework/Versions/7.0.3-i386
/Library/Haskell/ghc-7.0.3
/usr/bin/ghc-7.0.3@ -> /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/bin/ghc-7.0.3
/usr/bin/ghc-pkg-7.0.3@ -> /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/bin/ghc-pkg-7.0.3
/usr/bin/ghci-7.0.3@ -> /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/bin/ghci-7.0.3
/usr/bin/haddock-ghc-7.0.3@ -> /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/bin/haddock-ghc-7.0.3
-- To actually remove these files, sudo run the command again with --remove
-- To generate a script to remove these files, run the command again with --script

$ uninstall-hs
-- Versions found on this system
7.0.3
7.4.1
-- To remove a version and all earlier: uninstall-hs thru VERSION
-- To remove only a single version:     uninstall-hs only VERSION

アンインストールできなかったので、以下のようにコマンド実行

$ sudo uninstall-hs thru 7.0.3 --remove
Password:
-- Removing version 7.0.3 and earlier
$ uninstall-hs
-- Versions found on this system
7.4.1
-- To remove a version and all earlier: uninstall-hs thru VERSION
-- To remove only a single version:     uninstall-hs only VERSION