1. 程式人生 > >vagrant在windows下的安裝和配置

vagrant在windows下的安裝和配置

eas 官網 with sta .com 處理器 mac val rim

記錄一下安裝和配置過程中的一些坑
步驟一
分別下載vagrant和VirtualBox,我這裏下載的是vagrant_1.9.1.msi 和 VirtualBox-5.1.14-112924-Win.exe

步驟二
這兩個東東安裝好之後,我在e盤創建了一個myvagrant目錄,作為工程目錄,進入該目錄,進行添加box

技術分享圖片

其中centos7.0是自定義的box的名字,後面是本地box的路徑

添加完後 vagrant init cento7.0然後就會在myvagrant目錄下生成一個vagrantfile文件

技術分享圖片

技術分享圖片

然後打開這個文件,修改一下這裏

技術分享圖片

技術分享圖片

=================================================

配置好後,輸入vagrant up

技術分享圖片

這樣就啟動成功了。

坑一:
就是在vagrant up的時候出現如下錯誤
If the provider you‘re using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you‘re using VirtualBox, run `vagrant up` while the

VirtualBox GUI is open.

The primary issue for this error is that the provider you‘re using
is not properly configured. This is very rarely a Vagrant issue.

然後在stackoverflow看了答案,跟著改了還是無果,最後我卸載掉原來安裝好的virtualbox,然後去官網下載最新的virtualbox,版本是VirtualBox-5.1.14-112924-Win.exe
然後在vagrant up的時候這個錯誤就消失了,virtualbox版本的原因

坑二:

If you‘re using a custom box, make sure that networking is properly
working and you‘re able to connect to the machine. It is a common
problem that networking isn‘t setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

因為配置的時候開啟了調用virtualbox可視化界面,所以出現這個提示的時候,virtualbox那也會彈出一個警告
VT-x/AMD-V硬件加速在您的系統中不可用。您的64-位虛擬機將無法檢測到 64-位處理器,從而無法啟動。

在網上找到解決辦法是重啟按f2進入bios設置,然後開啟虛擬化支持,然後保存,重新啟動,這個時候再用vagrant up就成功了。

vagrant在windows下的安裝和配置