Objective: to quickly create a centos7 vm on Windows that can ping LAN and public network

Procedure 1 Download and install the software in the attachment

Install VirtualBox:www.virtualbox.org/wiki/Downlo first…

Install Vagrant:www.vagrantup.com/downloads.h again…

Download need box:app.vagrantup.com/boxes/searc…

The above resources I baidu cloud also offers a: https://pan.baidu.com/s/1_dkzDme_4ZoCWJuYqg9sCQ extraction code: 4 fv1

2 Go to D:\vm\centos7 and put centos-7.0-x86_64.box in it



Open Git Bash in your current directory and add box to Vagrant using the command vagrant box add centos7 centos-7.0-x86_64.box

3 Create a VM

Enter the directory: D:\vm\centos7\ centos7-VM-1

Use the command vagrant init centos7



You will find that the current directory generates a file, Vagrantfile, whose content is

Vagrant.configure("2") do |config|
    config.vm.box = "centos7"
end
Copy the code

Configure fixed IP addresses for VMS in the file

Vagrant.configure("2") do |config|
    config.vm.box = "centos7"
    config.vm.network "private_network", ip: "192.168.0.100"
end
Copy the code

4 Start the VM

Enter the directory: D:\vm\centos7-1\ centos7-VM-1

Use the command: Vagrant up (wait a minute or two)

After the startup is successful. You can view the VM on Oracle VM VirtualBox




Vagrant SSH can be used in the D:\vm\centos7\ centos7-VM-1 directory. Connect to the VM

Check the IP and you can see that it is the IP that we configured

The IP address can also be pinged from Windows



5 Shut down the VM

Suspension of vagrant suspend

Stop the vagrant the halt

Destruction of vagrant destroy

6 Other Questions

6.1 Account Password:

Default account password Vagrant/Vagrant

If root permission is required. Use Sudo

6.2 Shared Directory:

D:\vm\centos7\ Centos7-VM-1 with Linux/Vagrant directory. It’s shared.

How to quickly create 4 Centos7 virtual machines with docker installed (whatever software you want)