【アーカイブレッスン】このレッスンは視聴可能ですが、質問の受付や内容の更新は終了しております。
動画の読み込みに失敗しました。しばらく待ってからリロードしてみてください。解決しない場合は ヘルプ「動画が見られない場合について」 もご覧ください。
Play
Current Time 0:00
/
Duration Time 0:00
Remaining Time -0:00
Stream TypeLIVE
Loaded: 0%
Progress: 0%
0:00
00:00
Mute
Playback Rate
    1
    Subtitles
    • subtitles off
    Captions
    • captions off
    Chapters
    • Chapters
    シアター
    • シアター
    • ピクチャ
    • 全画面
    x1.0
    • プレミアム会員になると動画の速度を変更できます
    男性ボイス
    • プレミアム会員になると講義音声を切り替えられます
    HD
    Loaded: 0%
    Progress: 0%
    0:00
    The video could not be loaded, either because the server or network failed or because the format is not supported.
    必ず bento/centos-6.8 を指定するようにしてください。CentOS 7 系を使用することはできません。
    vagrant up 実行時にエラーメッセージが出た場合は補足情報をご確認ください。
    この動画には 11 件の補足情報があります。
    さて、では前回見たような処理をしてあげましょう。
    ここからは慣れていないとコマンドの打ち間違いがあるかもしれないので、実行するコマンドをコメント付きでこちらに書いておきました。

    文字起こしはプレミアムプラン向けの機能です

    詳しくみる

    フォルダや設定ファイルを作りながら仮想マシンを立ち上げていきます。

    • フォルダの作成
    • 仮想マシンの設定
    • 仮想マシンの立ち上げ
    2020年9月18日

    動画中で利用したコマンドは以下のとおりです。

    なお、動画の最初に実施している vagrant-vbguest プラグインの導入はエラーを引き起こす可能性があるため、実施しないようにしてください。

    # 今後複数の仮想マシンを作ることを想定して、それらをまとめるフォルダ(MyVagrant)を作る
    mkdir MyVagrant
    
    # MyVagrantに移動する
    cd MyVagrant
    
    # 仮想マシンを作るフォルダを作る(MyCentOS)
    mkdir MyCentOS
    
    # MyCentOSに移動する
    cd MyCentOS
    
    # 仮想マシン設定用のVagrantfileを作る
    vagrant init bento/centos-6.8
    
    # Vagrantfileを編集して仮想マシンのIPアドレスを192.168.33.10にする
    (35行目の先頭の # を外します。詳しくは動画をご覧ください)
    
    # 仮想マシンを起動する(少し時間かかります)
    vagrant up
    
    # 仮想マシンの状態を確認する
    vagrant status
    2019年12月14日

    Windows で日本語のユーザー名を使用している場合、以下のようなエラーで vagrant コマンドが失敗する場合があります。

    • Windows-31J and UTF-8 (Encoding::CompatibilityError) ... というエラー
    • Vagrant failed to initialize at a very early stage ... というエラー

    それぞれの解決手順は以下をご参照ください。

    続きを表示する...

    Windows-31J and UTF-8 (Encoding::CompatibilityError) ... というエラー

    エラーメッセージ
    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Importing base box 'bento/centos-6.8'...
    C:/HashiCorp/Vagrant/embedded/gems/gems/childprocess-0.6.3/lib/childprocess/windows/process_builder.rb:43:in `join': incompatible character encodings: Windows-31J and UTF-8 (Encoding::CompatibilityError)
    ...
    対処法

    これは Windows のユーザー名が日本語の場合に発生するエラーとなります。回避するには、

    • ユーザー環境変数の設定
    • VirtualBox の「デフォルトの仮想マシンフォルダー」の設定

    を以下の手順に従って実施してください。

    1. ユーザー環境変数の設定

    ※ 環境変数の設定は間違えないようご注意ください。

    1. Cドライブの直下に vagrant_home という名前のフォルダを作成します。
    2. ユーザー環境変数に VAGRANT_HOME を追加し、その値を C:\vagrant_home と設定します。(バックスラッシュは Windows では円記号となります。キーボード右上の円記号を打ち込むか、\ をコピーしてください。)
    3. パソコンを再起動します。

    ※ 環境変数の設定方法は OS のバージョンによって異なります。「Windows10 環境変数」「Windows7 環境変数」などで検索して調べてみてください。

    2. VirtualBox のデフォルトの仮想マシンフォルダーの設定
    1. Cドライブの直下に vboxvms という名前のフォルダを作成します。
    2. VirtualBox を起動し、「ファイル」-「環境設定」-「一般」にある「デフォルトの仮想マシンフォルダー」に、そのフォルダのパスを指定します。

    » 参考: http://sutara79.hatenablog.com/entry/2015/06/28/104150

    ここまで設定ができたら再度 PowerShell にて vagrant up を実施してみてください。

    Vagrant failed to initialize at a very early stage ... というエラーの場合

    エラーメッセージ
    Vagrant failed to initialize at a very early stage:
    
    The plugins failed to load properly. The error message given is shown below.
    
    cannot load such file -- vagrant-vbguest
    対処法

    PowerShell で cd C:\ として C ドライブ直下に移動し、そこに
    MyVagrant フォルダを作成するようにしてみてください。

    それでも解決しない場合は、

    vagrant plugin uninstall vagrant-vbguest

    としてプラグインをアンインストールした上で、

    vagrant init bento/centos-6.8

    を実行してください。(vagrant-vbguest プラグインは必須ではありません)

    2020年7月8日

    vagrant up の実行時に、

    Stderr: VBoxManage.exe: error: Not in a hypervisor partition (HVP=0) (VERR_NEM_NOT_AVAILABLE).
    VBoxManage.exe: error: VT-x is disabled in the BIOS for all CPU modes (VERR_VMX_MSR_ALL_VMX_DISABLED)

    のようなメッセージが表示された場合、ご利用のパソコンにて仮想化支援機能が無効になっており仮想マシンの作成ができない状態となっています。(ご利用のパソコンによっては「VT-x」が「AMD-V」と表示される場合もあります。)

    解決法

    続きを表示する...

    以下のサイトなどを参考に BIOS の設定を確認し、仮想化支援機能を有効化してみてください。

    なお、ウィルス対策ソフトによっては BIOS の設定を無効にしてしまう場合があります。

    その場合は、ウィルス対策ソフトの設定で仮想化支援機能に関する項目を無効にしていただくか、ウィルス対策ソフト自体を一時的に終了させてから vagrant up を実施してみてください。

    2020年10月7日

    vagrant up の実行時に「Timed out while waiting for the machine to boot.」で始まるエラーメッセージが表示された場合、ご利用のパソコンにて仮想化支援機能が無効になっていることが原因の可能性があります。

    続きを表示する...

    Timed out while waiting for the machine to boot. This means that
    Vagrant was unable to communicate with the guest machine within
    the configured ("config.vm.boot_timeout" value) time period.
    
    If you look above, you should be able to see the error(s) that
    Vagrant had when attempting to connect to the machine. These errors
    are usually good hints as to what may be wrong.
    
    If you're using a custom box, make sure that networking is properly
    working and you're able to connect to the machine. It is a common
    problem that networking isn't setup properly in these boxes.
    Verify that authentication configurations are also setup properly,
    as well.
    
    If the box appears to be booting properly, you may want to increase
    the timeout ("config.vm.boot_timeout") value.

    この場合、以下のサイトなどを参考に BIOS の設定を確認してみてください。

    なお、上記サイト等にあるように BIOS の設定で仮想化支援機能を有効にしても、ウィルス対策ソフトによってはその設定を無効にしてしまう場合もあります。

    Avast の場合
    http://hatena.fut573.com/entry/20160218/1455792335

    その場合は、ウィルス対策ソフトの設定で仮想化支援機能に関する項目を無効にしていただくか、ウィルス対策ソフト自体を一時的に終了させてから vagrant up を実施してみてください。

    2020年3月7日

    vagrant up の実行時に「Vagrant was unable to mount VirtualBox shared folders.」で始まるエラーメッセージが出る場合があります。

    このエラーが発生すると共有フォルダ機能が使えなくなりますが、レッスンでは利用していないためそのまま環境構築を続けてみてください。

    Vagrant was unable to mount VirtualBox shared folders. This is usually
    because the filesystem "vboxsf" is not available. This filesystem is
    made available via the VirtualBox Guest Additions and kernel module.
    Please verify that these guest additions are properly installed in the
    guest. This is not a bug in Vagrant and is usually caused by a faulty
    Vagrant box. For context, the command attempted was:
    
    mount -t vboxsf -o uid=500,gid=500 vagrant /vagrant
    
    The error output from the command was:
    
    /sbin/mount.vboxsf: mounting failed with the error: No such device
    2019年12月12日

    vagrant up を実行すると、

    No usable default provider could be found for your system.
    
    Vagrant relies on interactions with 3rd party systems, known as
    "providers", to provide Vagrant with resources to run development
    environments. Examples are VirtualBox, VMware, Hyper-V.
    
    The easiest solution to this message is to install VirtualBox, which
    is available for free on all major platforms.
    
    If you believe you already have a provider available, make sure it
    is properly installed and configured. You can see more details about
    why a particular provider isn't working by forcing usage with
    `vagrant up --provider=PROVIDER`, which should give you a more specific
    error message for that particular provider.

    というエラーメッセージが表示される場合があります。

    これは VirtualBox の新しいバージョンがリリースされたばかりで Vagrant がそのバージョンにまだ対応してない時や、そもそも VirtualBox がインストールされていない時に表示されるエラーメッセージです。

    新しいバージョンでこのエラーが発生したのなら古いバージョンの VirtualBox をインストールすることで回避できます。

    2019年10月15日

    vagrant up の実行時にエラーが発生し、そのエラーメッセージ内に「VERR_INTNET_FLT_IF_NOT_FOUND」の文字列が表示されているときは、以下の手順を試してみてください。

    • Windows の設定から「ネットワークと共有センター」を開く。
    • アダプターの設定の変更を開く。
    • 「VirtualBox Host Only Ethernet ...」の記載のあるアダプタのプロパティを開く。
    • 「VirtualBox NDIS6 Bridged Networking Driver」のチェックを外して保存。
    • アダプタの右クリックメニューからアダプタを「無効」にした後「有効」に戻す。

    という手順になります。

    「VirtualBox Host Only Ethernet ...」のアダプタは複数存在する場合もありますので、すべてのアダプタに対して上記の手順を実施してみてください。

    実施できたらパソコンを再起動します。(再起動せずに上手くいく場合もあります。)

    再起動できたら PowerShell を起動し、

    cd ~/
    cd MyVagrant
    cd MyCentOS
    vagrant up

    と実行してみてください。

    参考: https://stackoverflow.com/questions/33725779/failed-to-open-create-the-internal-network-vagrant-on-windows10/33733454#33733454

    2018年3月15日

    Windows 7 では vagrant up を実行しても何も表示されず止まったようになるケースが確認されています。

    そうなった場合は Ctrl + c でコマンドを中断し、

    • VirtualBox はバージョン 5.1.30
    • Vagrant はバージョン 1.9.6

    をインストールしてから再度 vagrant up を試してみてください。

    Vagrant の古いバージョンは https://releases.hashicorp.com/vagrant/ から、VirtualBox の古いバージョンは https://www.virtualbox.org/wiki/Download_Old_Builds からダウンロードできます。

    2019年1月21日

    VBoxManage.exe がエラーとなる原因はいくつかあります。

    主な原因として仮想マシンが正常に終了せず、異常停止している場合がありますので、まずは vagrant halt で仮想マシンを確実に終了させ、その後 vagrant up を試してみてください。

    それでも解決しない場合は、一度 VirtualBox をアンインストールし、最新版の VirtualBox をインストールし直してみてください。

    また、セキュリティソフトが原因でエラーとなるケースも最近多く見受けられますので、導入しているセキュリティソフトの停止もしくはアンインストールもお試しください。

    続きを表示する...

    エラーメッセージの例 (1)
    There was an error while executing `VBoxManage`, a CLI used by Vagrant
    for controlling VirtualBox. The command and stderr is shown below.
    
    Command: ["startvm", "0205901d-9668-44e7-94d0-ee4d5bd9306a", "--type", "headless"]
    
    Stderr: VBoxManage.exe: error: Interface ('VirtualBox Host-Only Ethernet Adapter #2') is not a Host-Only Adapter interface (VERR_INTERNAL_ERROR)
    VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
    
    エラーメッセージの例 (2)
    Command: ["hostonlyif", "create"]
    
    Stderr: 0%...
    Progress state: E_FAIL
    VBoxManage.exe: error: Failed to create the host-only adapter
    VBoxManage.exe: error: Could not find Host Interface Networking driver! Please reinstall
    VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInte
    rface
    VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 94 of file VBoxManag
    eHostonly.cpp
    
    2018年6月19日

    今回「MyVagrant」というフォルダの中に「MyCentOS」というフォルダをさらに作成して、そのフォルダ上で vagrant コマンドを実行しています。

    C:\Users\ユーザー名\MyVagrant\MyCentOS
    

    というフォルダ階層になっています。

    仮想マシンは vagrant init や vagrant up コマンドを実行したフォルダ上で作成されますので、もし別のフォルダ上で実行してしまうともう1つ別の仮想マシンが作成されてしまいます。

    続きを表示する...

    現在のフォルダを確認するには pwd というコマンドが利用できますので、今どこのフォルダにいるのか分からなくなった時には pwd コマンドで確認してみてください。

    • フォルダの階層構造を意識する
    • 仮想マシンはコマンドを実行したフォルダに作られる
    • 現在のフォルダを確認するには pwd コマンドを使う

    このあたりのポイントを意識しておきましょう。

    2019年10月15日

    PowerShell では、コマンドを入力するカーソルの左側に表示されている、

    PS C:¥Users¥taguchi>

    が、現在コマンドを実行しているディレクトリ(フォルダ)の位置を示しています。

    「PS C:¥Users¥taguchi>」の場合は「Cドライブにある Users ディレクトリの中の taguchi ディレクトリにいる」という意味ですので覚えておきましょう。(Users ディレクトリは、エクスプローラーでは「ユーザー」と表記されているフォルダを指します。)

    動画中で cd コマンドを実行してディレクトリを移動すると、この文字列が変化していることが確認できるかと思います。

    このレッスンの問題を報告する

    素材ファイルをダウンロードするにはプレミアムプランへの登録が必要です

    詳しくみる

    ソースコードを閲覧するにはプレミアムプランへの登録が必要です

    詳しくみる

    このレッスンの問題を報告する