markdown virtualbox_and_vagrant_on_windows.md

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown virtualbox_and_vagrant_on_windows.md相关的知识,希望对你有一定的参考价值。

https://www.lifewire.com/run-ubuntu-within-windows-virtualbox-2202098
# virtualbox and vangrant on windows 7 SP1

1. install virtualbox - https://www.virtualbox.org/wiki/Downloads
2. install vagrant (requires restart) - https://www.vagrantup.com/downloads.html
3. create directory where virtual hosts - C:/Users/Josh/virtualmachines
4. discover vagrant boxes - https://app.vagrantup.com/boxes/search
5. install box, e.g., `vagrant box add ubuntu/trust64`
6. create folder for box and initial new vagrant inside it.

```
cd /c/Users/Josh/virtualmachines
mkdir ubuntu
cd ubuntu
vagrant init ubuntu/trusty64
```

7. start up vagrant box - `vagrant up` 

Had to enable virtualization in bios cpu settings (see notes below)

8. ssh into virtual machine - `vagrant ssh` 

If no prompt, must tell Vagrant to prefer your system tools with the VAGRANT_PREFER_SYSTEM_BIN environment variable (https://github.com/hashicorp/vagrant/issues/9143)

`VAGRANT_PREFER_SYSTEM_BIN=1 vagrant ssh`

or put this into your .bash_profile:

`export VAGRANT_PREFER_SYSTEM_BIN=1`

9. Shut down or destroy virtual maching - `vagrant halt` and `vagrant destroy`

10. Get Help and Learn more

[Vagrant Docs](https://www.vagrantup.com/docs/index.html)
[Vagrant CLI](https://www.vagrantup.com/docs/cli/)
IRC: #vagrant on Freenode

---

* `vagrant up` hangs, updating powershell as a fix (see https://github.com/hashicorp/vagrant/issues/8777) Now hangs at ssh auth method: private key. Try following fixes:

Tried adding following line to Vagrantfile (https://github.com/hashicorp/vagrant/issues/8157)

```
config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", id: 'ssh'
```

Didn't work. Tried adding following block to Vagrantfile (https://github.com/hashicorp/vagrant/issues/8157)

```
config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
  end
```

Didn't work. Tried the following (https://github.com/puphpet/puphpet/issues/2462)

1. Uninstall "Web Companion". On Windows, go to Control Panel->Programs and Features and find it in the list. Select and click Uninstall
2. Open a command prompt as Administrator and run: netsh winsock reset
3. Reboot your PC
4. Remove the DLL's it was trying to load. They should be located in located in two locations

C:\Windows\System32\LavasoftTcpService.dll
C:\Windows\SysWOW64\LavasoftTcpService.dll

Note: There were also two similarly named .ini files. I removed them as well but that isn't strictly necessary

5. vagrant up --provision
6. With any luck, this was your issue and the vagrant guest will now be able to ssh into the box during provisioning to setup your environment

Didn't work, No Web companion installed. Try running windows update. Didn't work.

**Finally fixed by enabling virtualization in bios cpu setting!!!**

https://www.howtogeek.com/213795/how-to-enable-intel-vt-x-in-your-computers-bios-or-uefi-firmware/

---
https://www.vagrantup.com/docs/installation/
https://medium.com/@JohnFoderaro/how-to-set-up-a-local-linux-environment-with-vagrant-163f0ba4da77
https://www.taniarascia.com/what-are-vagrant-and-virtualbox-and-how-do-i-use-them/

以上是关于markdown virtualbox_and_vagrant_on_windows.md的主要内容,如果未能解决你的问题,请参考以下文章

转换rst到markdown总结

markdown [Markdown HowTo]作为Markdown语法的秘籍

python markdown干啥用的

markdown前端渲染

如何用markdown生成目录

markdown排版示例