/vagrant

统一开发环境

Primary LanguageBatchfileApache License 2.0Apache-2.0

#https://github.com/mcc1874/vagrant

前置条件

下载对应的box放到对应目录:

将后缀为example的copy一份并去掉后缀,

  • bootstrap.sh.example => bootstrap.sh

  • Vagrantfile.example => Vagrantfile

  • 1.安装

  • 2.启动(如失败请重新启动)

  • 3.链接虚拟机(IP配置:Vagrantfile)

  • ssh ip:22 vagrant/vagrant

全自动制作box,请看packer

vagrant 安装查件慢

类似 vagrant plugin install 查件名 --plugin-clean-sources --plugin-source https://gems.ruby-china.com

如何共享本地环境

···

Vagrant Share允许您与世界上的任何人共享您的Vagrant环境,只

需一个命令即可在几乎任何网络环境中直接在您的Vagrant环境中进行协作: vagrant share。

方法2 ngrok http --region ap --host-header=rewrite 本机虚拟域名:80

hosts 10.10.10.11 本机虚拟域名 ···

公共box仓库

如果使用官方box, 请把Vagrantfile的 config.ssh.password/config.ssh.insert_key 删除, 此时会默认private_key登录并生成private_key.
使用xshell登录客户端时, private_key存储在 .vagrant\machines\主机名\virtualbox\private_key