Tuesday, November 22, 2016

Linux in the Vagrant and VirtualBox environment


The whole is greater than the sum of its parts.


Introduction 

There are many ways to install Linux on a desktop PC. A freshly installed Linux can be a powerful environment, in particular. However, when you want to develop or just experiment with some software packages in a variety of operating systems, it is very time consuming to reinstall each operating system using a CD-ROM/DVD.

Vagrant (http://www.vagrantup.com) is an extremely useful tool for those who wish to experiment with Linux on a Win PC. A combination of Vagrant and VirtualBox (http://www.virtualbox.org) is a powerful tool which makes the installation of Linux possible with a couple of commands.

Basically, VirtualBox is a software package which allows you to virtualize another PC on one PC. With the help of VirtualBox, you can run Win on Linux and vice versa. Sometimes, you may wish to have a fresh copy of a certain version of Linux to repeat your experiment for debugging purposes.

 <Win on Ubuntu>


Installing Vagrant and VirtualBox

The two software packages can be downloaded from http://www.vagrantup.com and http://www.virtualbox.org. You can follow the standard installation method, depending on your host PC environment.

How to install CentOS 6 on Ubuntu  

Once you have Vagrant and VirtualBox installed, you can create a virtual machine (guest), quite easily by running the following commands:



mict@mict:~$ mkdir centos6
mict@mict:~$ cd centos6
mict@mict:~/centos6$ vagrant init centos/6
A `Vagrantfile` has been placed in this 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.
mict@mict:~/centos6$ 

mict@mict:~/centos6$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'centos/6'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'centos/6' is up to date...
==> default: A newer version of the box 'centos/6' is available! You currently
==> default: have version '1609.01'. The latest is version '1610.01'. Run
==> default: `vagrant box update` to update.
==> default: Setting the name of the VM: centos6_default_1479801951475_89912
... [deleted] ...
default: This is not an error message; everything may continue to work properly,
default: in which case you may ignore this message.
==> default: Rsyncing folder: /home/mict/centos6/ => /vagrant
mict@mict:~/centos6$


Login to the CentOS 6 virtual machine

You can now login to the virtual machine you have just created. The default id and password are vagrant/vagrant.

mict@mict:~/centos6$ vagrant ssh
[vagrant@localhost ~]$


A complete CentOS 6 with GUI on Ubuntu will be shown in another post ...


No comments:

Post a Comment