最近学个DEVOPS2.0,讲微服务,容器华,持续部署,很到位,就一个一个工具撸一撸。。。

vagrant,以前接触过,所以上手快,,哈哈,,用时再具体配置。

virtualbox的。

基本命令:

#提前下载好的box文件,~/box/precise64.box,我们给这个box命名为ubuntu12.04
vagrant box add ubuntu12.04 ~/box/precise64.box
#box文件也可以是远程地址 base 为默认名称
#vagrant box add base http://files.vagrantup.com/lucid64.box
#打开目录
#cd ~/vagrant/work
#初始化
vagrant init
#如果你添加的box名称不是base,那么需要在初始化的时候指定名称,例如
vagrant init ubuntu12.04
vagrant up
vagrant ssh
vagrant reload
vagrant package
vagrant  -h

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "hashicorp/precise64"
  config.vm.provision :shell, path: "bootstrap.sh"
  config.vm.network :forwarded_port, guest: 80, host: 4567

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   apt-get update
  #   apt-get install -y apache2
  # SHELL
end

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

vagrant,流浪汉,我又来啦。的更多相关文章

  1. Mac OS 使用 Vagrant 管理虚拟机(VirtualBox)

    Vagrant(官网.github)是一款构建虚拟开发环境的工具,支持 Window,Linux,Mac OS,Vagrant 中的 Boxes 概念类似于 Docker(实质是不同的),你可以把它看 ...

  2. vagrant打造自己的开发环境

    vagrant打造自己的开发环境 缘由: 在网上看到斌哥,爽神都写了关于vagrant的博客,都在说很强大,所以很好奇这玩意怎么个强大,然后也就自己来一发玩玩看看. 真实缘由: 说实话是电脑配置太低, ...

  3. 征服诱人的Vagrant!

    一.背景 ​ 最近要开始深入学习分布式相关的东西了,那第一步就是在自己的电脑上安装虚拟机,以前在Windows平台,我选择用VMware Workstation作为虚拟机软件,现在在Mac系统下,感觉 ...

  4. VitrualBox、vagrant、homestead的关系

    VitrualBox 是一款非常强大的免费虚拟机软件,使用者可以在 VitrualBox 上安装并运行 Linux.Windows.Mac OS X 等操作系统,类似的软件还有 VMware Vagr ...

  5. virtualbox+vagrant学习-2(command cli)-2-vagrant cloud命令--有问题

    Cloud https://www.vagrantup.com/docs/cli/cloud.html 命令: vagrant cloud 这是用来管理与vagrant相关的任何东西的命令. 该命令的 ...

  6. L06-Ubuntu系统中部署Vagrant和VirtualBox

    一.前言 1.Vagrant是一个搭建完整的虚拟开发环境的工具~~~更多关于Vagrant理论可查看这篇博文https://www.cnblogs.com/davenkin/p/vagrant-vir ...

  7. [转帖]征服诱人的Vagrant!

    征服诱人的Vagrant! https://www.cnblogs.com/hafiz/ 一.背景 ​ 最近要开始深入学习分布式相关的东西了,那第一步就是在自己的电脑上安装虚拟机,以前在Windows ...

  8. Vagrant 基础全面解析

    这篇 Vagrant 入门文章将带你创建一个 Vagrant 项目,这个过程将会用到 Vagrant 所提供的主要基本特性.如果想了解 Vagrant 能为你带来哪些好处,可以阅读 Vagrant 官 ...

  9. 使用packer制作vagrant centos box

    使用packer制作vagrant box:centos 制作vagrant box,网上有教程,可以自己step by step的操作.不过直接使用虚拟在VirtualBox中制作vagrant b ...

随机推荐

  1. 基于TcpListener的web服务器

    写在前面 上篇文章根据<asp.net 本质论>书上提供的例子,实现了一个简单的web服务器,本篇文章将介绍另一种实现方式——基于TcpListener的web服务器. TcpListen ...

  2. vs2012 智能提示消失解决办法

    一般你可以重启vs就可以解决问题,最蛋疼的是你重启也没用.只能重置,再不行就重装vs,再不行你就重装系统......扯淡了... 重置Visual Studio可以解决此问题, 方法:开始->M ...

  3. C语言中strstr函数

    头文件:#include <string.h> strstr()函数用来检索子串在字符串中首次出现的位置,其原型为:    char *strstr( char *str, char * ...

  4. yum使用本地源

    cache: [k2e喜]: 注意它的发音: 不是: keik the attribute could not be removed from the cache. 不能从缓存删除属性. YUM对服务 ...

  5. ASP.NET使用FileUpload上传文件

    前台代码: <asp:FileUpload ID="fuKeleyi" runat="server" /> <asp:Button ID=&q ...

  6. quartz定时任务时间设置

    这些星号由左到右按顺序代表 :     *    *     *     *    *     *   *                                   格式: [秒] [分] ...

  7. Hello Kitty微信主题很可爱?小心财产安全!

    个性化是产品服务的一个趋势.微信很火,可为什么微信主题只有一个呢?你让那些小女生情何以堪?这时HelloKitty微信主题.大嘴猴.哆啦A梦等一大批主题在网上出现了,有些打着免费的旗号却做着盗号的勾当 ...

  8. Song Jiang's rank list

     Song Jiang's rank list Time Limit:1000MS     Memory Limit:512000KB     64bit IO Format:%I64d & ...

  9. Android 源码编译错误

    参考文章:http://blog.csdn.net/brightming/article/details/49763515/ Building with Jack: out/target/common ...

  10. codeforces 258div2C Predict Outcome of the Game

    题目链接:http://codeforces.com/contest/451/problem/C 解题报告:三个球队之间一共有n场比赛,现在已经进行了k场,不知道每个球队的胜场是多少,如三个球队的胜场 ...