Wednesday, November 20, 2024
Google search engine
HomeGuest BlogsAdd and Run CentOS 7 on Virtualbox using Vagrant

Add and Run CentOS 7 on Virtualbox using Vagrant

Hello guys. Today we’ll look at How to install centos 7 box with vagrant on virtualbox. Below are the steps to follow
1) First download the Centos 7 vagrant box from the link http://www.vagrantbox.es/. Once the download is complete, create a vagrant folder on your home directory

 mkdir -p ~/vagrant/centos7
 cd ~/vagrant/centos7

2) Now copy the downloaded centos7 vagrant box and put it in the directory you just created.
3) You should have the vagrant already installed, if not installed download vagrant and install it. Have a look at How to install Virtualbox Latest on Ubuntu and Kali Linux

4) Now open the terminal as standard user and cd to directory containing vagrant centos7 box

Add the centos7 box by typing the following command

vagrant box add centos-7.0-x86_64.box --name centos7

Replace centos7 by the name you want the box to have and  centos-7.0-x86_64.box by the name of the box you downloaded.
If the Virtual machine was created on Virtualbox, You’ll should see the message, ” The box successfully added to Virtualbox”.

5) Now create Vagrantfile needed to start the vm by typing”

vagrant init

vagrant%2B1

6)  Edit the Vagrantfile and replace the name of box inside the file with the name you specified in the –name option while creating the vm from the box file.For my case the name is centos7. Use any editor you like, make changes and save them to the file.

vim  Vagrantfile
vagrant2
vagrant%2B6

7) Now it’s time to start the added box. Use the command

vagrant up

8) Login to the CentOS 7 Virtual Machine with the command

vagrant ssh

You can see that i have successfully login to the Centos 7 box on Virtualbox from the Screen-shot below. You can do system update and upgrade.

vagrant3
vagrant%2B4

9) Next time you want to ssh in to the Centos 7 box added, just cd to the directory you created and  do

vagrant ssh

Watch the Video Below for More details and Clarification.

RELATED ARTICLES

Most Popular

Recent Comments