How to install Vagrant on CentOS 8

Vagrant is a command line tool for building and managing virtual development environments. By default, Vagrant prepares the environment on VirtualBox, Hyper-V, and Docker. Support other providers, for example, Libvirt (KVM), VMware and AWS can be enabled through the Vagrant plug-in system.

Vagrant is usually used by developers to build a development environment that matches the production environment.

In this guide, we will explain how to install Vagrant on CentOS 8. We will also show you how to create a development environment.

1. Install Vagrant on CentOS 8

At the time of writing this article, the latest stable version of Vagrant is 2.2.6. Browse Vagrant download page to see if a new version is available.

To install Vagrant on your CentOS machine, enter the following command as root or another sudo user:

sudo dnf install https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.rpm

Once the installation is complete, run the following command to verify that Vagrant was successfully installed:

vagrant --version

This command will print the Vagrant version number:

Vagrant 2.2.6

2. Getting Started with Vagrant##

Now assuming that you have installed Vagrant on your CentOS system, let's use VirtualBox to create a development environment, which is the default provider of Vagrant. Make sure you have installed VirtualBox on your CentOS 8 system.

The first step is to create a directory as the project root directory. Create a project directory and switch to it:

mkdir ~/my-vagrant-project
cd ~/my-vagrant-project

The next step is to use vagrant init to initialize a new Vagrantfile and specify the box you want to use. Vagrantfile is a configuration file that is used to describe how the virtual machine is configured and allocated. It uses Ruby syntax to define configuration files.

The box is a package format used in the Vagrant environment. You can find a series of publicly available Vagrant boxes in Vagrant box catalog

In this example, we use ubuntu/bionic64. Run the following command to initialize a new Vagrantfile:

vagrant init ubuntu/bionic64
A `Vagrantfile` has been placed inthis 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.

You can open Vagrantfile with your text editor and make adjustments according to your needs.

Run the vagrant up command to create and configure the virtual machine defined in the Vagrantfile.

vagrant up
==> default: Configuring and enabling network interfaces...default: SSH address:192.168.121.24:22default: SSH username: vagrant
 default: SSH auth method:private key
==> default: Rsyncing folder:/home/linuxize/Vagrant/my-vagrant-project/=>/vagrant

If the box does not exist locally, it will be downloaded automatically. Vagrant also mounts the project directory to the /vagrant of the virtual machine, which allows you to continue working on the host.

To enter the virtual machine via ssh, enter:

vagrant ssh

When you are done, stop the virtual machine and run:

vagrant halt

Use the following command to destroy the virtual machine and related resources:

vagrant destroy

If the virtual machine is running, it will be stopped first and then removed.

Three, summary##

We have shown you how to install Vagrant on CentOS 8 and how to create a basic development environment.

To learn more about Vagrant, visit Vagrant official documentation page.

Recommended Posts

How to install Vagrant on CentOS 8
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install Apache Maven on CentOS 8
How to install Apache Kafka on CentOS 7
[Graphic] How to install tomcat on centos
R&D: How To Install Python 3 on CentOS 7
How to install GCC compiler on CentOS 7
How to install offline JDK1.8 on centos7.0
How to install Visual Studio Code on CentOS 8
How to install and use Docker on CentOS 7
How to install RPM packages on CentOS Linux
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8
How to install VirtualBox client extension on CentOS 8
How to install Docker CE on RHEL 8 / CentOS 8
How to install and uninstall tomcat on centos
How to install and configure Redmine on CentOS 8
How to install Ruby on Ubuntu 20.04