Nikolay  Shalnev
Nikolay Shalnev

Reputation: 11

How install vagrant 2.2.0 on ubuntu 18.04?

I have problem from install vagrant on ubuntu 18.04.

I download vagrant 2.2.0 => install his.

But have error run vagrant up

> ==> default: Destroying VM and associated drives...  /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/agent.rb:128:in
> `block in identities': can't modify frozen NilClass (RuntimeError) 
> from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/agent.rb:122:in
> `times'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/agent.rb:122:in
> `identities' from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/key_manager.rb:104:in
> `each_identity'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/methods/publickey.rb:19:in
> `authenticate'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:85:in
> `block in authenticate'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:71:in
> `each'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh/authentication/session.rb:71:in
> `authenticate'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/net-ssh-5.0.2/lib/net/ssh.rb:246:in
> `start'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/communicators/ssh/communicator.rb:415:in
> `block (2 levels) in connect'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:93:in `block in
> timeout'  from /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:33:in
> `block in catch'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:33:in `catch'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:33:in `catch'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:108:in `timeout'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/communicators/ssh/communicator.rb:389:in
> `block in connect'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/lib/vagrant/util/retryable.rb:17:in
> `retryable'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/communicators/ssh/communicator.rb:388:in
> `connect'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/communicators/ssh/communicator.rb:84:in `block in wait_for_ready'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:93:in `block in
> timeout'  from /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:33:in
> `block in catch'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:33:in `catch'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:33:in `catch'  from
> /opt/vagrant/embedded/lib/ruby/2.4.0/timeout.rb:108:in `timeout'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/plugins/communicators/ssh/communicator.rb:62:in `wait_for_ready'  from
> /opt/vagrant/embedded/gems/2.2.0/gems/vagrant-2.2.0/lib/vagrant/action/builtin/wait_for_communicator.rb:16:in
> `block in call'

"Vagrant up --debug" ends the same way. I tried to put the gems separately, but it does not help.

What am i doing wrong?

Upvotes: 0

Views: 1608

Answers (3)

Gitau Harrison
Gitau Harrison

Reputation: 3517

To confirm whether you have vagrant installed or not, run

$ vagrant --version

Personally check for the latest available developer version (as mentioned), consider HashiCorp Downloads. Find one appropriate for your OS.

Install Vagrant on Ubuntu 18.04

Install virtualbox which allows you to run an OS on top of another OS by creating a virtual OS

$ sudo apt install virtualbox

Look for any updates before downloading vagrant:

$ sudo apt update
$ curl -O https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_x86_64.deb

Note: You can get the version you want by replacing 2.2.10 to 2.2.x. This will download the version (or latest version) after checking the downloads page.

Once the .deb is downloaded, install vagrant by running:

$ sudo apt install ./vagrant_2.2.10_x86_64.deb

Again, making sure that you look at the version you downloaded earlier (2.2.x)

Verify vagrant installation

$ vagrant --version

Getting started with Vagrant

$ mkdir my_new_project
$ cd my_new_project

Next, initialize a new Vagrantfile using vagrant init and specify the box you want to use. Boxes are the package format for the Vagrant environments and are provider-specific. You can find a list of publicly available Vagrant Boxes on the Vagrant box catalog page.

$ vagrant init ubuntu/bionic64

Better still, while within your project directory, you can create a VagrantFile and add vagrant configurations there as follows:

$ touch Vagrantfile

Your configurations, specifying your preferred box (and, by extension) your IP:

Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/bionic64"
    config.vm.network "private_network", ip: "x.x.x.x"
    config.vm.provider "virtualbox" do |vb|
        vb.memory =  '1024'
    end
end

Run the vagrant up command to create and configure the virtual machine as specified in the vagrant file:

$ vagrant up

Vagrant also mounts the project directory at /vagrant in the virtual machine which allows you to work on your project’s files on your host machine.To ssh into the virtual machine, run:

$ vagrant ssh

You can stop the virtual machine with the following command:

$ vagrant halt

Terminally, you can stop the machine from running and destroy all the resources created using:

$ vagrant destroy

Uninstall vagrant

If at one point you would like to uninstall vagrant, you can run these commands (adding sudo privileges if you'd want):

$ rm -rf /opt/vagrant
$ rm -f /usr/bin/vagrant

Check for successful uninstall:

$ which vagrant

Upvotes: 3

Touseef Murtaza
Touseef Murtaza

Reputation: 1956

You need to remove vagrant gem by doing gem uninstall vagrant after that you should install it system wide, in ubuntu you can download your deb file from https://www.vagrantup.com/downloads.html After successful installation of vagrant you can use command vagrant init hashicorp/precise64 to create a VegrantFile which contains information about your Virtual Machine.

Now boot-up your VM through vagrant by running vagrant up, if you want to ssh then type vagrant ssh.

P.S. I am using Ubuntu 18.04, please make sure you will not get into trouble after gem uninstall.

Upvotes: 0

Nikolay  Shalnev
Nikolay Shalnev

Reputation: 11

Problem fix. Found a solution to the problem in this issue https://github.com/hashicorp/vagrant/issues/10119

Upvotes: 0

Related Questions