vagrant的好处就不多说了,也不知道是人品问题还是啥,同事电脑上相同版本啥问题没有,我就不行,于是重新来过一遍,顺便把一些坑记录一下
安装+启动的命令如下(均在Windows下命令行中进行):
- vagrant box add 虚拟机名 虚拟机绝对地址:添加一个虚拟机
- vagrant box list :查看可用的虚拟机
- vagrant init 虚拟机名:初始化指定的虚拟机
- vagrant up:启动虚拟机
- vagrant ssh:使用ssh连接
- vagrant box remove 虚拟机名:删除指定虚拟机
以下是一些坑:
一:No usable default provider could be found for your system
是下载,可以直接从官网下载,网速可能会比较慢,文末会贴出百度网盘地址(如果失效了可以私我),注意版本一定要对应,不然就有可能出现以下错误
当然,引起这个错误的可能不止这一种,按字面来看的话,也有可能是你犯了低级错误,没有安装virtual Box导致的
二:kernel panic -not syncing:Fatal exception
版本过低的话也有可能有错误,错误如下
当然可能还有其他解决办法,但是这种直接升级一下版本还是比较方便的
三:An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again.
这个主要就是自己粗心导致的,在对虚拟机进行初始化的时候没有指定哪一个虚拟机,也就是在执行vargrant init 这个命令的时候后面没有跟指定的虚拟机名
C:\Vagrant>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 /D:/WorkSpace/Vagrant/base
最后运行结果:
nice!!!
$ vagrant init # 初始化
$ vagrant up # 启动虚拟机
$ vagrant halt # 关闭虚拟机
$ vagrant reload # 重启虚拟机
$ vagrant ssh # SSH 至虚拟机
$ vagrant suspend # 挂起虚拟机
$ vagrant resume # 唤醒虚拟机
$ vagrant status # 查看虚拟机运行状态
$ vagrant destroy # 销毁当前虚拟机
#box管理命令
$ vagrant box list # 查看本地box列表
$ vagrant box add # 添加box到列表
$ vagrant box remove # 从box列表移除
以下是网盘链接
vagrant_2.2.8:
链接:https://pan.baidu.com/s/10F-yuMsoyavwiMyumvjYsw
提取码:extw
复制这段内容后打开百度网盘手机App,操作更方便哦
VirturalBox_6.1.6
链接:https://pan.baidu.com/s/1vZ4Q7HMHtqA6pqJTuOwARQ
提取码:7ude
复制这段内容后打开百度网盘手机App,操作更方便哦