Home IT Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Windows7 system using Vagrant to build Linux virtualized development environment     - After Oracle 11g dataguard failover rebuild the archive logs are not applied to be NO problem (Database)

- Disable unnecessary services under Linux (Linux)

- Java Virtual Machine class loading mechanism and bytecode execution engine (Programming)

- FreeBSD install Gnome 3 Desktop (Linux)

- Linux command find (Linux)

- pscp use Detailed Windows and Linux each file transfer tool (Linux)

- To explore the Android ListView caching mechanism again (Programming)

- Oracle () trunc function usage (Database)

- The basic principles for the protection of a good linux server security (Linux)

- Postfix mail service system principle and configuration (Linux)

- Python is not C (Programming)

- Nginx reverse proxy and self-signed https (Server)

- The istgt PSD on ported to Mac OS X (Linux)

- Detailed usage history command (Linux)

- PostgreSQL Source Customization: Online global read only (Database)

- To batch create users under Linux (Linux)

- Teach you how to protect the Linux operating system security tips (Linux)

- Use FirewallD build dynamic firewall (Linux)

- Git delete files (Linux)

- OpenSIPS offline messaging feature set (Server)

  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"
- ORA-12545: Connection failed because the target host or object does not exist (Database)
- How to install open source ITIL portal iTOP on CentOS 7 (Server)
- CentOS5 installation Nodejs (Linux)
- Ubuntu 14.04 after the restart the default maximum screen brightness solutions (Linux)
- Oracle 11g creates virtual private directory RMAN-06004 ORA-00942 error handling (Database)
- Hadoop + Zookeeper NameNode achieve high availability (Server)
- ctop: monitor container performance Linux command line artifact (Linux)
- MySQL master-slave database configuration and error handling Raiders (Database)
- Installation and configuration of Hadoop under Linux (Server)
- 5 steps to help you become a good Docker contributors (Linux)
- Ubuntu Eclipse configuration Gtk + 2.0 libraries (Linux)
- React Getting Started Tutorial (Linux)
- System-level alias vs Oracle ADR functionality (Database)
- Ubuntu 12.04 commonly use shortcuts finishing Share (Linux)
- Why use Docker (Programming)
- SYN attack hacker attack and defense of the basic principles and prevention technology (Linux)
- Storm how to assign tasks and load balancing (Programming)
- Linux automatic installation and implementation (Linux)
- Fragment Android developers learning to resolve (Programming)
- How to fix Ubuntu / Mint can not add PPA source of error (Linux)
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.