centos7安装
- 使用vagrant安装centos
#box源地址 http://www.vagrantbox.es/ #添加box vagrant box add centos7_2 vagrant-centos-7.2.box #初始化 vagrant init centos7_2 #配置Vagrantfile config.vm.network "private_network", ip: "192.168.56.100" #启动虚拟机 vagrant up # ifconfig安装 sudo yum install net-tools
- ssh服务配置
vim /etc/ssh/sshd_config PasswordAuthentication yes PermitRootLogin参数值为yes service sshd restart
- 多台服务同时启动配置
Vagrant.configure("2") do |config| config.vm.box = "centos7" config.vm.define :master do |master| master.vm.hostname = "192.168.56.100" master.vm.provider :virtualbox do |v| v.memory = 2048 v.cpus = 4 end master.vm.network :private_network, ip: "192.168.56.100" end (1..2).each do |i| config.vm.define "node#{i}" do |node| node.vm.hostname = "192.168.56.10#{i}" node.vm.provider :virtualbox do |v| v.memory = 1024 v.cpus = 2 end node.vm.network :private_network, ip: "192.168.56.10#{i}" end end end
网友评论