vagrant init centos7 https://mirrors.ustc.edu.cn/centos-cloud/centos/7/vagrant/x86_64/images/CentOS-7-x86_64-Vagrant-1811_02.VirtualBox.box初始化方式2: box文件下载到本地, 初始化
vagrant box add ../CentOS-7-x86_64-Vagrant-1811_02.VirtualBox.box --name centos7 vagrant box listVagrantfile
为master-01/node-01/node-02三个节点分别在文件夹中执行
vagrant init centos7
修改Vagrantfile内容分别如下
Vagrant.configure("2") do |config| config.vm.box = "centos7" config.vm.hostname = "master1" config.vm.synced_folder "./", "/vagrant" # config.vm.network "private_network", ip: "192.168.56.50" config.vm.network "public_network", ip: "192.168.1.50" config.vm.provider "virtualbox" do |v| #分配资源 v.memory = 2048 v.cpus = 2 end end
Vagrant.configure("2") do |config| config.vm.box = "centos7" config.vm.hostname = "node1" config.vm.synced_folder "./", "/vagrant" # config.vm.network "private_network", ip: "192.168.56.51" config.vm.network "public_network", ip: "192.168.1.51" config.vm.provider "virtualbox" do |v| #分配资源 v.memory = 2048 v.cpus = 2 end end
Vagrant.configure("2") do |config| config.vm.box = "centos7" config.vm.hostname = "node2" config.vm.synced_folder "./", "/vagrant" # config.vm.network "private_network", ip: "192.168.56.52" config.vm.network "public_network", ip: "192.168.1.52" config.vm.provider "virtualbox" do |v| #分配资源 v.memory = 2048 v.cpus = 2 end end
之后分别执行
vagrant up vagrant ssh
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)