1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[メモ] VagrantのVMware providerのライセンスがMPLのオープンソースに変更されたようなので、試す。

Last updated at Posted at 2021-06-15

image.png

概要

  • VagrantのVMware providerのライセンスがMPL(Mozilla Public License 2.0)になった模様。

  • https://www.vagrantup.com/docs/providers/vmware

    The Vagrant VMware plugin is now open sourced under the MPL. The code repository for the Vagrant VMware plugin is available on GitHub.
    (deepl先生翻訳) VagrantのVMwareプラグインはMPLでオープンソース化されています。Vagrant VMwareプラグインのコードリポジトリはGitHubで公開されています。

  • ということで、お試し。

環境

  • VMホスト(1)

    • Windows 10
    • VMware Workstation 16 Pro (Version: 16.1.2 build-17966106) - 30日試用版
    • Vagrant 2.2.16
    • Vagrant VMware Utility 1.0.20
    • Vagrant plugin: vagrant-vmware-desktop 3.0.0
  • VMホスト(2)

    • Lubuntu 20.04
    • VMware Workstation 16 Pro (Version: 16.1.2 build-17966106) - 30日試用版
    • Vagrant 2.2.16
    • Vagrant VMware Utility 1.0.20
    • Vagrant plugin: vagrant-vmware-desktop 3.0.0

手順

キホン

  1. VMWare、Vagrant、Vagrant VMware Utility、 Vagrant plugin: vagrant-vmware-desktopの順でインストール

  2. テスト

    mkdir vmtest
    cd vmtest
    vagrant init generic/ubuntu2004   # Vagrantfile生成
    vagrant up --provider=vmware_desktop # 初回時、イメージをダウンロードするので時間がかかる。
    vagrant ssh # ゲストにsshログイン
    .
    .
    .
    exit #ゲストを抜ける
    #
    vagrant reload # VM再起動
    vagrant halt # VMシャットダウン
    vagrant destroy -f # VM削除
    
    

Windows

  1. Adminで、PowerShellを開く (Win+x, a, Alt+y)

  2. Chocolateyインストール

    こぴぺ
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    
  3. VMWare、Vagrant、Vagrant VMware Utilityのインストール

    こぴぺ
    cinst -y vmwareworkstation vagrant vagrant-vmware-utility 
    
  4. VMWareを一度起動して、ライセンスに同意。(ライセンスキーを入力するか、30日評価選択)

  5. (お好みで)システム環境変数 VAGRANT_HOMEC:\Vagrant\.vagrant.d

  6. この辺でホスト機を一度、再起動

  7. vmware provider プラグインのインストール
    PowerShellを開いて、

    vagrant plugin install vagrant-vmware-desktop
    
  8. テスト
    PowerShellを開いて、

    mkdir C:\Vagrant\vmtest
    cd C:\Vagrant\vmtest
    vagrant init generic/ubuntu2004   # Vagrantfile生成
    vagrant up --provider=vmware_desktop
    vagrant ssh # ゲストVMにsshログイン
    .
    .
    .
    exit #ゲストを抜ける
    #
    vagrant reload # VM再起動
    vagrant halt # VMシャットダウン
    vagrant destroy -f # VM削除
    
    
  9. Vagrantfileを変更

    Vagrantfile
    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    Vagrant.configure("2") do |config|
      config.vm.box = "generic/ubuntu2004"
      config.vm.network "public_network"
    
      config.vm.provider "vmware_desktop" do |v|
    	v.gui = true #GUI を開く
      end
    end
    

Linux

  • ファイルをダウンロードして同様にインストールする

  • Windows10起動
    image.png

Packerで、Windows10 vmware boxイメージを作成

  • Windows 10 にて

  • WIN10英語版のISO

  • git-bashを開いて、適当なフォルダで以下実行. ISO_FILEを指定する。

git clone https://github.com/StefanScherer/packer-windows.git
cd packer-windows/
sed -i -e 's/Enterprise\ Evaluation/Pro/g' ./answer_files/10/Autounattend.xml
sed -i -e 's/<ProductKey>2F.*/<ProductKey><Key>VK7JG-NPHTM-C97JM-9MPGT-3V66T<\/Key>/g' ./answer_files/10/Autounattend.xml


export ISO_FILE=/c/Vagrant/WIN10.ISO
export ISO_SHA1SUM=$(sha1sum ${ISO_FILE} | sed  -e 's/(space)(space)*/(space)/g'   | cut -d ' ' -f 1)

time packer build -force -only=vmware-iso -var "iso_url=${ISO_FILE}" -var "iso_checksum_type=sha1" -var "iso_checksum=${ISO_SHA1SUM}"  ./windows_10.json

その他

  • ちゃんと試してないけど、Playerのほうでは、うまく動かないっぽい
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?