【アーカイブレッスン】このレッスンは視聴可能ですが、質問の受付や内容の更新は終了しております。
動画の読み込みに失敗しました。しばらく待ってからリロードしてみてください。解決しない場合は ヘルプ「動画が見られない場合について」 もご覧ください。
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 系を使用することはできません。
    この動画には 7 件の補足情報があります。
    さて、続きをやっていきましょう。
    では前回見たような処理をやっていきたいのですが、ここからは慣れないとコマンドの打ち間違いがあるかもしれないので、あらかじめコマンドをこちらに書いておきました。

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

    詳しくみる

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

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

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

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

    # ホームディレクトリに移動
    cd
    
    # 今後複数の仮想マシンを作ることを想定して、それらをまとめるフォルダ(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にする
    sed -i '' -e 's/# config.vm.network "private_network", ip: "192.168.33.10"/config.vm.network "private_network", ip: "192.168.33.10"/' Vagrantfile
    
    # 仮想マシンを起動する(少し時間かかります)
    vagrant up
    
    # 仮想マシンの状態を確認する
    vagrant status
    2018年2月22日

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

    /Users/ユーザー名/MyVagrant/MyCentOS
    

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

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

    続きを表示する...

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

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

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

    2020年3月15日

    最新の Vagrant が古いバージョンの macOS に対応していないためと考えられます。

    https://releases.hashicorp.com/vagrant/2.2.6/

    から vagrant_2.2.6_x86_64.dmg をダウンロードしてインストールし直してみてください。

    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年9月11日

    vagrant up を実行すると以下のようなエラーが出る場合があります。

    Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Box 'bento/centos-6.8' could not be found. Attempting to find and install...
        default: Box Provider: virtualbox
        default: Box Version: >= 0
    The box 'bento/centos-6.8' could not be found or
    could not be accessed in the remote catalog. If this is a private
    box on HashiCorp's Vagrant Cloud, please verify you're logged in via
    `vagrant login`. Also, please double-check the name. The expanded
    URL and error message are shown below:
    
    URL: ["https://vagrantcloud.com/bento/centos-6.8"]
    Error: SSL certificate problem: self signed certificate in certificate chain

    ウイルス対策ソフトのようなセキュリティソフトが影響している可能性がありますので、一旦セキュリティソフトをオフにしてから試してみてください。

    2018年2月22日

    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年2月22日

    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
    

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

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

    詳しくみる

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

    詳しくみる

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