(需先安裝virtuabox,vagrant)
1.下載centos 7 鏡像,vagrant box add ceshi 鏡像名 或者是使用先前vagrant package出來的box,進行加載鏡像操作
2.vagrant init vagrant up 3.配置網絡,修改Vagrantfile config.vm.network "private_network", type: "dhcp" 。dhcp模式下會自動生成ip
config.vm.box = "test" 4.virtualbox中關閉對應虛擬機,設置網絡{網卡1:NAT轉換,網卡2:host-only}
5.設置Virtualbox 中工具,對應網卡開啟dhcp
6.vagrant reload 重啟虛擬機,vagrant ssh (bash下)連接到服務器。
7.修改 /etc/ssh/sshd_config中,PasswordAuthentication=yes. 然后還需要重啟sshd serice,不然無法通過ssh連接
8.ip address(centos 7中不支持ifconfig) 查看centos ip地址信息,並以ip地址+22端口遠程連接ssh