懶人環境建置筆記 (Windows)
搭建Vagrant环境备忘录(Windows版)
任务
-
- Vagrantのインストール
-
- ゲストOSとしてCentOSをインストール
- Vagrant初期設定
环境
-
- Windows 7
-
- Vagrant 1.7.2
-
- VirtualBox 5.0.10
- CentOS 6.5
主要
安装Vagrant
从下面下载并安装
-
- Vagrant 1.7.2: https://www.vagrantup.com/downloads
VirtualBox 5.0.10: https://www.virtualbox.org/wiki/Downloads
2)重新启动Windows
3)请在终端上确认以下事项
DOS> vagrant -v
Vagrant 1.7.4
安装 CentOS 作为客户操作系统。
创建一个工作文件夹。
DOS> cd %HOME%
DOS> mkdir -p ws/vagrant/centos
DOS> cd ws/vagrant/centos
2)添加 CentOS 的镜像
我从Vagrantbox.es上寻找并安装可用的box。
※本次使用的是CentOS 6.5 x86_64(https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box)。
DOS> vagrant box add centos-6.5 https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box
等待大约5分钟。
3)创建Vagrantfile
DOS> vagrant init centos-6.5
当添加box时,请指定指定的box名称(“centos-6.5”)。
4)对Vagrantfile进行编辑。
- プライベートアドレスを指定(下記行をコメントアウト)
config.vm.network "private_network", ip: "192.168.33.10"
5)启动虚拟机操作系统
$ vagrant up
登录到客户操作系统
1)安装Putty
请从以下链接下载并安装:
http://hp.vector.co.jp/authors/VA024651/PuTTYkj.html
2)Putty的初始配置
設置下述項目,然後點擊「打開」。
-
- ホスト名またはIPアドレス: 192.168.33.10
- ポート: 22
请键入以下内容并登录
-
- username: vagrant
- password: vagrant
待定:保存设置
备忘录
Guest OS的位置
只需要一個選項,以下是對中文的同義改述:
– “.vagrant.d/boxes” 資料夾路徑
虚拟机创建的位置
~/VirtualBox\ VMs与VM文件名以及.vagrant/machines/default/virtualbox/action_set_name的值有关联吗?
链接
流浪者
-
- official documents: https://docs.vagrantup.com/v2/
source code: https://github.com/mitchellh/vagrant
vagrant –help
虚拟盒子
-
- official documents: https://www.virtualbox.org/manual/UserManual.html
source code: https://www.virtualbox.org/browser/vbox/trunk
获取Vagrant的基础镜像的来源
-
- http://www.vagrantbox.es/
- https://atlas.hashicorp.com/boxes/search?utm_source=vagrantcloud.com&vagrantcloud=1
备忘单
- http://wp-static-images.s3-website-ap-northeast-1.amazonaws.com/wp-content/uploads/2014/08/vagrant_cheat_sheet.png