1. Download and install vagrant
2. Download and install VirtualBox
3. Download. Box
4. Initialize Vagrant box Add {box-name} {Box-url}
Use the Statement vagrtant box list to view the created name
5. Start vagrant up
6. Modify the Vagrantfile file as follows
#-*-Mode:ruby-*-#vi:set Ft=ruby:#All Vagrant configuration are done below. The "2" in Vagrant.configure#configures the configuration version (we support older styles for#backwards compatibility). Please don ' t change it unless know what#You ' re doing.Vagrant.configure (2) Do |config|#The most common configuration options is documented and commented below. #for a complete reference, please see the online documentation at #https://docs.vagrantup.com. #every Vagrant development environment requires a box. You can search for #boxes at Https://atlas.hashicorp.com/search.Config.ssh.forward_agent =true Config.vm.box="Keno_ubuntu" #Disable Automatic box update checking. If you disable this and then #Boxes'll is checked for updates when the user runs #' vagrant box outdated '. this is not recommended. #Config.vm.box_check_update = False #Create a forwarded port mapping which allows access to a specific port #Within the machine from a port to the host machine. In the example below, #accessing "localhost:8080" would access port in the guest machine.Config.vm.network"Forwarded_port", guest:3000, 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, appear as another physical device on #your network. #config.vm.network "Public_network" #Share A additional folder to the guest VM. the first argument is #The path on the host to the actual folder. The second argument is #The path on the guest to mount the folder. And the optional third #argument is a set of non-required options.Config.vm.synced_folder"e:/rails","/home/vagrant" #provider-specific configuration So can fine-tune various #backing providers for Vagrant. These expose provider-specific options. #Example for VirtualBox: #Config.vm.provider"VirtualBox"Do |vb|#Display the VirtualBox GUI when bootingVb.gui =true#Customize The amount of memory on the VM:Vb.memory ="2048"End#View The documentation for the provider is using for more #information on available options. #Define a Vagrant Push strategy for pushing to Atlas. Other push Strategies #such as FTP and Heroku are also available. See the documentation at #https://docs.vagrantup.com/v2/push/atlas.html for more information. #config.push.define "Atlas" do |push| #Push.app = "Your_atlas_username/your_application_name" #End #Enable Provisioning with a shell script. Additional provisioners such as #Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the #documentation for more information on their specific syntax and use. #config.vm.provision "Shell", inline: <<-shell #sudo apt-get update #sudo apt-get install-y apache2 #SHELLEnd
7. Use vagrant reload Reload settings when you start loading a file configuration common errors are as follows
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
Workaround:
Vagrant.configure("2") do |config| config.ssh.private_key_path = "~/.ssh/id_rsa" config.ssh.forward_agent = trueend
config.ssh.private_key_path
Is your local private key
- Your private key must is available to the local ssh-agent. Can check
ssh-add -L
with, if it's not listed add it withssh-add ~/.ssh/id_rsa
- Don ' t forget to add your public key to the
~/.ssh/authorized_keys
Vagrant VM. You can does it copy-and-pasting or using a tool like Ssh-copy-id
If still does not work try this:
Remove insecure_private_key
file fromc:\Users\USERNAME\.vagrant.d\insecure_private_key
Run vagrant up
(vagrant'll be generate a new insecure_private_key
file)
in other cases, help is just a setting forward_agent in Vagrantfile
:
Vagrant::Config.run do |config| config.ssh.forward_agent = trueend
Two. Install Rails
Window uses vagrant to build development and development environment