Using vagrant to build a native python development environment

Source: Internet
Author: User
Tags connection reset virtual environment

Using vagrant to build a native python development environment

About vagrant:
Vagrant is a ruby-based tool for creating and deploying a virtualized development environment that uses Oracle's Open source VirtualBox virtualization System
You can also use VMware to use, because the configuration is more cumbersome to give up (seemingly need to install a fee plug-in, rather than directly install VirtualBox)

Detailed operation steps:
Introduction of tools and environment:
Tools and Environment versions
Host Environment Win10 x86_64 Home Edition http://msdn.itellyou.cn/
virtualboxvirtualbox-5.2.0https://www.virtualbox.org/
vagrantvagrant_2.0.1http://www.vagrantup.com/
boxcentos-6.6-x86_64.boxhttp://www.vagrantup.com/
xshellxshell_5.0 Build 1326http://www.netsarang.com/download/main.html

1. Download and install the software
① download VirtualBox virtual machine, very simple do not repeat (halfway need to break the network, need attention)
Http://download.virtualbox.org/virtualbox/5.2.0/VirtualBox-5.2.0-118431-Win.exe

② Download and install vagrant
Https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.msi

③centos-6.6-x86_64.box Specific Address
Https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.0.0/centos-6.6-x86_64.box

2. Configure the path of the VirtualBox to the Advanced environment variable
D:\Program files\oracle\virtualbox\

Run VBoxManage.exe directly via CMD to start the VirtualBox virtual machine program

3. Download Centos-6.6-x86_64.box into the D:/data directory

cmd Command window:
D:
CD data

① Creating a centos6.6-x86_64 image
D:\data>vagrant box Add "centos6.6-x86_64" Centos-6.6-x86_64.box
==> Box:box file is not detected as metadata. Adding it directly ...
==> box:adding Box ' centos6.6-x86_64 ' (V0) for provider:
box:unpacking Necessary Files From:file://d:/data/centos-6.6-x86_64.box
Box
==> box:successfully added box ' centos6.6-x86_64 ' (v0) for ' VirtualBox '!

# View Virtual Machine list
D:\data>vagrant Box List
centos6.6-x86_64 (VirtualBox, 0)

③CD to initialize a box under the DEVOPS2 directory
D:\DATA>CD DEVOPS2

D:\data\devops2>vagrant Init "centos6.6-x86_64"
A ' Vagrantfile ' have been placed in this directory. You is 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.

④ Starting a virtual machine
D:\data\devops2>vagrant up
Bringing machine ' default ' up with ' VirtualBox ' provider ...
==> default:importing Base box ' centos6.6-x86_64 ' ...
==> default:matching MAC address for NAT networking ...
==> default:setting The name of the vm:devops2_default_1511436711981_49349
==> default:clearing Any previously set forwarded ports ...
==> default:clearing Any previously set network interfaces ...
==> default:preparing Network interfaces based on configuration ...
Default:adapter 1:nat
==> default:forwarding Ports ...
Default:22 (Guest) = 2222 (host) (Adapter 1)
==> default:booting VM ...
==> default:waiting to boot. This could take a few minutes ...
Default:ssh address:127.0.0.1:2222
Default:ssh username:vagrant
DEFAULT:SSH Auth method:private Key
Default:Warning:Connection Reset. Retrying ...
Default:Warning:Connection aborted. Retrying ...
Default:Warning:Remote connection Disconnect. Retrying ...
Default:Warning:Connection Reset. Retrying ...
Default:Warning:Connection aborted. Retrying ...
Default:Warning:Remote connection Disconnect. Retrying ...
Default:Warning:Connection aborted. Retrying ...
Default:Warning:Connection Reset. Retrying ...
Default:Warning:Connection aborted. Retrying ...
Default:Warning:Connection Reset. Retrying ...
Default:Warning:Connection aborted. Retrying ...
Default:Warning:Remote connection Disconnect. Retrying ...
Default
Default:vagrant insecure key detected. Vagrant'll automatically replace
Default:this with a newly generated keypair for better security.
Default
Default:inserting generated public key within guest ...
Default:removing insecure key from the guest if it ' s present ...
Default:key inserted! Disconnecting and reconnecting using new SSH key ...
==> Default:machine booted and ready!
==> default:checking for guest additions in VM ...
Default:the Guest Additions on this VM does not match the installed version of
default:virtualbox! In the most cases this is fine, but in rare cases it can
Default:prevent things such as shared folders from working properly. If you see
default:shared folder errors, please make sure the guest additions within the
Default:virtual Machine Match the version of VirtualBox you has installed on
Default:your host and reload your VMS.
Default
Default:guest Additions version:4.3.28
Default:virtualbox version:5.2
==> default:mounting Shared Folders ...
Default:/vagrant = D:/DATA/DEVOPS2

# you can see that the virtual machine is started

④ start SSH
D:\data\devops2>vagrant SSH
Last Login:sat-12:27:44 from 10.0.2.2
Welcome to your vagrant-built virtual machine.

You can also connect via SSH tool such as Xshell connection 127.0.0.1 2222 port, user name is vagrant password Select public key Select the installation directory Private_key import

[Email protected] ~]$ pwd
/home/vagrant
[Email protected] ~]$ cd/vagrant


# The directory is mapped to the/vagrant directory by default
[email protected] vagrant]$ LL
Insgesamt 4
-rwxrwxrwx. 1 vagrant Vagrant 3093 23. Nov 12:02 Vagrantfile

[email protected] vagrant]$ Touch reboot.txt
[[email protected] vagrant]$ echo ' Jack ' > Reboot.txt
[email protected] vagrant]$ LL
Insgesamt 5
-rwxrwxrwx. 1 vagrant Vagrant 5 23. Nov 12:55 Reboot.txt
-rwxrwxrwx. 1 vagrant Vagrant 3093 23. Nov 12:02 Vagrantfile

⑤ shutting down a virtual machine
Shutdown D:\data\devops2>vagrant Halt

Using vagrant to build a native python development environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.