Since I built a Linux environment using VirtualBox + Vagrant on Windows 10, it remains as a memo.
・ Installation of VirtualBox ・ Installation of Vagrant ・ Construction of Linux environment
-Click "Windows hosts" from VirtualBox official website to download the software. The latest version at this time is VirtualBox 6.1.4.
-Start the downloaded installer and install it according to the procedure. There are no special settings required. -Once the installation is complete, the following screen will be displayed.
This completes the VirtualBox installation.
-Select the Windows 64bit version from Vagrant official website and download it.
-Start the downloaded installer and install it according to the procedure. There are no special settings required. -After installation, restart your PC.
This completes the Vagrant installation.
In Vagrant, a virtual machine is created for each folder, so create a folder for executing "test1" here.
Example:
C:\tool\vagant\test1
Open a Windows command prompt and execute the following command
㏅ C:\tool\vagant\test1
Next, create a Vagrantfile
vagrant init
This will create a file called Vagrantfile under the test1 folder.
Open the Vagrantfile file and modify the following two places
Correction 1
Before correction:
config.vm.box = "base"
Revised:
config.vm.box = "centos/7" //Install Centos7
config.vm.hostname= "192.168.33.10" //Set the virtual machine IP
Correction 2 (just uncomment)
Before correction:
# config.vm.network "private_network", ip: "192.168.33.10"
Revised:
config.vm.network "private_network", ip: "192.168.33.10"
Please refer to the following articles for the network that can be set with Vagrantfile. Vagrant Getting Started 04 --Vagrant Network Settings
Initially start the virtual machine by executing the following command at the Windows command prompt.
vagrant up
The following error may occur during initial startup.
Error message:
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
Countermeasure:
-From the administrator user, execute cmd to open a command prompt
・ "Dism.exe /Online /Disable-Feature:Microsoft-Hyper-Run the "V" command to Microsoft-Hyper-Close V
After starting the virtual machine, you can operate it with the following command.
Log in to the virtual machine: vagrant ssh
Log out of the virtual machine: exit
Stop the virtual machine: vagrant halt
Delete virtual machine: vagrant destroy
Recommended Posts