Agent installation acceleration
export http_ proxy=http://127.0.0.1:1087;export https_ proxy=http://127.0.0.1:1087;
brew cask install virtualbox vagrant vagrant-manager
==>Installer: the install failed. Contact the software manufacturer for assistance. )
Error: Command failed to execute!
Use of vagrant
| || |
| || |
| || |
| || |
| || |
| || |
| || |
| || |
cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) getconf LONG_ BIT 64
vagrant box list There are no installed boxes! Use `vagrant box add` to add some.
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' (v1803.01) for provider: virtualbox box: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1803.01/providers/virtualbox.box ==> box: Successfully added box 'centos/7' (v1803.01) for 'virtualbox'!
vagrant box list centos/7 (virtualbox, 1803.01)
cd ~ mkdir Vagrant && cd Vagrant mkdir centos7 && cd centos7
vagrant init centos/7 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. ll total 8 -rw-r--r-- 1 air staff 2.9K 4 12 10:55 Vagrantfile
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: centos7_ default_ 1523501887980_ 60805 ==> 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: /Users/air/Vagrant/centos7/ => /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`.
Virtual machine usage
vagrant ssh -bash: warning: setlocale: LC_ ALL: cannot change locale (zh_ CN.UTF-8) -bash: warning: setlocale: LC_ ALL: cannot change locale (zh_ CN.UTF-8) /bin/sh: warning: setlocale: LC_ ALL: cannot change locale (zh_ CN.UTF-8) [vagrant@localhost ~]$
sudo echo "LC_ ALL=zh_ CN.UTF-8" >> /etc/environment sudo echo "zh_ CN.UTF-8 UTF-8" >> /etc/locale.gen sudo echo "LANG=zh_ CN.UTF-8" > /etc/locale.conf sudo localedef -v -c -i zh_ CN -f UTF-8 zh_ CN.UTF-8
vagrant ssh Last login: Thu Apr 12 03:53:37 2018 from 10.0.2.2 [vagrant@localhost ~]$ cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
Virtual machine shutdown
vagrant halt ==> default: Attempting graceful shutdown of VM...
vagrant status Current machine states: default poweroff (virtualbox) The VM is powered off. To restart the VM, simply run `vagrant up`
brew cask reinstall vagrant # this might take a long time vagrant plugin update