So-net無料ブログ作成

Vagrant 仮想マシン作成

Vagrant でVirtualBox のOS入りVMを容易に作成できる。
CentOSのVMを作成・実行。
こちらからVagrantをダウンロードしてWindowsにインストールする。
https://www.vagrantup.com/downloads.html
コマンドプロンプトで専用フォルダを作成する。

mkdir centos
cd centos

vagrant init を実行。vagrant init bento/centos-7.5

vagrant up を実行。vagrant up
メタデータをダウンロードするに時間が掛かるが,全自動でCentOSが実行される。

C:\centos>vagrant init bento/centos-7.5
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

C:\centos>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/centos-7.5' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'bento/centos-7.5'
     default: URL: https://vagrantcloud.com/bento/centos-7.5
==> default: Adding box 'bento/centos-7.5' (v201808.24.0) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/bento/boxes/centos-7.5/versions/201808.24.0/providers/virtualbox.box
    default: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
    default:
==> default: Successfully added box 'bento/centos-7.5' (v201808.24.0) for 'virtualbox'!
==> default: Importing base box 'bento/centos-7.5'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/centos-7.5' is up to date...
==> default: Setting the name of the VM: centos_default_1544939936610_38872
==> default: Vagrant has detected a configuration issue which exposes a
==> default: vulnerability with the installed version of VirtualBox. The
==> default: current guest is configured to use an E1000 NIC type for a
==> default: network adapter which is vulnerable in this version of VirtualBox.
==> default: Ensure the guest is trusted to use this configuration or update
==> default: the NIC type using one of the methods below:
==> default:
==> default:   https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type
==> default:   https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => C:/centos
C:\centos>

インストールされたのは,CentOS Linux release 7.5.1804 (Core)
メモリ 1GB,ディスクは可変で実サイズ1.28GB,最大64GB
ログインは,vagrant / vagrant。
sudo –s でroot昇格できる。
ssh 接続は,上記のユーザ,パスワードで接続できる。また公開鍵認証でssh接続も可能で,その場合以下の秘密鍵を使用する。

C:\centos\.vagrant\machines\default\virtualbox\private_key

box はこちらで探し,選択後Newボタンを押すと vagrant init の引数が確認できる。
https://app.vagrantup.com/boxes/search




nice!(1)  コメント(0) 

nice! 1

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

Facebook コメント