Vagrant(1)Installation and Try Simple Command
1. Introduction and Installation
Vagrant is based on Ruby, calling VirtualBox and etc virtual system API to provide us a virtual system.
VirtualBox Installation
I already have the latest virtual box from oracle website.
Vagrant Installation
Download the right software for me, version 1.6.3 for MAC OS.
http://www.vagrantup.com/downloads.html
Check the Installation
>vagrant version
Installed Version: 1.6.3 Latest Version: 1.6.3 You're running an up-to-date version of Vagrant!
Create a home directory
>mkdir /Users/carl/vagrant
Download the box
We can find the box list from here http://www.vagrantbox.es/
Add the box
>vagrant box add win7 http://vagrantboxes.devopslive.org/windows-7-enterprise-i386.box
win7 is the name of the box, the last URL is the box’s URL from box list. This URL can be a local box file.
or
>vagrant box add local ./local-dev.box
After the command, the box files will be place under this directory. /Users/carl/.vagrant.d/boxes
Init our system
>vagrant init
the default is init the base, if we did not use the default name base. We need to use
>vagrant init local
Start the Server
>vagrant up
SSH to that server
>vagrant ssh
Shutdown the Server
>vagrant halt
2. Vagrantfile Configuration
config.vm.box = “base” // the name of the box
# config.vm.provider "virtualbox" do |vb| # # Don't boot with headless mode # vb.gui = true # # # Use VBoxManage to customize the VM. For example to change memory: # vb.customize ["modifyvm", :id, "--memory", "1024"] # end
Configure the memory and GUI.
Network configuration
# 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 the directory
# config.vm.synced_folder "../data", "/vagrant_data"
3. Useful Command
vagrant box add URL or FILE
vagrant init
vagrant up
vagrant ssh
vagrant box list // list all the boxes we have
vagrant box remove //remove the box
vagrant destroy //destroy this VM
vagrant halt //turn off the power of that vm
vagrant package //package the current vm
Usually vagrant will use chef and puppet doing the provisioning.
>vagrant provision
vagrant reload //reload the vm
vagrant resume // resume the vm
vagrant status //check the current status
vagrant suspend // save the current state and stop the vm
4. Use Win7
Error Message
The guest operating system of the machine could not be detected!
Solution:
Change the configuration, give more memory, change the network to be public, enable the GUI.
config.vm.network "public_network"
config.vm.synced_folder "../data", "/vagrant_data"
config.vm.provider "virtualbox" do |vb| # Don't boot with headless mode vb.gui = true # Use VBoxManage to customize the VM. For example to change memory: vb.customize ["modifyvm", :id, "--memory", "2048" ] vb.customize ["modifyvm", :id, '--audio', 'coreaudio', '--audiocontroller', 'hda'] vb.customize ["modifyvm", :id, "--vram", "128"] vb.customize ["modifyvm", :id, "--accelerate3d", "on"] end
References:
https://github.com/astaxie/Go-in-Action/blob/master/ebook/zh/01.1.md
https://github.com/astaxie/Go-in-Action/blob/master/ebook/zh/01.3.md
http://blog.segmentfault.com/fenbox/1190000000264347
http://eva0919.github.io/2013/04/26/%E7%94%A8vm%E6%89%8D%E6%98%AF%E5%A5%BD%E7%9A%84%E5%B7%A5%E7%A8%8B%E5%B8%AB-vagrant%E7%AF%87%E5%85%A5%E9%96%80%E7%89%88/
http://www.vagrantup.com/
provisoner
http://docs-v1.vagrantup.com/v1/docs/provisioners.html
vagrant sample
https://github.com/GeoffreyPlitt/vagrant-audio/blob/master/Vagrantfile
https://github.com/michfield/devbox-puppet/blob/master/vagrantfile
- 浏览: 2551910 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
发表评论
-
Update Site will come soon
2021-06-02 04:10 1678I am still keep notes my tech n ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 294Hadoop Docker 2019 Version 3.2. ... -
Nginx and Proxy 2019(1)Nginx Enable Lua and Parse JSON
2019-12-03 04:17 449Nginx and Proxy 2019(1)Nginx En ... -
Data Solution 2019(13)Docker Zeppelin Notebook and Memory Configuration
2019-11-09 07:15 294Data Solution 2019(13)Docker Ze ... -
Data Solution 2019(10)Spark Cluster Solution with Zeppelin
2019-10-29 08:37 248Data Solution 2019(10)Spark Clu ... -
AMAZON Kinesis Firehose 2019(1)Firehose Buffer to S3
2019-10-01 10:15 322AMAZON Kinesis Firehose 2019(1) ... -
Rancher and k8s 2019(3)Clean Installation on CentOS7
2019-09-19 23:25 313Rancher and k8s 2019(3)Clean In ... -
Pacemaker 2019(1)Introduction and Installation on CentOS7
2019-09-11 05:48 343Pacemaker 2019(1)Introduction a ... -
Crontab-UI installation and Introduction
2019-08-30 05:54 455Crontab-UI installation and Int ... -
Spiderkeeper 2019(1)Installation and Introduction
2019-08-29 06:49 510Spiderkeeper 2019(1)Installatio ... -
Supervisor 2019(2)Ubuntu and Multiple Services
2019-08-19 10:53 370Supervisor 2019(2)Ubuntu and Mu ... -
Supervisor 2019(1)CentOS 7
2019-08-19 09:33 331Supervisor 2019(1)CentOS 7 Ins ... -
Redis Cluster 2019(3)Redis Cluster on CentOS
2019-08-17 04:07 373Redis Cluster 2019(3)Redis Clus ... -
Amazon Lambda and Version Limit
2019-08-02 01:42 438Amazon Lambda and Version Limit ... -
MySQL HA Solution 2019(1)Master Slave on MySQL 5.7
2019-07-27 22:26 530MySQL HA Solution 2019(1)Master ... -
RabbitMQ Cluster 2019(2)Cluster HA and Proxy
2019-07-11 12:41 464RabbitMQ Cluster 2019(2)Cluster ... -
Running Zeppelin with Nginx Authentication
2019-05-25 21:35 323Running Zeppelin with Nginx Aut ... -
Running Zeppelin with Nginx Authentication
2019-05-25 21:34 324Running Zeppelin with Nginx Aut ... -
ElasticSearch(3)Version Upgrade and Cluster
2019-05-20 05:00 329ElasticSearch(3)Version Upgrade ... -
Jetty Server and Cookie Domain Name
2019-04-28 23:59 404Jetty Server and Cookie Domain ...
相关推荐
advanced Vagrant use in a simple LAMP web application example Explore case studies from various organizations that use Vagrant Learn about common errors and get troubleshooting tips
Pro Vagrant teaches you how to effectively implement and optimize Vagrant in your everyday work environment. Master the creation and configuration of virtual development environments with an easy-to-...
这个名为 "vagrant_2.2.7-1_x86_64.rar" 的压缩包包含的是 Vagrant 2.2.7 版本的 x86_64(64位)安装文件,即 "vagrant_2.2.7-1_x86_64.msi"。Vagrant 支持多种虚拟化平台,如 VirtualBox、VMware 和 Docker,让...
1. **创建环境**:创建一个新的Vagrant项目,运行`vagrant init`,然后根据提示设置box(预装系统的镜像)。 2. **启动环境**:使用`vagrant up`命令启动虚拟机。 3. **配置环境**:编辑Vagrantfile,设置虚拟机的...
1. **箱(Boxes)**:这是Vagrant的基础,是一个预配置的操作系统镜像,通常包含了必要的软件开发工具和依赖项。Vagrant用户可以从Vagrant Cloud或其他第三方源下载这些box。 2. **配置文件(Vagrantfile)**:每个...
1. 在命令行中,使用`vagrant box add laravel/homestead`下载Homestead Box。 2. 初始化Homestead项目,运行`vagrant init laravel/homestead`,这将在当前目录创建一个默认的`Vagrantfile`。 3. 编辑`Vagrantfile`...
1. **虚拟机管理**:Vagrant 可以与多种虚拟化技术配合使用,如 VirtualBox、VMware 和 Hyper-V,允许用户轻松地创建和配置虚拟机。在Vagrantfile配置文件中,你可以定义虚拟机的硬件配置(如内存大小、CPU数量)和...
1. **配置文件**:Vagrant 使用名为`Vagrantfile`的文本文件来定义虚拟机的配置,如内存大小、CPU核心数以及安装的软件包。这使得团队成员可以共享相同的配置,确保一致性。 2. **盒子(Boxes)**:预打包的虚拟机...
1. **版本控制**: Vagrant 使用Box模型,每个Box代表一个预配置好的基础环境,通过版本控制可以轻松回滚到特定的环境状态。 2. **跨平台兼容**: Vagrant 支持多种主机操作系统,如Windows、MacOS和Linux,并且可以...
1. `vagrant_2.2.6_x86_64.msi` - Vagrant 2.2.6的Windows安装程序,用于在本地安装Vagrant。 2. `vagrant-centos-7.box` - 预配置的CentOS 7虚拟机镜像,可以通过`vagrant box add`命令添加到本地Vagrant镜像库。 ...
vagrant centos7 镜像
1. **可移植性**:Vagrant环境可以在不同计算机间无缝迁移,因为所有的配置都存储在一个版本控制的Vagrantfile中。 2. **一致性**:无论在哪台机器上,Vagrant都能确保创建出一致的开发环境。 3. **简化管理**:通过...
1. **Vagrant 的工作原理**: Vagrant 使用名为 "Vagrantfile" 的配置文件,其中包含了定义虚拟机配置的指令,如操作系统类型、内存大小、网络设置等。用户通过修改这个文件可以定制自己的开发环境。 2. **Vagrant...
1. 可移植性:Vagrant 环境可以在不同的机器上重现,这意味着开发团队成员可以在各自的电脑上拥有完全相同的开发环境,减少了因环境差异导致的问题。 2. 版本控制:由于 Vagrant 使用的是文本配置文件(Vagrantfile...
1. 安装Vagrant:首先,你需要在本地机器上安装Vagrant,可以从官方网站或者其他提供的下载源获取。 2. 创建Vagrantfile:在项目根目录下创建Vagrantfile,定义虚拟机的配置。 3. 添加box:使用`vagrant box add`...
Vagrant 是一款强大的开发工具,它允许开发者在本地创建并管理一致的开发环境。这款工具的核心理念是通过“配置即代码”(Infrastructure as Code)来简化环境的搭建,确保开发、测试和生产环境的一致性。Vagrant ...
它在官方渠道下载,特别适合那些网络速度较慢的用户,因为文件大小适中,即使是下载速度只有1kb每秒的用户也能顺利获取。 Vagrant的核心理念是“基础设施即代码”(Infrastructure as Code),这意味着你可以通过编写...
1. **Vagrant 简介**: Vagrant 是基于 Ruby 开发的,它通过提供简单的命令行界面和一致的工作流程,使得开发者能够在任何操作系统上快速创建和配置虚拟机。Vagrant 支持多种虚拟化技术,如 VirtualBox、VMware 和 ...