I'm creating a vagrant base box of windows server 2012, and i want to share it internally for which i'm using Vagrant http share with below command
vagrant share --http 80
C:\Isentia\Vagrant>vagrant share --http 80
==> dev: Detecting network information for machine...
dev: Local machine address: 169.254.202.14
dev: Local HTTP port: 80
dev: Local HTTPS port: disabled
==> dev: Checking authentication and authorization...
==> dev: Creating Vagrant Share session...
dev: Share will be at: caring-dragon-2751
==> dev: Your Vagrant Share is running! Name: caring-dragon-2751
==> dev: URL: http://caring-dragon-2751.vagrantshare.com
and accessing the box with vagrant up in another machine
C:\Isentia\DevVM>vagrant init http://caring-dragon-2751.vagrantshare.com:80
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.
C:\Isentia\DevVM>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'http://caring-dragon-2751.vagrantshare.com:80' could not be fo
und. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'http://caring-dragon-2751.vagrantshare.com:80' (v0) for
provider: virtualbox
default: Downloading: http://caring-dragon-2751.vagrantshare.com:80
default: Progress: 0% (Rate: 0curl:/s, Estimated time remaining: --:--:--)
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
The requested URL returned error: 500 Internal Server Error
below is the vagrant file content
Vagrant.configure(2) do |config|
config.vm.box = "BuzzNumberDevBox"
config.vm.guest = :windows
config.vm.communicator = "winrm"
config.vm.boot_timeout = 600
config.vm.graceful_halt_timeout = 600
# Admin user name and password
config.winrm.username = "vagrant"
config.winrm.password = "vagrant"
config.vm.define "dev" do |dev|
dev.vm.network "private_network", ip: "192.168.100.10"
dev.vm.host_name = "vagranttests.dev"
dev.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true
end
config.vm.provider :virtualbox do |vb|
# Customize the name of VM in VirtualBox manager UI:
vb.name = "BuzzNumber-Dev-VM-Web"
end
end
what i do not understand is what could be stopping it from being accessible from any machine. The documentation asked to use the link directly.
Vagrant share is designed for sharing access to an application hosted on a VM, NOT for sharing the actual VM. If you want to share the VM itself you need to run vagrant package to pack it, and then put it on a web server with a metadata.json or at a URL where the other user can add it directly. Can you clarify if you want to copy this box to another machine or simply access a service running on the initial vagrant box?
Related
I'm trying to setup a vagrantbox with Hyper-V on my local windows-10 mashine. My Workstation is running behind a proxy, but I configured a local cntlm proxy to get around these limitations. Proxy settings work fine since I was able to install a vagrant plugin and downloan a box image.
But now my guest linux does not start up and I am running out of ideas.
My vagrant file
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04" # ubuntu 18.04 image with support for virtual box and Hyper-V
config.vm.hostname = "skywalker"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
config.vm.provider "hyperv" do |hv|
hv.memory = "2048"
end
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" # prevent tty errors
# install the vagrant plugin "vagrant-cachier" to cache downloaded artifacts
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
# vagrant behing local cntlm proxy if plugin exists (= provinzial win10 workstation)
if !Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://localhost:3128/"
config.proxy.https = "http://localhost:3128/"
config.proxy.no_proxy = "localhost, 127.0.0.1"
end
# --------------------------------------------------------------------------
# provision virtual mashine (basic setup) and install applications in VM
#config.vm.provision "shell", path: "scripts/install-ansible.sh"
config.vm.provision "shell", path: "scripts/install-ncdu.sh"
config.vm.provision "shell", path: "scripts/install-git.sh"
config.vm.provision "shell", path: "scripts/install-openjdk-11.sh"
config.vm.provision "shell", path: "scripts/install-maven.sh"
config.vm.provision "shell", path: "scripts/install-node-npm.sh"
config.vm.provision "shell", path: "scripts/install-docker.sh"
config.vm.provision "shell", path: "scripts/install-docker-compose.sh"
# npm webserver
config.vm.provision "shell", path: "apps/install-npm-apps.sh"
config.vm.network "forwarded_port", guest: 8000, host: 8000
# artifactory setup (start artifactory after vm startup)
config.vm.network "forwarded_port", guest: 8081, host: 8081 # artifactory from docker
config.vm.network "forwarded_port", guest: 8082, host: 8082 # artifactory from docker
# See README.md for Artifactory in Docker
end
Starting the box with this settings results in
C:\home\work\workspace\vagrant-boxes\skywalker (master -> origin)
λ vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
==> default: Importing a Hyper-V instance
default: Creating and registering the VM...
default: Successfully imported VM
default: Configuring the VM...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
default: Timeout: 120 seconds
default: IP: fe80::215:5dff:fe02:8b01
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: fe80::215:5dff:fe02:8b01:22
default: SSH username: vagrant
default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
On a different mashine with VirtualBox as VM provider this Vagrantfile works fine. Sadly I cannot use any VM provider other than Hyper-V on my windows mashine due to limitations which are out of my control ...
I set up Hyper-V using Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All.
Any ideas? Thanks in advance and best regards. Sebastian
I went through this exercise last week and saw similar problems. I made lot of progress following these steps and the vm's get spun up at a reasonable time under windows 10 hyper-v. This is what i did.
Followed this blog and tried creating a vm successfully first.
https://win32.io/posts/Vagrant-Install-HyperV
Then i created a simple vagrantfile and got it to work successfully. Here is mine ,
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/bionic64"
config.vm.hostname = 'utility-server-1'
config.vm.network 'public_network', bridge: 'Internet'
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider "hyperv" do |vb|
vb.memory = "4024"
vb.cpus = 2
vb.vmname = 'utility-server-1'
end
end
Once this works, add more complex steps from your vagrantfile, like shell scripts and forwarded ports.
UPDATE: After host PC reboot vagrant up shows port collision on any port
My vagrant machine fails to start.
Usually it was working normally, but today after I restarted my PC the vagrant machine no more starts.
I did not change the Vagrantfile.
It says about ports collision.
If I remove the 6379 setting for redis, then it says for port 1080 and so on.
Like all ports have the collision.
If I try to run the macine via VMware - then it starts OK, but I cannont connect to it via ssh, because it doesn't have the settings that are defined in Vagrantfile...
Here is the log:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: There was a problem while downloading the metadata for your box
==> default: to check for updates. This is not an error, since it is usually due
==> default: to temporary network problems. This is just a warning. The problem
==> default: encountered was:
==> default:
==> default: The requested URL returned error: 404
==> default:
==> default: If you want to check for box updates, verify your network connectio n
==> default: is valid and try again.
==> default: Fixed port collision for 6379 => 6379. Now on port 2250.
Vagrant found a port collision for the specified port and virtual machine.
While this port was marked to be auto-corrected, the ports in the
auto-correction range are all also used.
VM: default
Forwarded port: 1080 => 1080
Here is my Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
forward_port = ->(guest, host = guest) do
config.vm.network :forwarded_port,
guest: guest,
host: host,
auto_correct: true
end
config.vm.synced_folder "sites/", "/var/www"
config.vm.synced_folder ".", "/vagrant", disabled: true
forward_port[6379] # redis
forward_port[1080] # mailcatcher
forward_port[3306] # mysql
forward_port[80, 8080] # nginx/apache
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "manifests"
puppet.manifest_file = "default.pp"
end
config.vm.network :private_network, ip: "33.33.33.10"
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
end
I am trying to follow the directions on this page https://github.com/josenk/vagrant-vmware-esxi and I am using Vagrant on a windows machine (win 10) and I want to be able to deploy VMs on a standalone ESXI6.5 Server (free edition-demo license expired) . No VCenter here.
I am using this command line
vagrant up --provider=vmware_esxi
root#110.10.10.10 password:
Bringing machine 'default' up with 'vmware_esxi' provider...
==> default: Box 'cdua/ubuntu16' could not be found. Attempting to find and install...
default: Box Provider: vmware_esxi, vmware, vmware_desktop, vmware_fusion, vmware_workstation
default: Box Version: 16.04
==> default: Loading metadata for box 'cdua/ubuntu16'
default: URL: https://vagrantcloud.com/cdua/ubuntu16
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.
If you're adding a box from HashiCorp's Vagrant Cloud, make sure the box is
released.
Name: cdua/ubuntu16
Address: https://vagrantcloud.com/cdua/ubuntu16
Requested provider: ["vmware_esxi", "vmware", "vmware_desktop", "vmware_fusion", "vmware_workstation"]
and here is my Vagrantfile
#
# Fully documented Vagrantfile available
# in the wiki: https://github.com/josenk/vagrant-vmware-esxi/wiki
Vagrant.configure('2') do |config|
config.vm.box = "cdua/ubuntu16"
config.vm.box_version = "16.04"
config.vm.synced_folder('.', '/vagrant', type: 'nfs', disabled: true)
config.vm.network 'private_network', type: "dhcp"
config.vm.network "public_network", auto_config: false
config.vm.provider :vmware_esxi do |esxi|
esxi.esxi_hostname = '10.10.10.10'
esxi.esxi_username = 'root'
esxi.esxi_password = 'prompt:'
esxi.esxi_virtual_network = ['Production','VM Network']
esxi.guest_name = 'VagrantTestVM'
end
end
I can't understand what vagrant wants from me.
As far as I could google/read I can see that the provider is the plugin used to upload the VM. When it comes to VMWare there are a couple of types of provider and on the hashicorp site none is listed as vmware_esxi. The closest one functionally speaking should be the vmware_ovf which the image cdua/ubuntu16 supports.
Yet vagrant fails but it tells me that the box provider is vmware_esxi
Update:
Before posting here I tried the below, as you can see error again
vagrant up --provider=vmware_esxi
root#10.10.10.10 password:
Bringing machine 'default' up with 'vmware_esxi' provider...
==> default: Box 'generic/ubuntu1710' could not be found. Attempting to find and install...
default: Box Provider: vmware_esxi, vmware, vmware_desktop, vmware_fusion, vmware_workstation
default: Box Version: >= 0
==> default: Loading metadata for box 'generic/ubuntu1710'
default: URL: https://vagrantcloud.com/generic/ubuntu1710
==> default: Adding box 'generic/ubuntu1710' (v1.8.50) for provider: vmware
default: Downloading: https://vagrantcloud.com/generic/boxes/ubuntu1710/versions/1.8.50/providers/vmware.box
default: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
default: Progress: 100% (Rate: 3286k/s, Estimated time remaining: --:--:--)
The box you attempted to add doesn't match the provider you specified.
Provider expected: vmware
Provider of box: vmware_desktop
It looks like the provider you linked supports every vmware box format except vmware_ovf, which is the only format provided for the cuda/ubuntu16 box. You probably need too change config.vm.box to a different box that supports one of the other formats.
You might check Hashicorp's box index for "vmware" format Ubuntu boxes. (I've had good luck in the past with bento/ubuntu-16.04 and it claims a vmware_desktop build.)
I want to copy one entire folder present on my windows machine to a vm hosting ubuntu/trusty64.
But every time I try to bring my vagrant up i get below error message.
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> 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: Adapter 2: hostonly
==> 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: Machine booted and ready!
==> default: Configuring proxy for Apt...
==> default: Configuring proxy environment variables...
[default] GuestAdditions seems to be installed (5.1.20) correctly, but not running.
vboxadd: unrecognized service
vboxadd-service: unrecognized service
bash: line 4: setup: command not found
==> default: Checking for guest additions in VM...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
setup
Stdout from the command:
Stderr from the command:
bash: line 4: setup: command not found
Note:
Ubuntu version is up to date as you can see in the third line.
Vagrant version : Vagrant 1.9.3
Windows version : Windows 7 Enterprise Service Pack 1
Oracle VirtualBox version : Version 5.1.20 r114628 (Qt5.6.2)
On running the command vbguest status i get
$ vagrant vbguest --status
[default] GuestAdditions seems to be installed (5.1.20) correctly, but not running.
My vagrant file contents are
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are 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.vm.box = "ubuntu/trusty64"
config.ssh.insert_key = false
# Disable automatic box update checking. If you disable this, then
# boxes will only be 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 on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "xxxxx"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an 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 "../data", "/vagrant_data" , "/vagrant"
config.vm.synced_folder ".", "/mydata", :mount_options => ['dmode=775','fmode=664']
#config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", type: "nfs"
# Provider-specific configuration so you 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 booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are 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 about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "xxxxx"
config.proxy.https = "xxxxx"
config.proxy.ftp = "xxxxx"
config.apt_proxy.http = "xxxxx"
config.apt_proxy.https = "xxxxx"
config.proxy.no_proxy = "xxxxx"
end
if !Vagrant.has_plugin?("vagrant-proxyconf")
system('vagrant plugin install vagrant-proxyconf')
raise("vagrant-proxyconf installed. Run command again.");
end
end
Please suggest
1. How can i correct this error?
2. Share the complete folder from windows to vm?
Connect the Guest VM using WinSCP. Copy the VBoxGuestAddition.iso from the host machine. In my case, the VBoxGuestAddition present in C:\ProgramFiles\Oracle\VirtualBox.
Once iso file copied to Guest VM, login to GUest VM using putty.
mkdir /media/GuestAdditionsISO
Then execute the below command
mount -o loop /path/of/VBoxGuestAddition.iso /media/GuestAdditionsISO
Once mount command executed successfully,
cd /media/GuestAdditionsISO
sudo ./VBoxLinuxGuestAddition.run
Then re-start the VM. This works for me
I'm trying to set up Laravel Homestead on Windows 8.1 x64 and I can't seem to get passed the error below.
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: casensitive_default_1420409560257_10693
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (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: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
This is a very popular error with Homestead, and I've found a couple similar posts on stackoverflow such as: one, and two. But setting the boot_mode in my Vagrantfile didn't fix the issue.
Vagrant.configure("1") do |config|
config.vm.boot_mode = :gui
end
To make sure I had VT-x I downloaded intels tool, which I do: i7 core; and I checked that Virtualization is enabled in BIOS.
In the Vagrantfile I'm using defaults (most of it appears to be commented out) and I've set config.vm.box to:
"laravel/homestead"
and my Homestead.yaml is set to (and already had id_ras.pub and id_rsa):
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/d/projects
to: /home/vagrant/projects
sites:
- map: roopla.app
to: /home/vagrant/projects/test_app/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
This is pretty far out of my normal Composer, PHP, GruntJS, BowerJS, AngularJS day, and I'm not sure what I'm really doing, initially I was just learning Laravel 4/5 and then I jumped sideways because Homestead looked useful and kewl, so I'm just blindly following instructions so any snippets of knowledge that can be imparted would be much appreciated.
First, make sure you haven't turned on Hyper-V.
Second, probably you have problem with ssh keys. The simplest solution is to alter your vagrant file not to use SSH keys but login and password.
Look at my vagrantfile:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION = "2"
homesteadYamlPath = File.expand_path("Homestead.yaml")
afterScriptPath = File.expand_path("after.sh")
aliasesPath = File.expand_path("aliases")
require_relative 'scripts/homestead.rb'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
config.vm.network "forwarded_port", guest: 11300, host: 11301
end
I've added here 2 lines:
config.ssh.username = "vagrant"
config.ssh.password = "vagrant"
because I had the same problem as you and now Homestead works for me without any problems.