zoukankan      html  css  js  c++  java
  • vagrant入门


    introduce:
      https://www.vagrantup.com/intro/index.html

    get started
        https://www.vagrantup.com/intro/getting-started/index.html
        $ vagrant init hashicorp/precise64
        $ vagrant up

    Project Setup
        https://www.vagrantup.com/intro/getting-started/project_setup.html
        $ mkdir vagrant_getting_started
        $ cd vagrant_getting_started
        $ vagrant init hashicorp/precise64

    Boxes
        https://www.vagrantup.com/intro/getting-started/boxes.html
        $ vagrant box add hashicorp/precise64

        Open the Vagrantfile and change the contents to the following
        Vagrant.configure("2") do |config|
          config.vm.box = "hashicorp/precise64"
          config.vm.box_version = "1.1.0"
        end

        Vagrant.configure("2") do |config|
          config.vm.box = "hashicorp/precise64"
          config.vm.box_url = "https://vagrantcloud.com/hashicorp/precise64"
        end

        Discover Vagrant Boxes
        https://vagrantcloud.com/boxes/search


    Up And SSH
        https://www.vagrantup.com/intro/getting-started/up.html
        $ vagrant up
        $ vagrant ssh


    Synced Folders
        https://www.vagrantup.com/intro/getting-started/synced_folders.html

        By default, Vagrant shares your project directory (remember, that is the one with the Vagrantfile) to the /vagrant directory in your guest machine.

    Provisioning
        https://www.vagrantup.com/intro/getting-started/provisioning.html
         Installing Apache
        bootstrap.sh
        #!/usr/bin/env bash

        apt-get update
        apt-get install -y apache2
        if ! [ -L /var/www ]; then
          rm -rf /var/www
          ln -fs /vagrant /var/www
        fi

        Vagrantfile
        Vagrant.configure("2") do |config|
          config.vm.box = "hashicorp/precise64"
          config.vm.provision :shell, path: "bootstrap.sh"
        end

         vagrant up to create your machine and Vagrant will automatically provision it.
         If the guest machine is already running from a previous step, run vagrant reload --provision

         so that you can use your own browser to access the guest machine.

    Networking
        https://www.vagrantup.com/intro/getting-started/networking.html
        use Vagrant's networking features to give us additional options for accessing the machine from our host machine.
        Port Forwarding

        Vagrant.configure("2") do |config|
          config.vm.box = "hashicorp/precise64"
          config.vm.provision :shell, path: "bootstrap.sh"
          config.vm.network :forwarded_port, guest: 80, host: 4567
        end

        Run a vagrant reload or vagrant up (depending on if the machine is already running) so that these changes can take effect.

        Other Networking
        https://www.vagrantup.com/docs/networking/

    Share
        https://www.vagrantup.com/intro/getting-started/share.html

    Teardown
        https://www.vagrantup.com/intro/getting-started/teardown.html
        vagrant suspend
        vagrant halt
        vagrant destroy




  • 相关阅读:
    NET打包時加入卸载功能
    c#水晶报表注册码
    sqlserver:某年份某月份 是否在某时间段内的函数
    修改KindEditor编辑器 版本3.5.1
    Flash大文件上传(带进度条)
    让.Net程序脱离.net framework框架运行的方法(转载)
    夏天到了,什么时候园子的T恤可以出来?
    VS2005项目的安装与布署
    解决Select覆盖Div的简单直接的方法
    .Net向Page和UpdatePanel输出JS
  • 原文地址:https://www.cnblogs.com/pascal1000/p/10851280.html
Copyright © 2011-2022 走看看