0
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 1 year has passed since last update.

Vagrantで作った環境をパッケージ化して配布する

Last updated at Posted at 2019-04-15

せっかく開発環境をVagrantで作ったので、
ほかの人が利用できるように、パッケージ化してみます。

パッケージ化する

名前を付けてパッケージ化する

vm名を確認する

何も指定しないで作ると、defaultという名前になるみたいです。

vagrant status

ファイル名を指定してパッケージ化する

先ほど取得したvm名を使って以下の通りパッケージ化します。

vagrant package --base [vm名] --output [パッケージファイル名.box]
==> default: Exporting VM...
==> default: Compressing package to: C:/Users/xxxxx/xxxxx/[パッケージファイル名.box]

デフォルトでは、package.boxという名前になる

パッケージ化されたファイルをBoxとして追加

vagrant box add [BOX名] [パッケージファイル名.box]
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box '[BOX名]' (v0) for provider:
    box: Unpacking necessary files from: file://C:/Users/xxxxx/xxxxxx/[パッケージファイル名.box]
    box: Progress: 100% (Rate: 171M/s, Estimated time remaining: --:--:--)
==> box: Successfully added box '[BOX名]' (v0) for 'virtualbox'!

追加されているか確認

vagrant box list
[BOX名]            (virtualbox, 0)
bento/ubuntu-18.04 (virtualbox, 201812.27.0)

最後に

ここまでできれば、あとは

vagrant init [BOX名]
vagrant up

でいつでも初期設定したOSが使えます。よかったよかった。
昔は、新しい開発者が来るたびに、OSインストールから・・・やっていたのがうそのようですね。

0
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
0
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?