joesan
joesan

Reputation: 15385

Error when setting up Java dev environment with Vagrant

I have the following Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|

  config.vm.box = "ubuntu/trusty64"
  config.vm.network "private_network", ip: "55.55.55.102"
  config.vm.synced_folder ".", "/home/vagrant/shared/"

  #config.vm.provision "file", source: "conf/sbt.sh", destination: "/home/vagrant/bin/sbt"

  config.vm.provision "shell", inline: <<-SHELL    
    #
    # Update and install basic linux programs for development
    #
    sudo apt-get update     
    sudo apt-get install -y wget
    sudo apt-get install -y curl
    sudo apt-get install -y vim
    sudo apt-get install -y git    
    sudo apt-get install -y build-essential
    sudo apt-get install -y unzip 
    #
    # Install Java 8 
    #
    cd /opt
    sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz"
    sudo tar -xzvf jdk-8u45-linux-x64.tar.gz
    sudo rm -rf jdk-8u45-linux-x64.tar.gz
  SHELL

end

I get the following error:

==> default: --2016-04-07 12:15:44--  http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
==> default: Resolving download.oracle.com (download.oracle.com)... 
==> default: 217.7.48.90
==> default: , 
==> default: 217.7.48.190
==> default: Connecting to download.oracle.com (download.oracle.com)|217.7.48.90|:80... 
==> default: connected.
==> default: HTTP request sent, awaiting response... 
==> default: 302 Moved Temporarily
==> default: Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz [following]
==> default: --2016-04-07 12:15:47--  https://edelivery.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
==> default: Resolving edelivery.oracle.com (edelivery.oracle.com)... 
==> default: failed: Name or service not known.
==> default: wget: unable to resolve host address ‘edelivery.oracle.com’

Any clues as to why I get this error?

Upvotes: 0

Views: 422

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53713

  1. you do not need sudo in your script as the script already runs as root user. you can check https://stackoverflow.com/a/36384265/4296747 for some more info/example

  2. Just untar the file is not enough to get it installed but I guess you'll be moving once you pass the current issue

  3. I tried with your exact same file and it works but I don't think setting private IP as "55.55.55.102" is a good practice

I would make change to the network part - try to use a bridge adapter to see if you pass the issue, if you need private IP, take one in range 192.168.xxx.xxx

Upvotes: 1

Related Questions