gpt4 book ai didi

java - 使用 Vagrant 设置 Java 开发环境时出错

转载 作者:行者123 更新时间:2023-12-01 10:05:58 25 4
gpt4 key购买 nike

我有以下 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

我收到以下错误:

==> 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’

有什么线索可以解释为什么我会收到此错误吗?

最佳答案

  1. 您的脚本中不需要 sudo,因为脚本已经以 root 用户身份运行。您可以查看https://stackoverflow.com/a/36384265/4296747了解更多信息/示例

  2. 仅仅解压文件不足以安装它,但我想一旦你通过了当前的问题,你就会搬家

  3. 我尝试使用与您完全相同的文件,它可以工作,但我不认为将私有(private) IP 设置为“55.55.55.102”是一个好的做法

我会更改网络部分 - 尝试使用桥接适配器看看是否可以解决问题,如果您需要私有(private) IP,请在 192.168.xxx.xxx 范围内使用一个

关于java - 使用 Vagrant 设置 Java 开发环境时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36475976/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com