vagrant搭建centos7

  • vagrant搭建centos7已关闭评论
  • 94 次浏览
  • A+
所属分类:linux技术
摘要

准备工作安装1.vagrant init 初始化生成Vagrantfile文件
修改生成的Vagrantfile文件
config.vm.box = “centos/7”
config.vm.network “public_network”
config.vm.provider “virtualbox” do |vb|
vb.memory = “3000”
vb.name= “yyb-centos7”
vb.cpus= 2
end
2. vagrant box add centos/7 D:/box/virtualbox.box 添加box
3. vagrant box list 查看本地box
4. vagrant up 启动
5. vagrant status 查看
6. vagrant halt 停止

准备工作

  1. 下载安装vagrant
    https://releases.hashicorp.com/vagrant/2.3.4/vagrant_2.3.4_windows_amd64.msi
    选择自己需要的版本傻瓜式安装
  2. 下载安装vartualbox
    https://download.virtualbox.org/virtualbox/6.1.42/VirtualBox-6.1.42-155177-Win.exe
    选择自己需要的版本傻瓜式安装
  3. 下载centos对应的box
    https://vagrantcloud.com/search

安装

1.vagrant init 初始化生成Vagrantfile文件
修改生成的Vagrantfile文件
config.vm.box = "centos/7"
config.vm.network "public_network"
config.vm.provider "virtualbox" do |vb|
vb.memory = "3000"
vb.name= "yyb-centos7"
vb.cpus= 2
end
2. vagrant box add centos/7 D:/box/virtualbox.box 添加box
3. vagrant box list 查看本地box
4. vagrant up 启动
5. vagrant status 查看
6. vagrant halt 停止

访问centos

  1. vagrant ssh 进入centos
  2. 通过root账号登录
    sudo -i 切换到root
    ip a 查看IP信息
    开启root 账号密码登录
    vi /etc/ssh/sshd_config
    PasswordAuthentication yes
    passwd 123456 修改root账号登录密码为123456
    systemctl restart sshd 重启sshd服务