VirtualBox virtual machines don't have to say more
Vagrant is a virtualbox command-line image management tool written by Ruby
1 Install VirtualBox then install vageant Google is harmonious can Baidu this should not die
2 Downloads you need a. vagrantbox file suffix of. Box
(I downloaded the centos7.1 on the /users/jianmingyuan/documents/vagrantvms/centos7.1/vagrant-centos-7.1.box)
2 Open Terminal: VAGRANT-V will see the current vagrant version information
3 Terminal execution: CD to execute Vagrant box add centos7.1 /users/jianmingyuan/documents/vagrantvms/centos7.1/in the directory where you want to place the virtual machine files Vagrant-centos-7.1.box
(where the centos7.1 after add is the name you give to the virtual machine to facilitate later operation is the path of the downloaded image file)
4 vagrant Box list should be able to see the virtual machine you just created
5 vagrant Init centos7.1 After initialization will be generated in the current folder Vagrantfile profile each time the virtual machine is started, the configuration information is read first
Search Config.vm.synced_folder Remove the # symbol in front of this line of code. This configuration is followed by two parameters, the first parameter is the directory on the host, you can use the absolute location, you can use the relative position, if it is relative to the location of the project root, that is, relative to the location of the directory where the file vagrantfile. Two parameters is a comma, the second parameter is the directory on the virtual machine, if you set the directory on the virtual machine does not exist, Vagrant when the virtual machine is started, will automatically create this directory. This will enable you to share the file.
6 vagrant up the virtual machine
7 vagrant SSH Login to the virtual machine for operation
Ps:
# vagrant halt off virtualized development environment
# vagrant Reload After modifying the configuration file, restart the virtualized development environment
# vagrant Box List View the currently available virtualized development environment
# vagrant Box Remove Boxname Delete the specified box environment
# vagrant Package is currently running VirtualBox virtual environment packaged into a reusable box
# vagrant up the virtual machine
# vagrant destroy destroying virtual machines
VirtualBox + vagrant