VagrantFile:
# vi: set ft=ruby :
# 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|
config.vm.box = "zenshade/mint64-xfce-20"
config.vm.box_version = "1.0.0"
config.vm.hostname="master1"
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 = 1500
vb.cpus = 2
vb.name = "kube-master1"
if !File.exist?("disk/master1.vdi")
vb.customize [
'createhd',
'--filename', 'disk/master1',
'--format', 'VDI',
'--size', 20000
]
end
end
end
After running I am getting following error:
The checksum of the downloaded box did not match the expected
value. Please verify that you have the proper URL setup and that
you're downloading the proper file.
Expected: 5cdefeacdd0259ea666f1112211af306 package.box
Received: 5cdefeacdd0259ea666f1112211af306
I am not getting the reson behind the checksum error. I am trying to setup linux mint xfce desktop. How can I match the checksum value?
for this problem i think we have only one solution that update the checksum of your package on vagrant cloud to the Expected checksum.
Expected: 5cdefeacdd0259ea666f1112211af306 package.box
Received: 5cdefeacdd0259ea666f1112211af306
Related
I have a small problem with setting up my working environment after upgrade to Ubuntu 18.04. Vagrant version is 2.0.0.
Vagrant File
# -*- mode: ruby -*-
# vi: set ft=ruby :
# 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 = "debian/jessie64"
# config.vm.box = "ubuntu/xenial64"
# 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.
# NOTE: This will enable public access to the opened port
config.vm.network "forwarded_port", guest: 80, host: 8888
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# 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 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 ".", "/vagrant-nfs", type: :nfs, mount_options: ['rw', 'vers=3', 'tcp', 'fsc' ,'actimeo=2']
config.bindfs.bind_folder "/vagrant-nfs", "/srv/bspotted.net/app", :owner => "vagrant", :group => "vagrant"
config.vm.network :private_network, ip: "192.168.33.15"
# 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.
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--name", "bspotted", "--memory", "2048"]
end
# 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
# Ansible provisioner.
config.vm.provision "ansible_local" do |ansible|
ansible.version = "2.3.2.0"
ansible.install_mode = "pip"
ansible.provisioning_path = "/srv/bspotted.net/app"
ansible.playbook = "orchestration/vagrant.yml"
ansible.verbose = "vvv"
end
end
For the record I have an older version Ubuntu 16.10 on my other laptop and everything is working properly, this is the output of the vagrant up --debug &> vagrant.log command here.
Everything fall apart when setup reach
==> default: Preparing to edit /etc/exports. Administrator privileges will be required...
==> default: Mounting NFS shared folders...
after aprox 5 minutes, it will show
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o vers=3,udp,rw,vers=3,tcp,fsc,actimeo=2 192.168.33.1:/home/copser/Documents/Bspotted /vagrant-nfs
Stdout from the command:
Stderr from the command:
mount.nfs: Connection timed out
Problem is solved after I've changed the version of nfs,
`config.vm.synced_folder ".", "/vagrant-nfs", type: :nfs, mount_options: ['rw', 'vers=3', 'tcp', 'fsc' ,'actimeo=2']`
to
config.vm.synced_folder ".", "/vagrant-nfs", type: :nfs, mount_options: ['rw', 'vers=4', 'tcp', 'fsc' ,'actimeo=2']
just to make it clear I've changed vers=3 to vers=4, and no everything is working fine. You can check my correspondence with vagrant contributors here.
I'm trying to create aliases that I can use in Vagrant any time I run the VM. I've found several sources on the web about it, but can't get it working. I tried making a .bash_profile in my synced folder, but that didn't work. I noticed if I run the command alias name="command" this will work, but only for the current session. Anyone know how to do this? I'm using macOS. Thanks for your help!
Here is my Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
unless Vagrant.has_plugin?("vagrant-vbguest")
warn "\nWARNING: The vagrant-vbguest plugin should be installed or your shared folders might not mount properly!"
warn "You can do this by running the command 'vagrant plugin install vagrant-vbguest'.\n\n"
end
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "pype_vm"
config.vm.box_url = "https://.../pype_vm.json"
config.vm.network "private_network", ip: ""
config.vm.boot_timeout = 600
config.vm.provider "virtualbox" do |v|
# This forces VirtualBox to use the host's DNS resolver instead of
# VirtualBox's
v.customize ["modifyvm", :id, "", "on"]
# This enables the PAE/NX option, which resolved at least one user's
# issues with the VM hanging on boot
v.customize ["modifyvm", :id, "--pae", "on"]
# The RHEL VM was created with 2GB of memory to facilitate provisioning,
# but this is causing issues with certain workstations. This reduces
# the amount of memory allocated to the VM but should not impact development
# performance. The number is in MB and can be increased if desired.
v.memory = 1024
end
# Share an additional folder to the guest VM.
config.vm.synced_folder File.dirname(__FILE__), "/pype"
end
The details depend on the specific of the guest being run, but some notes:
Assuming the default user account is active for vagrant ssh, ensure that any dotfiles you wish to override are copied to /home/vagrant.
If overriding .bashrc, ensure that the remote shell is started with the interactive flag (if this is true, echo $- will include i).
If overriding .bash_profile, ensure that the remote shell is started as a login shell (if this is true, echo $- will include l).
Due to a legacy project, I am running Windows Server 2008 R2 Standard with Ampps using Vagrant. This is the environment I am stuck using for now...
My issue is that I cannot seem to get PHPStorm to see the interpreter. When I go to the interpreter settings, I select Vagrant and I can choose my vagrant directory that contains the vagrant file and set the local location of the php.exe file. It just gives me an error saying:
PHP Version: Not installed
Debugger: Not installed
When I try to verify the interpreter, I get the error:
Can not update phpinfo: Can't connect to remote host ssh://vagrant#127.0.0.1:22C:\Ampps\php\php.exe
I would assume the issue is that PHPStorm is connecting using ssh instead of rdp.
Is there any work-a-round for this or is this not possible?
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# 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 = "opentable/win-2008r2-standard-amd64-nocm"
config.vm.hostname = "freshHub"
config.vm.communicator = :winrm
# 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
# xdebug
config.vm.network :forwarded_port, host: 33389, guest: 3389, id: "rdp", auto_correct: true
# 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.20"
# 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"
config.vm.network :public_network, ip: "10.1.1.21", :netmask => "255.255.255.0", bridge: 'wlan0'
# 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"
config.vm.synced_folder "~/Sites", "C:/Sites", :mount_options => ["dmode=777","fmode=777"]
# 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.
config.vm.provider "virtualbox" do |vb|
# Set VirtualBox VM Name
vb.name = "freshHub"
# Display the VirtualBox GUI when booting the machine
vb.gui = true
# Customize the amount of memory on the VM:vagrant
vb.memory = "4096"
end
# 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
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
#config.vm.provision :shell, inline: "C:\Ampps\Ampps.exe", run: "always", privileged: false
# C:\Ampps\Ampps.exe
end
You try to connect on your Vagrant OS in loopback IP (127.0.0.1) but your Vagrantfile notice that the IP for him is 192.168.33.20 or 10.1.1.21.
I'm trying to using vagrant for a distributed project on my Home Network. This is the Vagrantfile that I'm using on each host (3 machines in total):
# -*- mode: ruby -*-
# # vi: set ft=ruby :
# Specify minimum Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
# Require YAML module
require 'yaml'
# Read YAML file with box details
servers = YAML.load_file('RaftFS/servers.yaml')
# Create boxes
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Create servers
# Iterate through entries in YAML file
servers.each do |key,value|
#the line below will be different on each machine
if key == "hal9000"
config.vm.define key do |srv|
srv.vm.box = value['box']
#srv.vm.network "private_network", ip: value['ip']
srv.vm.network :public_network, ip:value['ip']
srv.vm.hostname=key
srv.vm.synced_folder ".", "/vagrant" , disabled:true
srv.vm.synced_folder "ServersFS/"+key+"/", "/vagrant/ServersFS" , create: true
srv.vm.synced_folder "./RaftFS", "/vagrant/RaftFS"
srv.vm.provision :shell do |shell|
shell.path = "provision.sh"
shell.args = "'TRUE'"
end
srv.vm.provider :virtualbox do |vb|
vb.name = key
vb.memory = value['ram']
end
end
end
end
end
And this is the servers.yaml:
jarvis:
box: hashicorp/precise32
ram: 512
ip: 192.168.1.200
ftpPort: 8080
diskSpace: 500
skynet:
box: hashicorp/precise32
ram: 512
ip: 192.168.1.201
ftpPort: 8081
diskSpace: 500
hal9000:
box: hashicorp/precise32
ram: 512
ip: 192.168.1.202
ftpPort: 8083
diskSpace: 500
Now, if I ssh each machine and run ifconfig the IP is set correctly. The problem is that if I try contact it in any way it semms to be unreachable, even from the same host machine! In other words, trying to ping the IP address from the shell of the host machine, no response comes from the guest machine.
It looks like you're only setting the hal9000 VM to use a public (or bridged) network (or in fact do any configuration) so the other guests are just using the default host only network which should mean that they only have connection to the host machine and not to each other.
If you take out the:
if key == "hal9000"
line then it should configure things properly.
However, unless you genuinely want the machines to be web facing these VMs should all be in a private network which should work by uncommenting the private networking line you already have there.
I have updated my Vagrantfile to this:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define :ceph do |ceph|
ceph.vm.box = "big-ceph"
ceph.vm.network :private_network, ip: "192.168.251.100"
ceph.vm.hostname = "ceph"
end
config.vm.define :client do |client|
client.vm.box = "hashicorp/precise64"
client.vm.hostname = "ceph-client"
client.vm.provision :shell, path: "setup/ceph.sh"
client.vm.network :private_network, ip: "192.168.251.101"
end
end
but I am still getting this warning message whenever I vagrant up my virtual machines.
calvin % vagrant reload ceph && vagrant reload client
There were warnings and/or errors while loading your Vagrantfile
for the machine 'ceph'.
Your Vagrantfile was written for an earlier version of Vagrant,
and while Vagrant does the best it can to remain backwards
compatible, there are some cases where things have changed
significantly enough to warrant a message. These messages are
shown below.
Warnings:
* `config.vm.customize` calls are VirtualBox-specific. If you're
using any other provider, you'll have to use config.vm.provider in a
v2 configuration block.
Any idea why?
Ok, I figured it out. This 3rd party ceph box that I am using comes with its own Vagrantfile which overrides my Vagrantfile and the included box Vagrantfile (which is located in ~/.vagrant.d/boxes/big-ceph) still contains
config.vm.customize ["modifyvm", :id, "--nictype1", "virtio"]
Comment that out and I no longer see the annoying warning.