vagrant install on Debian Mint Ubuntu Linux RHEL Quick Setup Guide Tutorial

1 - Install Vagrant

apt install vagrant

Make sure you have a supported Virtualization tool like Virtualbox or VMWare, Hyper-V etc..  It automatically detects and uses what you have.  Virtualbox has a lot of support here with tons of images.

2 - Init Vagrant

We'll init to have a Debian 10 box by default to show how quick and easy it is.

vagrant init generic/debian10

2.1 - Customize Vagrantfile Options

 

Note that when we type "vagrant init" it creates a "Vagrantfile" in our present working directory.  This file can be modified to suit our needs to do things like customize RAM, HDD, hostname, network, IP, CPU etc...

Let's strip the Vagrantfile down without the extra comments and see how it looks currently:

cat Vagrantfile|grep -v "^  #"|grep -v ^$|grep -v ^#

Current default Vagrantfile contents:


Vagrant.configure("2") do |config|
  config.vm.box = "generic/debian10"
end

 

All we really have is one parameter which is a generic config of a box called "debian10" which basically is the name of the template we create the VM from.

How To Set Custom Memory RAM and CPU:

Just edit the Vagrantfile as below and change "9096" to the amount of RAM you want in MB and CPUs.

You can see that we added a new config section which is "config.vm.provider "virtualbox" do |vb|

Vagrant.configure("2") do |config|
  config.vm.box = "generic/debian10"
  config.disksize.size = '700GB'
   config.vm.provider "virtualbox" do |vb|
     vb.gui = true
     vb.memory = "9096"
     vb.cpus = "9"

   end
end

To set the disksize you need the plugin that allows us to do this:

One annoying issue about resizing is that some boxes like our Deb10 template is 130GB, it is not able to resize any smaller so you'd get an error on resize if you make smaller than the default disk size.

vagrant plugin install vagrant-disksize

Installing the 'vagrant-disksize' plugin. This can take a few minutes...
Fetching diffy-3.4.2.gem
Fetching xml-simple-1.1.9.gem
Fetching vagrant-libvirt-0.12.2.gem
Fetching vagrant-disksize-0.1.3.gem
Parsing documentation for diffy-3.4.2
Installing ri documentation for diffy-3.4.2
Parsing documentation for xml-simple-1.1.9
Installing ri documentation for xml-simple-1.1.9
Parsing documentation for vagrant-libvirt-0.12.2
Installing ri documentation for vagrant-libvirt-0.12.2
Parsing documentation for vagrant-disksize-0.1.3
Installing ri documentation for vagrant-disksize-0.1.3
Done installing documentation for diffy, xml-simple, vagrant-libvirt, vagrant-disksize after 1 seconds
Installed the plugin 'vagrant-disksize (0.1.3)'!

 

 

3 - Create the Box/VM

vagrant up

 

 

Wait for it to complete.

 

 

Now you can login and get testing.

You should also be able to see the VM accessible in Virtualbox or whatever provider/tool Vagrant installed the VM on.

The default login info for a Vagrant box is as follows:

username: vagrant

password: vagrant

 

 


Here's a list of options we can set as config.vm from the devs:

config.vm.allow_fstab_modification (boolean) - If true, will add fstab entries for synced folders. If false, no modifications to fstab will be made by Vagrant. Note, this may mean that folders will not be automatically mounted on machine reboot. Defaults to true.

config.vm.allow_hosts_modification (boolean) - If false, will prevent Vagrant from writing to /etc/hosts. Defaults to true.

config.vm.allowed_synced_folder_types (array of strings) - A list of allowed synced folder plugins. This will restrict plugin selection when Vagrant is determining the default synced folder type. The elements of the array should be the name of the synced folder plugin.

config.vm.base_mac (string) - The MAC address to be assigned to the default NAT interface on the guest. Support for this option is provider dependent.

config.vm.base_address (string) - The IP address to be assigned to the default NAT interface on the guest. Support for this option is provider dependent.

config.vm.boot_timeout (integer) - The time in seconds that Vagrant will wait for the machine to boot and be accessible. By default this is 300 seconds.

config.vm.box (string) - This configures what box the machine will be brought up against. The value here should be the name of an installed box or a shorthand name of a box in HashiCorp's Vagrant Cloud.

config.vm.box_architecture (string) - The architecture of the box to be used. Supported architecture values: "i386", "amd64", "arm", "arm64", "ppc64le", "ppc64", "mips64le", "mips64", "mipsle", "mips", and "s390x". The special value :auto will detect the host architecture and fetch the appropriate box, if available. When the value is set to nil, it will fetch the box flagged as the default architecture. Defaults to :auto.

config.vm.box_check_update (boolean) - If true, Vagrant will check for updates to the configured box on every vagrant up. If an update is found, Vagrant will tell the user. By default this is true. Updates will only be checked for boxes that properly support updates (boxes from HashiCorp's Vagrant Cloud or some other versioned box).

config.vm.box_download_checksum (string) - The checksum of the box specified by config.vm.box_url. If not specified, no checksum comparison will be done. If specified, Vagrant will compare the checksum of the downloaded box to this value and error if they do not match. Checksum checking is only done when Vagrant must download the box. If this is specified, then config.vm.box_download_checksum_type must also be specified.

config.vm.box_download_checksum_type (string) - The type of checksum specified by config.vm.box_download_checksum (if any). Supported values are currently "md5", "sha1", "sha256", "sha384", and "sha512".

config.vm.box_download_client_cert (string) - Path to a client certificate to use when downloading the box, if it is necessary. By default, no client certificate is used to download the box.

config.vm.box_download_ca_cert (string) - Path to a CA cert bundle to use when downloading a box directly. By default, Vagrant will use the Mozilla CA cert bundle.

config.vm.box_download_ca_path (string) - Path to a directory containing CA certificates for downloading a box directly. By default, Vagrant will use the Mozilla CA cert bundle.

config.vm.box_download_disable_ssl_revoke_best_effort (boolean) - Disable SSL revocation checking from being best effort. If an error is encountered when attempting to check certificate revocation, enabling this option will halt the request. This option is only applied on the Windows platform and defaults to false.

config.vm.box_download_options (map) - A map of extra download options to pass to the downloader. For example, a path to a key that the downloader should use could be specified as {key: ""}. The keys should be options supported by curl using the unshortened form of the flag. For example, use append instead of a. To pass a curl option that does not accept a value, include the option in the map with the value true. For example specify the --fail flag as {fail: true}.

config.vm.box_download_insecure (boolean) - If true, then SSL certificates from the server will not be verified. By default, if the URL is an HTTPS URL, then SSL certs will be verified.

config.vm.box_download_location_trusted (boolean) - If true, then all HTTP redirects will be treated as trusted. That means credentials used for initial URL will be used for all subsequent redirects. By default, redirect locations are untrusted so credentials (if specified) used only for initial HTTP request.

config.vm.box_url (string, array of strings) - The URL that the configured box can be found at. If config.vm.box is a shorthand to a box in HashiCorp's Vagrant Cloud then this value does not need to be specified. Otherwise, it should point to the proper place where the box can be found if it is not installed. This can also be an array of multiple URLs. The URLs will be tried in order.

Note that any client certificates, insecure download settings, and so on will apply to all URLs in this list. The URLs can also be local files by using the file:// scheme. For example: file://tmp/test.box.

config.vm.box_version (string) - The version of the box to use. This defaults to ">= 0" (the latest version available). This can contain an arbitrary list of constraints, separated by commas, such as: >= 1.0, < 1.5. When constraints are given, Vagrant will use the latest available box satisfying these constraints.

config.vm.cloud_init - Stores various cloud_init configurations on the machine.

config.vm.communicator (string) - The communicator type to use to connect to the guest box. By default this is "ssh", but should be changed to "winrm" for Windows guests.

config.vm.disk - Stores various virtual disk configurations on the machine.

config.vm.graceful_halt_timeout (integer) - The time in seconds that Vagrant will wait for the machine to gracefully halt when vagrant halt is called. Defaults to 60 seconds.

config.vm.guest (string, symbol) - The guest OS that will be running within this machine. This defaults to :linux, and Vagrant will auto-detect the proper distro. However, this should be changed to :windows for Windows guests. Vagrant needs to know this information to perform some guest OS-specific things such as mounting folders and configuring networks.

config.vm.hostname (string) - The hostname the machine should have. Defaults to nil. If nil, Vagrant will not manage the hostname. If set to a string, the hostname will be set on boot. If set, Vagrant will update /etc/hosts on the guest with the configured hostname.

config.vm.ignore_box_vagrantfile (boolean) - If true, Vagrant will not load the settings found inside a boxes Vagrantfile, if present. Defaults to false.

config.vm.network - Configures networks on the machine. Please see the networking page for more information.

config.vm.post_up_message (string) - A message to show after vagrant up. This will be shown to the user and is useful for containing instructions such as how to access various components of the development environment.

config.vm.provider - Configures provider-specific configuration, which is used to modify settings which are specific to a certain provider. If the provider you are configuring does not exist or is not setup on the system of the person who runs vagrant up, Vagrant will ignore this configuration block. This allows a Vagrantfile that is configured for many providers to be shared among a group of people who may not have all the same providers installed.

config.vm.provision - Configures provisioners on the machine, so that software can be automatically installed and configured when the machine is created. Please see the page on provisioners for more information on how this setting works.

config.vm.synced_folder - Configures synced folders on the machine, so that folders on your host machine can be synced to and from the guest machine. Please see the page on synced folders for more information on how this setting works.

config.vm.usable_port_range (range) - A range of ports Vagrant can use for handling port collisions and such. Defaults to 2200..2250.

 

 


Tags:

vagrant, install, debian, mint, ubuntu, linux, rhel, tutorial, apt, supported, virtualization, virtualbox, vmware, hyper, etc, automatically, detects, images, init, ll, default, generic, login,

Latest Articles

  • qemu: could not load PC BIOS 'bios-256k.bin' solution
  • Proxmox How To Custom Partition During Install
  • Hyper-V Linux VM Boots to Black Screen, Storage, NIC Not Found Issues
  • Ubuntu Mint How to Fix Missing/Broken /dev and /dev/pts which causes terminal to immediately close exit and not work
  • How high can a Xeon CPU get?
  • bash fix PATH environment variable "command not found" solution
  • Ubuntu Linux Mint Debian Redhat Youtube Cannot Play HD or 4K videos, dropped frames or high CPU usage with Nvidia or AMD Driver
  • hostapd example configuration for high speed AC on 5GHz using WPA2
  • hostapd how to enable and use WPS to connect wireless devices like printers
  • Dell Server Workstation iDRAC Dead after Firmware Update Solution R720, R320, R730
  • Cloned VM/Server/Computer in Linux won't boot and goes to initramfs busybox Solution
  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues