栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Vagrant数据迁移

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Vagrant数据迁移

文章目录
    • 数据导出(旧电脑)
    • 数据导入(新电脑)
      • 1. 前置配置
        • 规划目录
        • 目录示例
      • 2. 添加Box
      • 3. 初始化工作环境,生成Vagrantfile
        • 配置Vagrantfile
      • 4. 启动虚拟机
        • 共享目录问题
    • 迁移测试
    • 常用命令

将虚拟机环境从一台电脑迁移到另一台电脑

数据导出(旧电脑)

进入VirtualBox安装目录,cmd执行vboxmanage list vms
查看已经安装的虚拟机

进入到VirtualBox默认虚拟电脑位置


执行vagrant package --base 使用vboxmanage list vms查到的名字 --output 别名

数据导入(新电脑) 1. 前置配置 规划目录
  1. 把.vagrant.d移出系统盘

将.vagrant.d文件夹移动到其他盘
设置环境变量VAGRANT_HOME为.vagrant.d目录
在path环境变量下添加%VAGRANT_HOME%

  1. 配置VirtualBox默认虚拟机位置

目录示例

2. 添加Box

3. 初始化工作环境,生成Vagrantfile

之后启动虚拟机的命令需要在该目录下执行

配置Vagrantfile

修改Vagrantfile文件的config.vm.network配置
如何确定ip,查看Windows IP 配置

查看box列表,修改config.vm.box为相应名称


在Vagrantfile中的config.vm.box这一行下添加

config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
config.ssh.insert_key = false
4. 启动虚拟机


共享目录问题

Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem “vboxsf” is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

mount: unknown filesystem type ‘vboxsf’

安装插件
https://github.com/scotch-io/scotch-box/issues/296

vagrant plugin  install  vagrant-vbguest


再次vagrant up报错

Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem “vboxsf” is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

迁移测试

数据库连接测试

迁移成功!

常用命令

查看box:vagrant box list

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1007283.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号