背景
之前研究过 vagrant ,但由于历史久远,重新翻起来,又忘记了,所以这次打算做一个简短的笔记。
为什么要用到Vagrant?
1、Vagrant is a tool for building and managing virtual machine environments in a single workflow.
Vagrant是一种在单个工作流程中构建和管理虚拟机环境的工具。
说白了,就是用来管理虚拟机环境的工具,不需要再手动的在虚拟机上创建虚拟环境。
2、Other members of your team create their development environments from the same configuration, so whether you are working on Linux, Mac OS X, or Windows, all your team members are running code in the same environment, against the same dependencies, all configured the same way.
统一的 运行环境
如何使用Vagrant?
The getting started guide will use Vagrant with VirtualBox
Vagrant can work with a wide variety of backend providers, such as VMware, Hyper-V, and more .
1、Vagrant运行于虚拟机之上,所以必须下载系统对应的虚拟机,这里以 Oracle VirtualBox 为例说明:
下载地址:https://www.virtualbox.org/
2、install the latest version of Vagrant 下载最新版本的Vagrant
3、查看安装版本 : vagrant -v
4、vagrant 有个Box的概念,
Vagrant uses a base image to quickly clone a virtual machine. These base images are known as "boxes" in Vagrant
查看已经存在的box列表:vagrant box list
boxes 提供列表:https://app.vagrantup.com/boxes/search
点击进去任意一个,有使用说明:
例如:
vagrant init ubuntu/trusty64 vagrant up
经过以上命令 其实 你已经启动了一个 虚拟的环境,通过以下命令可以直接连上去:
vagrant ssh
OK,至此,你就拥有了一个初始化好的 ubuntu或者centos 系统环境了,接下来你可以为所欲为了。更多关于网络配置,可以参考官方说明:
网友评论