windows10環境下 vagrant+virtualBox配置centos7


vagrant版本 :vagrant_2.2.7_x86_64(安裝完畢需要重啟電腦)

virtualBox版本: VirtualBox-6.0.18-136238-Win

CentOS版本:  centos-7.0-x86_64.box  下載地址(使用迅雷下載到本地): http://www.vagrantbox.es/  

 

CMD 命令 使用:

vagrant box add {title} {url}
{title} 為虛擬機名稱
{url} 本地box文件地址

vagrant init    初始化你的虛擬環境

初始化后加 虛擬機名可能初始化不成功,需要注意,並且報錯:

`Vagrantfile` already exists in this directory. Remove it before running `vagrant init`.

所以直接使用: vagrant init 命令。

再啟動:

vagrant up    開啟你的虛擬環境

啟動會報錯:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'base' (v0) for provider: virtualbox
    default: Downloading: base
    default:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Couldn't open file C:/Users/Fhmb/base

原因是在使用vagrant init命令初始化配置文件的時候未指定虛擬機名稱:

解決辦法:

1.再來一遍,重新生成Vagrantfile配置文件(使用了貌似不好用,{title} 為虛擬機額名稱)

vagrant init {title} 

2.修改Vagrantfile文件中config.vm.box參數:

config.vm.box = "base" 

即 base 改為你自己命名的虛擬機名稱 ;

再啟動:

vagrant up    開啟你的虛擬環境

啟動成功並顯示在virtualBox:

 

 

https://blog.csdn.net/qq_36750158/article/details/84848548

https://blog.csdn.net/lxw1844912514/article/details/100028772

感謝以上博主借鑒經驗。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM