Vagrant+virtualBox

Vagrant+virtualBox 

1. Preparation

1) Vagrant download https://www.vagrantup.com/downloads.html

2) Download Virtualbox 5.1   https://www.virtualbox.org/wiki/Download_Old_Builds_5_1

3) Restart: enter the system bios-> cpu settings-> open virtualization service under windows

Note: Currently, Vagrant only supports VirtualBox versions 4.0.x, 4.1.x, 4.2.x, 4.3.x, 5.0.x, 5.1.x, and 5.2.x. Other versions are not supported, if your virtualbox is not these Version, please uninstall and reinstall.

2. Create a new directory as the Vagrant project directory

When importing a sql file locally, the error "MySQL server has gone away" appears

 

3. Add the previously downloaded box

Add box command format: vagrant box add <local box name> <box file>

Local box name: custom name, this name is the name used in local vagrant management

Box file: the vagrant box file downloaded previously or the remote box url address

4. Check if the box is added successfully

  vagrant box list

 

5. Initialize the box added above

Initialization command format: vagrant init <local box name>

Local box name: The box name added in step 2

Initialize the box added earlier, after initialization, a Vagrantfile file will be produced in the current directory

 

 

I changed the content of the Vagrantfile, you need to execute vagrant reload to take effect (equivalent to halt, then up)

6. Start the virtual machine

Virtual machine startup command: vagrant up

7. Connect to the virtual machine

Command format: vagrant ssh

 

8. View the virtual machine status vagrant status

 

9. Turn off the virtual machine vagrant halt

Guess you like

Origin www.cnblogs.com/hld123/p/12729204.html