1. Initialize the VM configuration

The Vagrantfile file appears in the directory

vagrant init cent
Copy the code

2. Add box and check whether box is added successfully

vagrant box add cent cent.box
vagrant box list
Copy the code





3. Modify the Vagrantfile configuration file

The first path is the physical machine directory, which can be absolute or relative to the directory where the Vagrant configuration file is located. The second path is the address of the directory mounted to the virtual machine, or created if there is no current directory

config.vm.synced_folder "E:/WWW", "/home/www"
Copy the code

4. Start the VM

vagrant up
Copy the code

5. The VM starts successfully and an exception occurs

A “vboxsf” exception is thrown at the end

Mount: unknown filesystem type ‘vboxsf’



Vboxguestextrared. iso image cannot be inserted. Close it (PS: the VM is started).

7. Run the command to stop the VM

vagrant halt
Copy the code

8. Find the CD/DVD-ROM drive and add it (PS: THE VM is shut down)

VB provides an enhancement tool for the image’s default installation location at C: Program Files Oracle VirtualBox vboxGuestExtracts.iso, select Add

9. Start the VM again

vagrant up
Copy the code

The problem is that Linux cannot mount the CD-ROM drive successfully. The solution is to manually mount the CD-ROM drive in Linux and install the enhancement plug-in inside the Enhancement.

10. Enter The Linux mount cd-rom drive and follow the command step by step

Vagrant SSH // Go to the VM su root // Switch to user root. Vagrant yum -y update yum -y install GCC yum -y install kernel yum -y install kernel-devel mount /dev/cdrom-mnt CD vagrant yum -y update yum -y install GCC yum -y install kernel yum -y install kernel-devel mount /dev/cdrom/MNT CD /mnt ./VBoxLinuxAdditions.runCopy the code

11. Restart the VM

vagrant reload
Copy the code

12. Share folders



13. If the startup still fails, restart the VM again



14. If you haven’t synchronized, try again from Step 7

15, if not synchronized, please refer to other methods ~