• Vagrant 创建虚拟环境


    1. 添加box

    vagrant box add --name centos6.8/cms boxname.box

    2.初始化admin环境

    vagrant init centos6.8/cms admin

    3.启动环境

    vagrant up

    vagrantfile配置文件设置

    # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    Vagrant.configure("2") do |config|
      #BOX名称
      config.vm.box = "centos6.8/cms"
    
      #端口转发
      config.vm.network "forwarded_port", guest: 80, host: 80
      config.vm.network "forwarded_port", guest: 22, host: 2222
      config.vm.network "forwarded_port", guest: 3306, host: 3306
      config.vm.network "forwarded_port", guest: 6790, host: 6790
      config.vm.network "forwarded_port", guest: 6454, host: 6454
    
      #vagrant中虚拟环境名称
      config.vm.box_url = "admin"
    
      #vagrant中指定虚拟环境配置
      config.vm.define :admin do |ad|
        #目录共享 主机目录,虚拟机目录
        # ad.vm.synced_folder "www", "/data/www"
        #禁用vagrant的默认共享目录
        ad.vm.synced_folder ".", "/vagrant", disabled:false 
         
        #虚拟机配置
        ad.vm.provider "virtualbox" do |vb|
          #指定vm-name,也就是virtualbox管理控制台中的虚机名称
          vb.name = "cms_all_centos6.8"
          # vagrant up启动时,是否自动打开virtual box的窗口,缺省为false
          vb.gui = false
          #指定vm内存,单位为MB
          vb.memory = "1024"
          #设置CPU个数
          vb.cpus = 2
        end
      end
    
      #SSH验证
      config.ssh.username = "vagrant"
      config.ssh.private_key_path = "./id_rsa"
    
    end
     
    ...
    ...
     
     
    ...
    ...
     
     
    ...
    ...
     
  • 相关阅读:
    cmd ora12560协议适配器错误
    WinPEter制作U盘启动盘
    KERNEL_SECURITY_CHECK_FAILURE
    Linux系统下关闭与启动Oracle11g的顺序与命令
    oracle口令文件在windows和linux系统下的命名和位置
    战士倒下了
    手游中第三方的登陆和支付总结
    诡异的循环
    关于空类的继承的问题
    C++的缺陷指针
  • 原文地址:https://www.cnblogs.com/GNblog/p/8427511.html
Copyright © 2020-2023  润新知