-
Notifications
You must be signed in to change notification settings - Fork 9
Mac下安装vagrant
youngperson edited this page Aug 27, 2018
·
5 revisions
mac下安装virtualBox + vagrant
1、下载centos7 64位的box
# wget https://vagrantcloud.com/geerlingguy/boxes/centos7/versions/1.2.3/providers/virtualbox.box
2、将下载的镜像box 添加到Vagrant
# cd /vagrant/lnmp01
# vagrant box add centos1 /vagrant/CentOS-7-x86_64.box
3、初始化开发环境
# vagrant init centos1
4、配置文件Vagrantfile(设置ip和内存)
config.vm.box = "centos1"(ps:默认为base,多个配置文件这里不能重名)
config.vm.network "private_network", ip: "192.168.44.10"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024" //这里就是修改后内存的大小,可以根据自己的需要进行修改
end
5、常用命令
vagrant up # 启动虚拟机
vagrant halt # 关闭虚拟机
vagrant reload # 重启虚拟机
vagrant ssh # SSH 至虚拟机
vagrant status # 查看虚拟机运行状态
vagrant destroy # 销毁当前虚拟机