win10安装vagrant虚拟新手指南

 了解

vagrant简介 - 我没有领悟 - 博客园 (cnblogs.com)icon-default.png?t=N7T8https://www.cnblogs.com/marshhu/p/11880784.html

  1. 下载适配版本 首先需要安装虚拟机vitualbox(Oracle VM VirtualBox icon-default.png?t=N7T8https://www.virtualbox.org/) 然后 vagrant官网下载(Install | Vagrant | HashiCorp Developericon-default.png?t=N7T8https://www.vagrantup.com/downloads.html
  2. 镜像资源推荐国内 清华大学开源软件镜像站 | Tsinghua Open Source Mirroricon-default.png?t=N7T8https://mirrors.tuna.tsinghua.edu.cn/
  3. 选择自己所需要的镜像资源 小编这边使用ubuntu 在AOSP | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirroricon-default.png?t=N7T8https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/ 选择ubuntu寻找自己做需要的版本
  4. 然后根据以上选择自己的版本 下载地址 Index of /ubuntu-cloud-images/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirroricon-default.png?t=N7T8https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/
  5. 小编这边使用.box结尾的文件 大家自行所需选择
  6. 以下是虚拟机部署ubuntu
  7. 加载镜像有两种方式,大家可自行选择
    # 以下是ubuntu20.24展示
    
    # name = ubuntu20.24
    
    # 第一种 
    
    vagrant init {name} https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cloud-images/jammy/20240110/jammy-server-cloudimg-amd64-vagrant.box
    
    # 第二种 先把box包下载至本地后加载,path = E:\下载\ubuntu\文件名
    
    Vagrant box add {name} {path}
    
    Vagrant init {name}
    
    # 运行
    
    vagrant up
  8. 成功后配置 配置文件Vagrantfile

    # 网络配置
    
    config.vm.network "public_network"
    
    # 文件夹同步
    
    ###
    centos
    config.vm.synced_folder "E:\\project", "/home/vagrant/wwwroot",create: true,owner: "vagrant", group: "vagrant", mount_options: ["dmode=777", "fmode=777"]
     
    ###
    ubunta18
    config.vm.synced_folder "E:\\project", "/home/vagrant/wwwroot",create: true, owner:"www-data", group: "www-data"
  9. 以下是出现的报错(不全面)

    vagrant up 出现default: Warning: Authentication failure. Retrying...
    vi /etc/ssh/sshd_config
    PermitRootLogin yes
    PasswordAuthentication yes
    systemctl restart sshd
    vagrant reload
    出现umount: /mnt: not mounted.
    以上的问题是因为虚拟机没有装VBoxGuestAdditions,(增强组件)
     
    ubuntu系统处理方案
    sudo apt-get update && sudo apt-get install virtualbox-guest-utils
     
    centos系统处理方案
    sudo yum update && sudo yum install kernel-devel
  10. vagrant和vitrulBox创建虚拟机后使用xshell连接vagrant和vitrulBox创建虚拟机后使用xshell连接_xshell连接vagrant-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/qq_41793064/article/details/107518577
  11. 或使用密钥登陆 查看ssh配置
    vagrant ssh-config 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值