Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Windows7 system using Vagrant to build Linux virtualized development environment     - How do I delete a NEEDS RECOVERY rollback state of undo tablespace (Database)

- Make command Detailed Tutorial (Programming)

- How to install the Linux text editor Atom 0.124.0 (Linux)

- Workspace Go language and environment variables GOPATH (Linux)

- Ubuntu users to install the system indicator SysPeek 0.3 (Linux)

- Linux Learning --- disk partition / relational representation + mount (Linux)

- Memory leak analysis using Android studio (Programming)

- CentOS 7 update source - the use of domestic sources 163 yum (Linux)

- Ubuntu is expected to allow you to install the latest Nvidia Linux drivers easier (Linux)

- The AWK use Cygwin tools mysql binlog log viewer (Database)

- What have we learn from the front-end application Nodejs (Programming)

- DB2 manually create a library (Database)

- Linux Workstation Security Checklist - from the Linux Foundation Internal (Linux)

- To upgrade combat MongoDB database replication sets and split versions (Database)

- Linux Mint 17 set up the Ruby environment (Linux)

- Five kinds of IO Model under Linux (Programming)

- Three binary tree traversal (recursive, non-recursive traversal and Morris) (Programming)

- Installation of Python2.7.10 under CentOS 6.4 (Linux)

- Linux Tutorial: Open multiple tabs in the GNOME terminal in Ubuntu 15.04 (Linux)

- How to manage the time and date at systemd Linux systems (Linux)

  Windows7 system using Vagrant to build Linux virtualized development environment
  Add Date : 2017-05-29      
  First, the benefits of using virtual development environment:

1, to ensure consistent development and production environments

Virtualized development environment is in fact a native virtual production environment, thanks to the low hardware, development machine has become very strong performance, 4-core, 32G memory computer does not need too much cost, very smooth running virtual machine .

Using a virtual development environment, developers can use the unit or your favorite handy OS (Windows, Linux, Mac OS, etc.), while the program is running in a virtual machine, migrate to the production environment is not compatible inexplicably avoided due to environmental error.

Virtualized development environment for team development environment OS, test and production environments in different situations is particularly suitable.

2, simplifying the deployment debugging environment

Slightly more complex system deployment debugging environment will be a troublesome thing, nginx, mysql, redis, mongodb etc. is estimated to be installed, there may be a lot of third-party development libraries ......, through virtualization technology simplify these tasks.

Virtual environments can be made by hand, and then distributed to developers, testers, they can easily in native debugging.

If the production environment is multi-platform (or multiple OS versions), you can create multiple virtual machines, simply click on it to switch to debug.

Second, begin to make a virtual development environment

1. Install VirtualBox

Oracle VirtualBox is open source virtualization system, the official website: https: //www.virtualbox.org/wiki/Downloads/ virtualbox download and install the latest version, skip the detailed process.

2. Use vagrant

vagrant is a tool developed in Ruby, VirtualBox encapsulates some of the commands, it simplifies the operation of the virtual machine virtualbox, adds support for automated deployment software puppet / chef of

You can easily create and deploy, distribute virtualized development environment through vagrant.

3, install vagrant

Methods First, download the installation package, the official website: http: //downloads.vagrantup.com/

Note that, try to download the latest program, because VirtualBox frequent upgrades, some interfaces will change after the upgrade, the old vagrant may not be available

Method two, vagrant is ruby development, ruby if you have installed, you can use gem install:

gem install vagrant
4, the establishment of environmental

1) the establishment of a development environment directory (can be skipped using existing directory)

Build a folder in Explorer
This is the E: \ workspace \ devel_env

2) Open a command line window, vagrant operations are command line

Enter E: \ workspace \ devel_env directory
Hold down the shift key and press the right mouse button in the blank space in the pop-up menu point "Open a command line window"

3) Add a box

box is a zip package that contains configuration information vagrant and VirtualBox virtual machine image file
The official provided a box, http: //files.vagrantup.com/lucid32.box

You can also choose to use a team system, http: //www.vagrantbox.es/
Or also own a row

My server CentOS, chose CentOS 6.3 x86_64 minimal

Add box command:

vagrant box add base distal box url box or a local file name
vagrant box add command to add
base box is the name or any title, base is the default name

vagrant box add base http://files.vagrantup.com/lucid32.box
vagrant box add base https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box
vagrant box add base e: /vbox/CentOS-6.3-x86_64-minimal.box
vagrant box add "CentOS 6.3 x86_64 minimal" e: /vbox/CentOS-6.3-x86_64-minimal.box
Information about the installation process

[Vagrant] Downloading with Vagrant :: Downloaders :: File ...
[Vagrant] Copying box to temporary location ...
[Vagrant] Extracting box ...
[Vagrant] Verifying box ...
[Vagrant] Cleaning up downloaded box ...
Files are placed in C: \ Users \ username current .vagrant.d \ under boxes \ directory

Install the remote box in such a way vagrant box add, may be slow, you can use the box to download the tool at the local

4) Initialization

vagrant init
If you add the name of the box is not the base, to be specified in the initialization time, for example,

vagrant init "CentOS 6.3 x86_64 minimal"
Information initialization process

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`Vagrantup.com` for more information on using Vagrant.
  5) Modify Vagrantfile, add some projects require path and port mapping
  Within config.vm.forward_port virtual machine port, local port
  config.vm.forward_port 80, 80
  config.vm.forward_port 5000, 5000
    config.vm.share_folder "ID", "within a virtual machine path", "Local path"
  config.vm.share_folder "v-data", "/ data", "e: / workspace / data"
  config.vm.share_folder "v-work", "/ work", "e: / workspace / work"
My production environment / data, / work two directories, so do the mapping

5, start the virtual machine

vagrant up
Information boot process

[Default] Importing base box 'base' ...
[Default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the

Guest Additions Version: 4.1.20
VirtualBox Version: 4.1.20
[Default] Matching MAC address for NAT networking ...
[Default] Clearing any previously set forwarded ports ...
[Default] You are trying to forward to privileged ports (ports < = 1024). Most
operating systems restrict this to only privileged process (typically
processes running as an administrative user). This is a warning in case
the port forwarding does not work. If any problems occur, please try a
port higher than 1024.
[Default] Forwarding ports ...
[Default] - 22 => 2222 (adapter 1)
[Default] - 80 => 80 (adapter 1)
[Default] - 5000 => 5000 (adapter 1)
[Default] Creating shared folders metadata ...
[Default] Clearing any previously set network interfaces ...
[Default] Booting VM ...
[Default] Waiting for VM to boot. This can take a few minutes.
[Default] VM booted and ready for use!
[Default] Mounting shared folders ...
[Default] - v-work: / work
[Default] - v-data: / data
[Default] - v-root: / vagrant

6, even with ssh into

Windows environment, it can not directly vagrant ssh, it will prompt:

E: \ workspace \ devel_env> vagrant ssh

`Vagrant ssh` is not available on the Windows platform. You are still able
to SSH into the virtual machine if you get a Windows SSH client (such as
. PuTTY) The authentication information is shown below:

Port: 2222
Username: vagrant
Private key: C: / Users / your account name /.vagrant.d/insecure_private_key
You must use a third-party ssh client

The ssh client GUI: putty, Xshell4
ssh client command line: Cygwin, MinGW

The command line:

ssh -i C: / Users / your account name /.vagrant.d/insecure_private_key -p2222 vagrant@
Graphically: skip

7, check the system

df -h
Filesystem Size Used Avail Use% Mounted on
/ Dev / mapper / VolGroup-lv_root
                       13G 930M 11G 8% /
tmpfs 499M 0 499M 0% / dev / shm
/ Dev / sda1 485M 40M 420M 9% / boot
work 203G 132G 71G 65% / work
data 203G 132G 71G 65% / data
v-root 203G 132G 71G 65% / vagrant
/ Vagrant This directory is automatically mapped is mapped to the e: \ workspace \ devel_env

8, install some commonly used software and modules

By puppet, can also be installed manually

e this machine: \ workspace \ devel_env is mapped to the virtual machine / vagrant directory, so the package can be installed into the e: \ workspace \ devel_env, the virtual machine can be easily installed on

9, turn off the firewall

Virtual machine development environment is not necessary to enable the firewall

sudo service iptables stop
sudo chkconfig iptables off
10, vagrant common commands

vagrant halt
vagrant suspend
vagrant resume
vagrant destroy
vagrant reload
11, distribution

Configured environment can be packaged redistribute, eliminating duplication of other programs team

vagrant package --vagrantfile Vagrantfile
Production process information:

[Default] Attempting graceful shutdown of VM ...
[Default] Clearing any previously set forwarded ports ...
[Default] Creating temporary directory for export ...
[Default] Exporting VM ...
[Default] Compressing package to: E: /workspace/devel_env/package.box
[Default] Packaging additional file: Vagrantfile

Third, the use of the project

1, the project code and data into the map directory, so, whether native or within a virtual machine, the file is consistent;

Also facilitate the migration project deployment, the unit directly relevant directory packed, put on a production server environment

2, the use of port mapping, so that the machine can easily access

Port mapping also can be dynamically added in VirtualBox Manager

Found vagrantup1.2.2 configuration are subject to change:

  config.vm.network: forwarded_port, guest: 80, host: 80
  config.vm.network: forwarded_port, guest: 5000, host: 5000

  config.vm.synced_folder "e: / workspace / data", "/ data"
  config.vm.synced_folder "e: / workspace / work", "/ work"
- Nginx reverse proxy and self-signed https (Server)
- Linux boot process (Linux)
- Oracle 11g new features and associated SQL TUNING (Database)
- Try debugfs restore the deleted files ext3 file system (Linux)
- The Zabbix2.4.5 source compiler installation under Ubuntu 14.04 (Server)
- Teamviewer not start in Linux (Linux)
- Detailed software to run UnixBench (Linux)
- Virt Related Command Summary (Linux)
- Create your own YUM repository (Linux)
- CentOS 7 server environment to quickly build Linux (Server)
- Build a super simple "hardware" firewall router (Linux)
- Ubuntu install Scala 2.10.x version (Linux)
- RHEL 6.5 x86_64 CentOS yum configuration source (Linux)
- Hadoop vs spark (Server)
- using Docker Kitematic on windows (Linux)
- Oracle Database High-Risk Vulnerability Warning (Database)
- Computer security protection remove local and remote system log files (Linux)
- How Vim playing a mature IDE (Linux)
- Nine trick to let you speed up the old machine running Ubuntu Linux (Linux)
- TL-WR703N to install OpenWrt process notes (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.