vagrant
This commit is contained in:
parent
2d183ae2af
commit
46470f7f16
233
vagrant
Normal file
233
vagrant
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
root@ger-xiaomi:~/vagrant# vagrant box add centos/7 --name centos7
|
||||||
|
==> box: Loading metadata for box 'centos/7'
|
||||||
|
box: URL: https://vagrantcloud.com/centos/7
|
||||||
|
The box you're adding has a name different from the name you
|
||||||
|
requested. For boxes with metadata, you cannot override the name.
|
||||||
|
If you're adding a box using `vagrant box add`, don't specify
|
||||||
|
the `--name` parameter. If the box is being added via a Vagrantfile,
|
||||||
|
change the `config.vm.box` value to match the name below.
|
||||||
|
|
||||||
|
Requested name: centos7
|
||||||
|
Actual name: centos/7
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant box add centos/7
|
||||||
|
==> box: Loading metadata for box 'centos/7'
|
||||||
|
box: URL: https://vagrantcloud.com/centos/7
|
||||||
|
This box can work with multiple providers! The providers that it
|
||||||
|
can work with are listed below. Please review the list and choose
|
||||||
|
the provider you will be working with.
|
||||||
|
|
||||||
|
1) hyperv
|
||||||
|
2) libvirt
|
||||||
|
3) virtualbox
|
||||||
|
4) vmware_desktop
|
||||||
|
|
||||||
|
Enter your choice: 3
|
||||||
|
==> box: Adding box 'centos/7' (v1802.01) for provider: virtualbox
|
||||||
|
box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1802.01/providers/virtualbox.box
|
||||||
|
==> box: Successfully added box 'centos/7' (v1802.01) for 'virtualbox'!
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vi Vagrantfile
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant up
|
||||||
|
Bringing machine 'default' up with 'virtualbox' provider...
|
||||||
|
==> default: Importing base box 'centos/7'...
|
||||||
|
==> default: Matching MAC address for NAT networking...
|
||||||
|
==> default: Checking if box 'centos/7' is up to date...
|
||||||
|
==> default: Setting the name of the VM: vagrant_default_1520790415234_40861
|
||||||
|
==> default: Clearing any previously set network interfaces...
|
||||||
|
==> default: Preparing network interfaces based on configuration...
|
||||||
|
default: Adapter 1: nat
|
||||||
|
==> default: Forwarding ports...
|
||||||
|
default: 22 (guest) => 2222 (host) (adapter 1)
|
||||||
|
==> default: Booting VM...
|
||||||
|
==> default: Waiting for machine to boot. This may take a few minutes...
|
||||||
|
default: SSH address: 127.0.0.1:2222
|
||||||
|
default: SSH username: vagrant
|
||||||
|
default: SSH auth method: private key
|
||||||
|
default:
|
||||||
|
default: Vagrant insecure key detected. Vagrant will automatically replace
|
||||||
|
default: this with a newly generated keypair for better security.
|
||||||
|
default:
|
||||||
|
default: Inserting generated public key within guest...
|
||||||
|
default: Removing insecure key from the guest if it's present...
|
||||||
|
default: Key inserted! Disconnecting and reconnecting using new SSH key...
|
||||||
|
==> default: Machine booted and ready!
|
||||||
|
==> default: Checking for guest additions in VM...
|
||||||
|
default: No guest additions were detected on the base box for this VM! Guest
|
||||||
|
default: additions are required for forwarded ports, shared folders, host only
|
||||||
|
default: networking, and more. If SSH fails on this machine, please install
|
||||||
|
default: the guest additions and repackage the box to continue.
|
||||||
|
default:
|
||||||
|
default: This is not an error message; everything may continue to work properly,
|
||||||
|
default: in which case you may ignore this message.
|
||||||
|
==> default: Rsyncing folder: /home/ger/vagrant/ => /vagrant
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant ssh
|
||||||
|
|
||||||
|
[vagrant@localhost ~]$ cat /etc/centos-release
|
||||||
|
CentOS Linux release 7.4.1708 (Core)
|
||||||
|
|
||||||
|
[vagrant@localhost ~]$ exit
|
||||||
|
logout
|
||||||
|
Connection to 127.0.0.1 closed.
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant up
|
||||||
|
Bringing machine 'default' up with 'virtualbox' provider...
|
||||||
|
==> default: Checking if box 'centos/7' is up to date...
|
||||||
|
==> default: Clearing any previously set forwarded ports...
|
||||||
|
==> default: Clearing any previously set network interfaces...
|
||||||
|
==> default: Preparing network interfaces based on configuration...
|
||||||
|
default: Adapter 1: nat
|
||||||
|
==> default: Forwarding ports...
|
||||||
|
default: 22 (guest) => 2222 (host) (adapter 1)
|
||||||
|
==> default: Booting VM...
|
||||||
|
==> default: Waiting for machine to boot. This may take a few minutes...
|
||||||
|
default: SSH address: 127.0.0.1:2222
|
||||||
|
default: SSH username: vagrant
|
||||||
|
default: SSH auth method: private key
|
||||||
|
==> default: Machine booted and ready!
|
||||||
|
==> default: Checking for guest additions in VM...
|
||||||
|
default: No guest additions were detected on the base box for this VM! Guest
|
||||||
|
default: additions are required for forwarded ports, shared folders, host only
|
||||||
|
default: networking, and more. If SSH fails on this machine, please install
|
||||||
|
default: the guest additions and repackage the box to continue.
|
||||||
|
default:
|
||||||
|
default: This is not an error message; everything may continue to work properly,
|
||||||
|
default: in which case you may ignore this message.
|
||||||
|
==> default: Rsyncing folder: /home/ger/vagrant/ => /vagrant
|
||||||
|
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
|
||||||
|
==> default: flag to force provisioning. Provisioners marked to run always will still run.
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant status
|
||||||
|
Current machine states:
|
||||||
|
|
||||||
|
default running (virtualbox)
|
||||||
|
|
||||||
|
The VM is running. To stop this VM, you can run `vagrant halt` to
|
||||||
|
shut it down forcefully, or you can run `vagrant suspend` to simply
|
||||||
|
suspend the virtual machine. In either case, to restart it again,
|
||||||
|
simply run `vagrant up`.
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant halt
|
||||||
|
==> default: Attempting graceful shutdown of VM...
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant status
|
||||||
|
Current machine states:
|
||||||
|
|
||||||
|
default poweroff (virtualbox)
|
||||||
|
|
||||||
|
The VM is powered off. To restart the VM, simply run `vagrant up`root@ger-xiaomi:~/vagrant# vagrant box add centos/7 --name centos7
|
||||||
|
==> box: Loading metadata for box 'centos/7'
|
||||||
|
box: URL: https://vagrantcloud.com/centos/7
|
||||||
|
The box you're adding has a name different from the name you
|
||||||
|
requested. For boxes with metadata, you cannot override the name.
|
||||||
|
If you're adding a box using `vagrant box add`, don't specify
|
||||||
|
the `--name` parameter. If the box is being added via a Vagrantfile,
|
||||||
|
change the `config.vm.box` value to match the name below.
|
||||||
|
|
||||||
|
Requested name: centos7
|
||||||
|
Actual name: centos/7
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant box add centos/7
|
||||||
|
==> box: Loading metadata for box 'centos/7'
|
||||||
|
box: URL: https://vagrantcloud.com/centos/7
|
||||||
|
This box can work with multiple providers! The providers that it
|
||||||
|
can work with are listed below. Please review the list and choose
|
||||||
|
the provider you will be working with.
|
||||||
|
|
||||||
|
1) hyperv
|
||||||
|
2) libvirt
|
||||||
|
3) virtualbox
|
||||||
|
4) vmware_desktop
|
||||||
|
|
||||||
|
Enter your choice: 3
|
||||||
|
==> box: Adding box 'centos/7' (v1802.01) for provider: virtualbox
|
||||||
|
box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1802.01/providers/virtualbox.box
|
||||||
|
==> box: Successfully added box 'centos/7' (v1802.01) for 'virtualbox'!
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vi Vagrantfile
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant up
|
||||||
|
Bringing machine 'default' up with 'virtualbox' provider...
|
||||||
|
==> default: Importing base box 'centos/7'...
|
||||||
|
==> default: Matching MAC address for NAT networking...
|
||||||
|
==> default: Checking if box 'centos/7' is up to date...
|
||||||
|
==> default: Setting the name of the VM: vagrant_default_1520790415234_40861
|
||||||
|
==> default: Clearing any previously set network interfaces...
|
||||||
|
==> default: Preparing network interfaces based on configuration...
|
||||||
|
default: Adapter 1: nat
|
||||||
|
==> default: Forwarding ports...
|
||||||
|
default: 22 (guest) => 2222 (host) (adapter 1)
|
||||||
|
==> default: Booting VM...
|
||||||
|
==> default: Waiting for machine to boot. This may take a few minutes...
|
||||||
|
default: SSH address: 127.0.0.1:2222
|
||||||
|
default: SSH username: vagrant
|
||||||
|
default: SSH auth method: private key
|
||||||
|
default:
|
||||||
|
default: Vagrant insecure key detected. Vagrant will automatically replace
|
||||||
|
default: this with a newly generated keypair for better security.
|
||||||
|
default:
|
||||||
|
default: Inserting generated public key within guest...
|
||||||
|
default: Removing insecure key from the guest if it's present...
|
||||||
|
default: Key inserted! Disconnecting and reconnecting using new SSH key...
|
||||||
|
==> default: Machine booted and ready!
|
||||||
|
==> default: Checking for guest additions in VM...
|
||||||
|
default: No guest additions were detected on the base box for this VM! Guest
|
||||||
|
default: additions are required for forwarded ports, shared folders, host only
|
||||||
|
default: networking, and more. If SSH fails on this machine, please install
|
||||||
|
default: the guest additions and repackage the box to continue.
|
||||||
|
default:
|
||||||
|
default: This is not an error message; everything may continue to work properly,
|
||||||
|
default: in which case you may ignore this message.
|
||||||
|
==> default: Rsyncing folder: /home/ger/vagrant/ => /vagrant
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant ssh
|
||||||
|
|
||||||
|
[vagrant@localhost ~]$ cat /etc/centos-release
|
||||||
|
CentOS Linux release 7.4.1708 (Core)
|
||||||
|
|
||||||
|
[vagrant@localhost ~]$ exit
|
||||||
|
logout
|
||||||
|
Connection to 127.0.0.1 closed.
|
||||||
|
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant up
|
||||||
|
Bringing machine 'default' up with 'virtualbox' provider...
|
||||||
|
==> default: Checking if box 'centos/7' is up to date...
|
||||||
|
==> default: Clearing any previously set forwarded ports...
|
||||||
|
==> default: Clearing any previously set network interfaces...
|
||||||
|
==> default: Preparing network interfaces based on configuration...
|
||||||
|
default: Adapter 1: nat
|
||||||
|
==> default: Forwarding ports...
|
||||||
|
default: 22 (guest) => 2222 (host) (adapter 1)
|
||||||
|
==> default: Booting VM...
|
||||||
|
==> default: Waiting for machine to boot. This may take a few minutes...
|
||||||
|
default: SSH address: 127.0.0.1:2222
|
||||||
|
default: SSH username: vagrant
|
||||||
|
default: SSH auth method: private key
|
||||||
|
==> default: Machine booted and ready!
|
||||||
|
==> default: Checking for guest additions in VM...
|
||||||
|
default: No guest additions were detected on the base box for this VM! Guest
|
||||||
|
default: additions are required for forwarded ports, shared folders, host only
|
||||||
|
default: networking, and more. If SSH fails on this machine, please install
|
||||||
|
default: the guest additions and repackage the box to continue.
|
||||||
|
default:
|
||||||
|
default: This is not an error message; everything may continue to work properly,
|
||||||
|
default: in which case you may ignore this message.
|
||||||
|
==> default: Rsyncing folder: /home/ger/vagrant/ => /vagrant
|
||||||
|
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
|
||||||
|
==> default: flag to force provisioning. Provisioners marked to run always will still run.
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant status
|
||||||
|
Current machine states:
|
||||||
|
|
||||||
|
default running (virtualbox)
|
||||||
|
|
||||||
|
The VM is running. To stop this VM, you can run `vagrant halt` to
|
||||||
|
shut it down forcefully, or you can run `vagrant suspend` to simply
|
||||||
|
suspend the virtual machine. In either case, to restart it again,
|
||||||
|
simply run `vagrant up`.
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant halt
|
||||||
|
==> default: Attempting graceful shutdown of VM...
|
||||||
|
root@ger-xiaomi:~/vagrant# vagrant status
|
||||||
|
Current machine states:
|
||||||
|
|
||||||
|
default poweroff (virtualbox)
|
||||||
|
|
||||||
|
The VM is powered off. To restart the VM, simply run `vagrant up`
|
Loading…
Reference in New Issue
Block a user