https://www.virtualbox.org/wiki/Downloads
https://www.vagrantup.com/downloads
https://app.vagrantup.com/centos/boxes/7/versions/2004.01
vagrant box add centos/7 D:\Centos\virtualbox.box
# 查看添加情况
vagrant box list
vagrant init
config.vm.box = "centos/7"
config.vm.network "public_network"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.name = "first-docker-centos7"
vb.cpus = 2
end
vagrant up
vagrant ssh
sudo -i
# 配置远程登录
vi /etc/ssh/sshd_config
# 注释PasswordAuthentication no
# 放开注释PasswordAuthentication yes
# 修改密码
passwd
# 重启ssh
systemctl restart sshd
vagrant halt
# 查看centos状态
vagrant status
# 删除centos
vagrant destroy
# 修改了vagrantfile,使运行中的centos生效
vagrant reload
# 退出虚拟机
vagrant halt
# 打包
vagrant package --output xxxx.box
# 其他环境中添加box
vagrant box add xxxx D:\xxx.box
# 初始化,得到vagrantfile
vagrant init
# 启动
vagrant up
# !!!可得到和之前一样的环境,但是网络需要重新配置
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/MadLifeBin/article/details/126097018
内容来源于网络,如有侵权,请联系作者删除!