Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Vagrant for Win7

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "Win7 how to install Vagrant", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Win7 how to install Vagrant" bar!

Install Virtualbox

Go to VB's official website to download VirtualBox's Windows installation package. Next will be OK all the way. Hardware acceleration of VirtualBox is very important. Windows 7 turns off VT-x (Intel chip) by default, which needs to be enabled in BIOS.

Install Vagrant

Go to the Vagrant official website to download the installation package under Windows, which is also Next all the way. You need to restart it after installation. Take this opportunity to check whether virtualization technology is enabled in BIOS.

Add a path to Path

There are two paths to add manually:

The running program path of Virtualbox, which is required when Vagrant scripts run Virtualbox and VBoxManager.

The path where the ssh.exe program is located. Ssh.exe will be installed when you install git. If you have not installed git, you need to download and install git.

Add Box

Although Box can be installed on the network, the situation in China is also known, so just to be on the safe side, download it first. Download address: http://www.vagrantbox.es/

After downloading, suppose the image is stored under d:\ boxes, run the command:

Vagrant box add trusty64 d:\ boxes\ trusty-server-cloudimg-amd64-vagrant-disk1.box

Where trusty64 is the name of the box in the box list managed by vagrant, followed by the path where the box file is located. Normally, you can see the following output:

Box: Box file was not detected as metadata. Adding it directly...== > box: Adding box' trusty64' (v0) for provider: box: Unpacking necessary files from: file://d:/boxes/trusty-server-cloudimg-amd64-vagrant-disk1.box box: Progress: 100% (Rate: 19.0M/s, Estimated time remaining:--:--) = > box: Successfully added box' trusty64' (v0) for 'virtualboxboxes! Initialize the workspace

The workspace can be understood as the native code of the project, and Vagrant will mount this code to the corresponding directory of the startup virtual machine, which implements the method of coding locally while the code runs in the virtual machine, no longer requires ftp or other ways to deploy the code repeatedly. Assuming that the workspace is d:\ va, change to this directory at the command line, and then execute vagrant init trusty64, where trusty64 is the name of the box you created in the previous step. This command initializes the workspace with the current directory as vagrant using the trusty64 box. If the command is executed successfully, the following information will be output:

A `Vagrantfile` has been placed in this directory. You are nowready to `vagrant up` your first virtual environment! Please readthe comments in the Vagrantfile as well as documentation on`vagrantup.com` for more information on using Vagrant.

In the current directory, there will be a Vagrantfile file.

Running

Everything is ready to run an instance. Using the command Vagrant up, normally, you will have the following output:

D:\ va > vagrant upBringing machine 'default' up with' virtualbox' provider...== > default: Importing base box' trusty64'...== > default: Matching MAC address for NAT networking...== > default: Setting the name of the VM: va_default_1456111656613_62745== > default: Clearing any previously set forwarded ports...== > default: Clearing any previously set network interfaces...== > default: Preparing networkin terfaces based on configuration... Default: Adapter 1: nat== > default: Forwarding ports... Default: 22 (guest) = > 2222 (host) (adapter 1) = > default: Booting VM...== > default: Waiting for machine to boot. This may take a few minutes... Default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Remote connection disconnect. Retrying... Default: default: Vagrant insecure key detected. Vagrant will 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 readyweights = > default: Checking for guest additions in VM... Default: The guest additions on this VM do not match the installed version of default: VirtualBox! In 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 have installedon default: your host and reload your VM. Default: default: Guest Additions Version: 4.3.36 default: VirtualBox Version: 5.0 Mounting shared folders... = > default: Mounting shared folders... Default: / vagrant = > D:/va manages virtual machine instances

The following commands are used to manage virtual machines started by vagrant.

List the current virtual machine status: vagrant status

Shut down the current virtual machine: vagrant halt

Pause the current virtual machine: vagrant suspend

Duplicator for updates to the configuration file to take effect: vagrant reload

Error troubleshooting

Follow the above steps, you should be able to do it all at once. If you still encounter problems, please check the blog post: http://my.oschina.net/u/248080/blog/618060 first.

Log in to the virtual machine

After the installation is complete and running, you can't install the configuration without anything. Ssh login is bound to be required. It's OK to use Windows to bring your own command line, just execute vagrant ssh.

Putty

If you are accustomed to using putty, you need to first convert the key that comes with Vagrant into the format required by putty:

Run puttygen.exe,Conversions menu > > Import key

The private key generated by Vagrant is located in. Vagrant\ machines\ default\ virtualbox\ private_key in the workspace directory.

Import the private key into puttygen, click Save private key, and save it to ppk format.

Start putty.exe and select the ppk file you just generated in Connection > > SSH > > Auth

Host is 127.0.0.1, port is 2222, point Open

The user name of ssh is vagrant

Secure Shell Client

If you are used to Secure Shell Client, add a public key by following these steps:

Start Secure Shell Client

Go to Edit > Settings > > Global Settings > > User Authentication > > Keys

Click the Generate New button to generate a RSA 2048 encrypted key pair.

When the generation is complete, click export to export.

Import the private key file you just exported with puttygen again, copy the public key string in the text box, and paste it into the. ssh/authorized_keys file of the virtual machine

In the same way, log in with 127.0.0.1, port 2222, and user name vagrant.

Thank you for reading, the above is the content of "how to install Vagrant in Win7". After the study of this article, I believe you have a deeper understanding of how to install Vagrant in Win7, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report