Install VirtualBox and Vagrant on Ubuntu 16.04LTS

First job is to download VirtualBox. We can go to the link by googling VirtualBox. This is where it should take us.

If we click on the download button (the really big button), we will go to this page. We can see download options for different distribution.

As I am using Ubuntu 16.04LTS, I am selecting ‘Linux distribution’. This will bring the following page.

I will select the i386 for Ubuntu 16.04. I will save and download.

I have the downloaded file on my desktop. This is a *.deb file, so I can double click on the file and this will bring and installment prompt like this. Clicking the Install button should start the installation process.

If the installation is complete we should be able to find virtualbox using the search.

Clicking on this will open the virtualbox window.

Done!

There is another simple way to install it from the terminal (the usual way). As I have already installed virtualbox, it will do basically nothing.

shanto@shanto:~$ sudo apt-get install virtualbox
[sudo] password for shanto: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
virtualbox is already the newest version (5.0.40-dfsg-0ubuntu1.16.04.1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic
  linux-headers-4.10.0-33 linux-headers-4.10.0-33-generic
  linux-headers-4.10.0-35 linux-headers-4.10.0-35-generic
  linux-image-4.10.0-28-generic linux-image-4.10.0-33-generic
  linux-image-4.10.0-35-generic linux-image-extra-4.10.0-28-generic
  linux-image-extra-4.10.0-33-generic linux-image-extra-4.10.0-35-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
shanto@shanto:~$ 

Done with VirtualBox.

Now we need to install Vagrant. If we go to the download page it will show the following webpage.

As I am using Ubuntu and my laptop and the OS (so is the processor) is 64 bit, I will select the 64 bit Debian one. This will download a *deb file and we can install it (by double clicking).

If we click on the ‘Install’ button, it will ask for password and we should be good to to go.

Now I need to install a plug-in. So I use the following command.

shanto@shanto:~$ vagrant plugin install vagrant-berkshelf

I expected it to work properly. However, on the terminal I got the following.

shanto@shanto:~$ vagrant plugin install vagrant-berkshelf
Installing the 'vagrant-berkshelf' plugin. This can take a few minutes...
/usr/lib/ruby/2.3.0/rubygems/specification.rb:946:in `all=': undefined method `group_by' for nil:NilClass (NoMethodError)
	from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:275:in `with_isolated_gem'
	from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:231:in `internal_install'
	from /usr/lib/ruby/vendor_ruby/vagrant/bundler.rb:102:in `install'
	from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:62:in `block in install_plugin'
	from /usr/lib/ruby/vendor_ruby/vagrant/plugin/manager.rb:72:in `install_plugin'
	from /usr/share/vagrant/plugins/commands/plugin/action/install_gem.rb:37:in `call'
	from /usr/lib/ruby/vendor_ruby/vagrant/action/warden.rb:34:in `call'
	from /usr/lib/ruby/vendor_ruby/vagrant/action/builder.rb:116:in `call'
	from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `block in run'
	from /usr/lib/ruby/vendor_ruby/vagrant/util/busy.rb:19:in `busy'
	from /usr/lib/ruby/vendor_ruby/vagrant/action/runner.rb:66:in `run'
	from /usr/share/vagrant/plugins/commands/plugin/command/base.rb:14:in `action'
	from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:32:in `block in execute'
	from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `each'
	from /usr/share/vagrant/plugins/commands/plugin/command/install.rb:31:in `execute'
	from /usr/share/vagrant/plugins/commands/plugin/command/root.rb:56:in `execute'
	from /usr/lib/ruby/vendor_ruby/vagrant/cli.rb:42:in `execute'
	from /usr/lib/ruby/vendor_ruby/vagrant/environment.rb:268:in `cli'
	from /usr/bin/vagrant:173:in `<main>'

I searched and found it is a common problem that people are facing. They say they will solve this issue in the next release, but I don’t see it yet. I found two of solving that, from the lifesaver StackOveerflow. I will try the easier one (not manual patching). I will rather install Vagrant vagrant v1.8.0 on my Ubuntu 16.04. Before installing again, I would like to remove what I installed.

shanto@shanto:~$ rm -rf /opt/vagrant
shanto@shanto:~$ rm -f /usr/bin/vagrant
rm: cannot remove '/usr/bin/vagrant': Permission denied
shanto@shanto:~$ sudo rm -f /usr/bin/vagrant
[sudo] password for shanto: 
shanto@shanto:~$ 

Then I try to download the file. It will take a minute or couple depending on the Internet speed.

shanto@shanto:$ wget https://releases.hashicorp.com/vagrant/1.8.0/vagrant_1.8.0_x86_64.deb
--2017-11-08 09:31:00--  https://releases.hashicorp.com/vagrant/1.8.0/vagrant_1.8.0_x86_64.deb
Resolving releases.hashicorp.com (releases.hashicorp.com)... 2a04:4e42:d::439, 151.101.53.183
Connecting to releases.hashicorp.com (releases.hashicorp.com)|2a04:4e42:d::439|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 75502560 (72M) [application/x-debian-package]
Saving to: ‘vagrant_1.8.0_x86_64.deb’

vagrant_1.8.0_x86_64.deb         100%[=======================================================>]  72.00M  1.42MB/s    in 59s     

2017-11-08 09:31:59 (1.23 MB/s) - ‘vagrant_1.8.0_x86_64.deb’ saved [75502560/75502560]

shanto@shanto:$ 


Now I install it using the package manager.

shanto@shanto:~$ sudo dpkg -i vagrant_1.8.0_x86_64.deb
[sudo] password for shanto: 
(Reading database ... 515861 files and directories currently installed.)
Preparing to unpack vagrant_1.8.0_x86_64.deb ...
Unpacking vagrant (1:1.8.0) over (1.8.1+dfsg-1) ...
Setting up vagrant (1:1.8.0) ...
Processing triggers for man-db (2.7.5-1) ...
shanto@shanto:~$ 


Now I have to install the plug-in I wanted to use.

shanto@shanto:~$ vagrant plugin install vagrant-berkshelf
Installing the 'vagrant-berkshelf' plugin. This can take a few minutes...
Installed the plugin 'vagrant-berkshelf (5.1.2)'!
Post install message from the 'vagrant-berkshelf' plugin:

The Vagrant Berkshelf plugin requires Berkshelf from the Chef Development Kit.
You can download the latest version of the Chef Development Kit from:

    https://downloads.chef.io/chefdk

Installing Berkshelf via other methods is not officially supported.

shanto@shanto:~$

shanto@shanto:~/Desktop/Big Data/732/vm-cluster-master/cluster_setup$ vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'hadoop1' up with 'virtualbox' provider...
Bringing machine 'hadoop2' up with 'virtualbox' provider...
Bringing machine 'hadoop3' up with 'virtualbox' provider...
Bringing machine 'hadoop4' up with 'virtualbox' provider...
==> master: Box 'ubuntu/xenial64' could not be found. Attempting to find and install...
    master: Box Provider: virtualbox
    master: Box Version: >= 20160921.0.0
==> master: Loading metadata for box 'ubuntu/xenial64'
    master: URL: https://atlas.hashicorp.com/ubuntu/xenial64
==> master: Adding box 'ubuntu/xenial64' (v20171107.2.0) for provider: virtualbox
    master: Downloading: https://vagrantcloud.com/ubuntu/boxes/xenial64/versions/20171107.2.0/providers/virtualbox.box
==> master: Successfully added box 'ubuntu/xenial64' (v20171107.2.0) for 'virtualbox'!
Vagrant Berkshelf could not find the 'berks' executable in your PATH.

Please download and install the latest version of the ChefDK from:

    https://downloads.chef.io/chef-dk

and follow the installation instructions. Do not forget to add the ChefDK to
your PATH.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s