What is Vagrant?

What is Vagrant?

feature

What is Vagrant? CUI software for virtualization software such as Virtualbox software that operates virtualization software such as Virtualbox virtualization software such as Virtualbox.

Although VirtualBox alone can build a Linux environment with GUI, managing it with CUI has the following advantages.

  • Can be built with a single command
  • Can automate construction
  • Setting information can be shared.

 

Usage Procedure

install

Download

The configuration for building a virtual machine is entered in a configuration file called vagrantfile in the Ruby language.

The specification is to read the vagrantfile by executing the vagrant up command.

 

Create a folder to run Vagrant and move it there

mkdir /user/vagrant

cd

 

 

 

Add a Box file

A *Box is an OS image file. It is a template for a virtual machine.

Boxes can be found at the following sites and others.

Example sentence:.

vagrant box add {BOXNAME} {URL}

 

vagrant box add CentOS7-test https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.1.0/centos-7.0-x86_64.box

md Centos7-test

 

To install the BOX from the following URL

https://app.vagrantup.com/centos/boxes/7

$ vagrant box add centos/7 
==> box: Loading metadata for box 'centos/7'
    box: URL: https://vagrantcloud.com/centos/7
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

 

Confirmation of installed Box

vagrant box list

 

When you add a box, the following folders are created.

Box images such as centos are stored under the box folder.

C:\Users\{UserName}\.vagrant.d
PS C:\Users\d-wat\.vagrant.d> ls

Directory: C:\Users\{UserName}\.vagrant.d
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2021/03/07 21:43 boxes
d---- 2021/03/07 21:43 data
d---- 2021/03/07 21:43 gems
d---- 2021/03/07 21:43 rgloader
d---- 2021/03/07 21:54 tmp
-a--- 2021/03/07 21:43 1675 insecure_private_key
-a--- 2021/03/07 21:43 3 setup_version

 

Create a folder for each virtual machine

Create a directory for each virtual machine and a configuration file (Vagrantfile) in it for easy management.

$ cd ~/vagrant/
$ mkdir centos7
$ cd centos7/

Virtual machine initialization

The initialization process creates a vagrantfile.

vagrant box list

vagrant init Box name

vagrant init c entos/7

One Vagrantfile file is created in the folder where the * command is executed.

If you only use vagrant init, the Vagrantfile file will be created with "config.vm.box="base" instead of "config.vm.box="centos/7".

 

Running centos7 on VirtualBox

vagrant up

*VurtualBox manager will start CentOS7.

User:vagrant

Pass: vagrant

Switch to root with sudo

 

For ssh login directly from the terminal

vagrant ssh

 

Shut down CentOS7

vagrant halt

 

Virtual Machine Deletion

vagrant destroy

*CentOS7 is erased from the VurtualBox manager.

*Vagrantfile is not erased.

 

 

Check Box

vagrant box list

 

Delete Box

vagrant box remove BOX name

 

 

 

Check the version of VAGRANT

vagrant version

 

What is ATLAS?

 

Vagrantfile configuration memo

Specify the name of VirtualBox

config.vm.provider "virtualbox" do |vb|
vb.name = "centos7"
end

 

Error messages in the vagrant command

The version of powershell currently installed on this host is less than
the required minimum version. Please upgrade the installed version of
powershell to the minimum required version and run the command again.

It means that the version of PowerShell is old, so it needs to be upgraded.

It seems to be a bug in ComEmu. If I launch the standard PowerShell terminal and type the command, there is no error.

 

Windows 10] PowerShell Version Upgrade Procedure

Related Articles

Memorandum】Instructions for setting up CentOS7 environment using Vagrant

おすすめの記事