Ubuntu 18.04 安装 vagrant & VirtualBox

在 Ubuntu 18.04 环境下,安装 vagrant 十分简单,只需执行以下命令: 

# apt install virtualbox -y
# wget -c https://releases.hashicorp.com/vagrant/2.0.3/vagrant_2.0.3_x86_64.deb
# dpkg -i vagrant_2.0.3_x86_64.deb
# vagrant plugin install vagrant-vbguest

验证是否安装成功:

去官方网站下载一个 box 镜像,http://www.vagrantbox.es/

比如我这里使用:

Ubuntu 14.10(https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/14.10/ubuntu-14.10-amd64.box

# vagrant box add ubuntu1404 file:///opt/boxes/ubuntu-14.10-amd64.box
# vagrant init ubuntu1404 
# vagrant up

登录到虚拟机

# vagrant ssh

查看虚拟机,停止和删除虚拟机

# vagrant global-status
# vagrant halt <ID>
# vagrant destroy <ID>

错误处理:

1.  虚拟机启动超时

     Timed out while waiting for the machine to boot. This means that (Vagrant::Errors::VMBootTimeout)

     检查你的机器是否开启了 CPU 虚拟化 VT-x/AMD-V

2.  挂载共享目录失败

     Vagrant was unable to mount VirtualBox shared folders. This is usually (Vagrant::Errors::VirtualBoxMountFailed)

     执行:vagrant plugin install vagrant-vbguest

3.  插件安装失败

     Bundler, the underlying system Vagrant uses to install plugins,
     reported an error. The error is shown below. These errors are usually
     caused by misconfigured plugin installations or transient network
     issues. The error from Bundler is:

     conflicting dependencies fog-core (~> 1.43.0) and fog-core (= 1.45.0)
       Activated fog-core-1.45.0
       which does not match conflicting dependency (~> 1.43.0)

       Conflicting dependency chains:
         fog-core (= 1.45.0), 1.45.0 activated

       versus:
         vagrant-libvirt (> 0), 0.0.41 activated, depends on
         fog-core (~> 1.43.0)

      不要直接使用 apt install vagrant 安装,默认版本会有依赖冲突!!!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值