Skip to main content

Configuring VM Properties

1. Setting Hostname (config.vm.hostname)

Property Value Description
config.vm.hostname "myapp.local" Hostname to set for the guest machine

Example: Setting Hostname

vagrant<span>.</span>config<span>.</span>vm<span>.</span>hostname = "myapp.local"

2. Configuring Boot Timeout (config.vm.boot_timeout)

Property Value Description
config.vm.boot_timeout 120 Seconds to wait for VM to boot before timing out

Example: Setting Boot Timeout

vagrant<span>.</span>config<span>.</span>vm<span>.</span>boot_timeout = 120

3. Setting Graceful Halt Timeout (config.vm.graceful_halt_timeout)

Property Value Description
config.vm.graceful_halt_timeout 60 Seconds to wait for graceful shutdown before force halt

Example: Setting Graceful Halt Timeout

vagrant<span>.</span>config<span>.</span>vm<span>.</span>graceful_halt_timeout = 60

4. Configuring Post-Up Message (config.vm.post_up_message)

Property Value Description
config.vm.post_up_message "Welcome to the development environment!" Message displayed after VM is up and running

Example: Setting Post-Up Message

vagrant<span>.</span>config<span>.</span>vm<span>.</span>post_up_message = "Welcome to the development environment!"

5. Setting SSH Username (config.ssh.username)

Property Value Description
config.ssh.username "vagrant" SSH username to connect to the guest machine

Example: Setting SSH Username

vagrant<span>.</span>config<span>.</span>ssh<span>.</span>username = "vagrant"

6. Disabling Default Synced Folder

Property Value Description
config.vm.synced_folder false Disables default synced folder behavior

Example: Disabling Default Synced Folder

vagrant<span>.</span>config<span>.</span>vm<span>.</span>synced_folder = false

7. Setting Guest OS Type (config.vm.guest)

Property Value Description
config.vm.guest "linux" Guest operating system type (e.g., linux, windows)

Example: Setting Guest OS Type

vagrant<span>.</span>config<span>.</span>vm<span>.</span>guest = "linux"

8. Configuring Communicator

Property Value Description
config.vm.communicator "ssh" Communicator to use for provisioning (ssh or winrm)

Example: Configuring Communicator

vagrant<span>.</span>config<span>.</span>vm<span>.</span>communicator = "ssh"

9. Setting Box Architecture (config.vm.box_architecture)

Property Value Description
config.vm.box_architecture "x86_64" Architecture of the box to use (e.g., x86_64, arm64)

Example: Setting Box Architecture

vagrant<span>.</span>config<span>.</span>vm<span>.</span>box_architecture = "x86_64"

10. Using Vagrant Cloud (vagrant cloud)

Property Value Description
vagrant cloud https://app.vagrantup.com Official Vagrant Cloud service for sharing boxes and configurations

Example: Using Vagrant Cloud

vagrant<span>.</span>cloud<span>.</span>box = "hashicorp/precise64"

Was this article helpful?