Skip to content

Instantly share code, notes, and snippets.

@yuitowest
Last active December 15, 2015 21:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuitowest/5329959 to your computer and use it in GitHub Desktop.
Save yuitowest/5329959 to your computer and use it in GitHub Desktop.
Vmware Fusion用のVagrant BOXファイルの作成のやりかたメモ

みんな大好きCentOS

  • 6.4 x86_64
  • VMware Fusionに追加して起動するところまでやる。
  • shutdownする

Vagrantのboxファイル作成

$ cd /path/to/Virtual\ Machines.localized/CentOS\ 64-bit.vmwarevm
$ /Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -d Virtual\ Disk.vmdk
$ /Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k Virtual\ Disk.vmdk
$ echo '{\n  "provider": "vmware_fusion"\n}' > metadata.json
$ tar cvzf CentOS6_x86_64.box ./*
$ mv CentOS6_x86_64.box /path/to/workspace/
  • いったんVMware FusionからインストールしたCentOSを削除しておく

Vagrantにboxファイルを追加する

$ cd /path/to/workspace/
$ vagrant box add CentOS6_x86_64 ./CentOS6_x86_64.box --provider vmware_fusion
Successfully added box 'CentOS6_x86_64' with provider 'vmware_fusion'!
$ vagrant box list
CentOS6_x86_64 (vmware_fusion)

Vagrantから起動

$ vagrant init
$ vim Vagrantfile
  # config.vm.box = "base"
    config.vm.box = "CentOS6_x86_64"
$ vagrant up --provider vmware_fusion

ハマリどころ

  • vagrant up で怒られる

     $ vagrant up --provider vmware_fusion
     The VMware "vmnet" devices are failing to start. The most common
     reason for this is collisions with existing network services. For
     example, if a hostonly network space collides with another hostonly
     network (such as with VirtualBox), it will fail to start. Likewise,
     if forwarded ports collide with other listening ports, it will
     fail to start.
     
     Vagrant does its best to fix these issues, but in some cases it
     cannot determine the root cause of these failures.
     
     Please verify you have no other colliding network services running.
    
    • VMware Fusionにイメージから追加した時にNetwork Adapterの設定が[Share with my Mac]だとダメっぽい

    • VMWareの設定から Settings > NetworkAdapter > [Autodetect]に変更した

  • VMのbootでハングする

    • vagrant up のあと Waiting for the VM to finish booting... でずっと待ち

    • X WIndow 入っててGUIが起動するboxの場合はVagrantfileに設定が必要 鯖の方は何も設定いらなそう

      config.vm.provider :vmware_fusion do |vb|
        # Don't boot with headless mode
        vb.gui = true
      
        # Use VBoxManage to customize the VM. For example to change memory:
        # vb.customize ["modifyvm", :id, "--memory", "1024"]
      end
      
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment