{"id":1355,"date":"2017-04-17T22:03:08","date_gmt":"2017-04-17T16:33:08","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=1355"},"modified":"2026-09-08T10:26:35","modified_gmt":"2026-09-08T04:56:35","slug":"simple-guide-start-using-vagrant-virtualbox","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/simple-guide-start-using-vagrant-virtualbox\/","title":{"rendered":"Simple guide to start using Vagrant with VirtualBox"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Vagrant is an open-source tool used to create, configure, and manage virtual machines through simple commands. It works with virtualization providers such as VirtualBox, VMware, Hyper-V, and Docker.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Vagrant makes it easier to create repeatable development environments, reducing the time required to manually configure virtual machines.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we will cover how to install Vagrant with VirtualBox and create, access, stop, and delete a virtual machine.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Use Vagrant?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Vagrant simplifies the process of creating and managing virtual development environments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of manually installing and configuring a virtual machine every time, you can use a <code>Vagrantfile<\/code> and a few Vagrant commands to create the environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some common benefits include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Quick virtual machine setup<\/li>\n\n\n\n<li>Repeatable development environments<\/li>\n\n\n\n<li>Easy configuration management<\/li>\n\n\n\n<li>Simple VM lifecycle management<\/li>\n\n\n\n<li>Easy sharing and reuse of development environments<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before starting, make sure:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>VirtualBox is installed on your system.<\/li>\n\n\n\n<li>Vagrant is installed.<\/li>\n\n\n\n<li>Your system has sufficient disk space and memory for the virtual machine.<\/li>\n\n\n\n<li>Basic knowledge of virtualization is helpful.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install VirtualBox<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Download VirtualBox from:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">https:\/\/www.virtualbox.org\/wiki\/Downloads<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Select the appropriate <strong>platform package<\/strong> for your operating system and install VirtualBox.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Install Vagrant<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Download Vagrant from:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">https:\/\/www.vagrantup.com\/downloads.html<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Select the package appropriate for your operating system and complete the installation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Managing Virtual Machines<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Create Your First Vagrant VM<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a directory for the Vagrant project:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir centos-vm &amp;&amp; cd centos-vm<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add a CentOS Vagrant box:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant box add centos https:\/\/github.com\/CommanderK5\/packer-centos-template\/releases\/download\/0.6.7\/vagrant-centos-6.7.box<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">==> box: Adding box 'centos' (v0) for provider:\n\n    box: Downloading: https:\/\/github.com\/CommanderK5\/packer-centos-template\/releases\/download\/0.6.7\/vagrant-centos-6.7.box\n\n==> box: Successfully added box 'centos' (v0) for 'virtualbox'!<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Initialize the Vagrant environment:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant init centos<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This creates a <code>Vagrantfile<\/code> in the current directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">A `Vagrantfile` has been placed in this directory. You are now\nready to `vagrant up` your first virtual environment!<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start the virtual machine:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant up<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Vagrant will create and start the VM using VirtualBox.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The CentOS 6.7 box used in the original example is an old image. For new environments, use a current and trusted Vagrant box that matches your project requirements.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">You can find other Vagrant boxes at:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/www.vagrantbox.es\/\" target=\"_blank\" rel=\"noopener\">http:\/\/www.vagrantbox.es\/<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Access the Virtual Machine<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use the <code>vagrant ssh<\/code> command to connect to the VM:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant ssh<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Last login: Mon Mar 20 13:49:26 2017 from 10.0.2.2\n\n[vagrant@localhost ~]$ cat \/etc\/redhat-release\n\nCentOS release 6.7 (Final)\n\n[vagrant@localhost ~]$<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Shut Down the Virtual Machine<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To gracefully stop the VM:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant halt<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">==> default: Attempting graceful shutdown of VM...<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Delete the Virtual Machine<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To destroy the VM and its associated resources:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant destroy<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Vagrant asks for confirmation before deleting the VM:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">default: Are you sure you want to destroy the 'default' VM? [y\/N] y\n\n==> default: Destroying VM and associated drives...<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Vagrant simplifies virtual machine management by allowing you to create and control development environments using a small set of commands.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With VirtualBox and Vagrant, you can quickly create a VM, access it using SSH, shut it down when it is not required, and remove it when you are finished. This makes Vagrant useful for repeatable development and testing environments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">1. What is Vagrant used for?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Vagrant is used to create and manage reproducible virtual development environments using configuration files and simple commands.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. Does Vagrant require VirtualBox?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">No. Vagrant can work with several providers, including VirtualBox, VMware, Hyper-V, and others. VirtualBox is one of the commonly used providers.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. Which command starts a Vagrant VM?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant up<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">4. How do I access a Vagrant VM?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant ssh<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">5. How do I remove a Vagrant VM?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Use:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vagrant destroy<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install Nginx, PHP-FPM, and MariaDB on CentOS 7<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Learn how to install and configure Nginx, PHP-FPM, and MariaDB on a CentOS 7 server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/install-nginx-php-fpm-mariadb-on-centos-7\/\">https:\/\/pheonixsolutions.com\/blog\/install-nginx-php-fpm-mariadb-on-centos-7\/<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">DKIM Setup for Postfix Mail Server on CentOS 6.7<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Learn how to configure DKIM for a Postfix mail server running on CentOS 6.7.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/dkim-setup-postfix-mailserver-centos-6-7\/\">https:\/\/pheonixsolutions.com\/blog\/dkim-setup-postfix-mailserver-centos-6-7\/<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team&nbsp;<a href=\"https:\/\/pheonixsolutions.com\/contact\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Vagrant is an open-source tool used to create, configure, and manage virtual machines through simple commands. It works with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022,1024],"tags":[161,325,326],"class_list":["post-1355","post","type-post","status-publish","format-standard","hentry","category-web-architecture","category-security","tag-centos","tag-vagrant","tag-virtualbox","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-lR","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1355"}],"version-history":[{"count":3,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1355\/revisions"}],"predecessor-version":[{"id":11517,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1355\/revisions\/11517"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}