https://www.vagrantup.com/docs/installation
https://www.vagrantup.com/downloads
2020-12-10 Current Version: 2.2.14
Install the latest version of Vagrant.
Install VirtualBox
默认安装地址 C:\HashiCorp\Vagrant
https://learn.hashicorp.com/tutorials/vagrant/getting-started-index?in=vagrant/getting-started
https://www.cnblogs.com/hafiz/p/9175484.html
vagrant init hashicorp/bionic64
https://mirrors.ustc.edu.cn/centos-cloud/centos/7/vagrant/x86_64/images/
https://c4ys.com/archives/1230
vagrant box add centos7-std ./CentOS-7-x86_64-Vagrant-2004_01.VirtualBox.box
vagrant init centos7
vagrant up
vagrant box add --name ${BOX_NAME} ./CentOS-7-x86_64-Vagrant-2004_01.VirtualBox.box
在空文件夹初始化虚拟机 vagrant init [box-name]
https://app.vagrantup.com/debian/boxes/jessie64/versions/8.11.1/providers/virtualbox.box
https://app.vagrantup.com/debian/boxes/jessie64/versions/8.11.1/providers
https://app.vagrantup.com/ubuntu/boxes/trusty64/versions/20190514.0.0/providers/virtualbox.box
https://app.vagrantup.com/gusztavvargadr/boxes/windows-10/versions/2004.0.2010/providers/virtualbox.box
https://vagrantcloud-files-production.s3.amazonaws.com/archivist/
By default, Vagrant shares your project directory (the one containing the Vagrantfile) to the /vagrant directory in your guest machine.
PS C:\xpc\x-vagrant\centos7-std> vagrant global-status
id name provider state directory
-------------------------------------------------------------------------
d523b56 default virtualbox poweroff C:/xpc/x-vagrant/centos7-std
af029a6 default virtualbox poweroff C:/xpc/x-vagrant/test2
PS C:\xpc\x-vagrant\centos7-std> vagrant destroy d523b56
PS C:\Users\xpc>
PS C:\Users\xpc> vagrant.exe
Usage: vagrant [options] <command> [<args>]
-h, --help Print this help.
Common commands:
autocomplete manages autocomplete installation on host
box manages boxes: installation, removal, etc.
cloud manages everything related to Vagrant Cloud
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrantfile
login
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
port displays information about guest port mappings
powershell connects to machine via powershell remoting
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
snapshot manages snapshots: saving, restoring, etc.
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
upload upload to machine via communicator
validate validates the Vagrantfile
version prints current and latest Vagrant version
winrm executes commands on a machine via WinRM
winrm-config outputs WinRM configuration to connect to the machine
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
--[no-]color Enable or disable color output
--machine-readable Enable machine readable output
-v, --version Display Vagrant version
--debug Enable debug output
--timestamp Enable timestamps on log output
--debug-timestamp Enable debug output with timestamps
--no-tty Enable non-interactive output
PS C:\Users\xpc\Documents> cd D:
PS D:\> cd .\xas4k\
PS D:\xas4k> mkdir vagrant
PS D:\xas4k> clear
root@DESKTOP-PM5KOT8:~# ls /mnt/c/HashiCorp/Vagrant/bin/
vagrant.exe
root@DESKTOP-PM5KOT8:/mnt/c/HashiCorp/Vagrant/bin# ./vagrant.exe
Vagrant failed to initialize at a very early stage:
Failed to locate the powershell executable on the available PATH. Please
ensure powershell is installed and available on the local PATH, then
run the command again.
报错1 doesn’t have the proper permissions
xpc@DESKTOP-PM5KOT8 C:\HashiCorp\Vagrant\bin
$ vagrant.exe init hashicorp/bionic64
The user that is running Vagrant doesn't have the proper permissions
to write a Vagrantfile to the specified location. Please ensure that
you call `vagrant init` in a location where the proper permissions
are in place to create a Vagrantfile.
解决:使用管理员权限打开Windows命令行界面