Chef在Windows上下载并安装Oracle Java
我想在Windows7上安装Java with Chef 13 从文件安装很容易,但我也想从Oracle archives下载它。问题是,Oracle需要特殊的cookie-Chef在Windows上下载并安装Oracle Java,java,chef-infra,silent-installer,Java,Chef Infra,Silent Installer,我想在Windows7上安装Java with Chef 13 从文件安装很容易,但我也想从Oracle archives下载它。问题是,Oracle需要特殊的cookie-oraclelicense=accept securebackup cookie 我试过烹饪书,因为人们似乎做得很顺利。Hovewer,运行Chef后,我得到错误: Recipe: java::notify * log[jdk-version-changed] action nothing (skipped due to
oraclelicense=accept securebackup cookie
我试过烹饪书,因为人们似乎做得很顺利。Hovewer,运行Chef后,我得到错误:
Recipe: java::notify
* log[jdk-version-changed] action nothing (skipped due to action :nothing)
Recipe: java::windows
* ruby_block[Enable Accessing cookies] action run
- execute the ruby block Enable Accessing cookies
* remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe] action create[2017-05-25T08:30:21+02:00] WARN: remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe] cannot be downloaded from http://download.oracle.com/otn/java/jdk/7u79-b15/jdk-7u79-windows-i586.exe: 401 "Authorization Required"
[2017-05-25T08:30:21+02:00] WARN: remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe] cannot be downloaded from http://download.oracle.com/otn/java/jdk/7u79-b15/jdk-7u79-windows-i586.exe: 401 "Authorization Required"
================================================================================
Error executing action `create` on resource 'remote_file[C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe]'
================================================================================
Net::HTTPServerException
------------------------
401 "Authorization Required"
Resource Declaration:
---------------------
# In C:/Users/User/.chef/local-mode-cache/cache/cookbooks/java/recipes/windows.rb
62: remote_file cache_file_path do
63: checksum pkg_checksum if pkg_checksum
64: source node['java']['windows']['url']
65: backup false
66: action :create
67: end
68: end
Compiled Resource:
------------------
# Declared in C:/Users/User/.chef/local-mode-cache/cache/cookbooks/java/recipes/windows.rb:62:in `from_file'
remote_file("C:/Users/User\.chef\local-mode-cache\cache/jdk-7u79-windows-i586.exe") do
provider Chef::Provider::RemoteFile
action [:create]
default_guard_interpreter :default
source ["http://download.oracle.com/otn/java/jdk/7u79-b15/jdk-7u79-windows-i586.exe"]
use_etag true
use_last_modified true
declared_type :remote_file
cookbook_name "java"
recipe_name "windows"
path "C:/Users/User\\.chef\\local-mode-cache\\cache/jdk-7u79-windows-i586.exe"
checksum nil
rights nil
deny_rights nil
verifications []
end
System Info:
------------
chef_version=13.0.118
platform=windows
platform_version=6.1.7600
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [i386-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
正如您在上面的日志中所看到的,我已经将['java']['oracle']['accept\u oracle\u download\u terms']
设置为true(执行ruby块启用访问cookie
)
因为这本食谱不适合我,所以我试着做我自己的java食谱:
windows_package package_name do
source source
action :install
installer_type :custom
remote_file_attributes ({
:headers => {"Cookie" => "oraclelicense=accept-securebackup-cookie"}
})
options opts
end
。。。它仍然会得到相同的错误
甲骨文网站上有没有任何改变,导致下载JDK不再有效?或者我必须设置防火墙或其他什么吗?Oracle不时引入类似的更改,不幸的是,这很常见。因为从普通用户的角度看,无法对此做任何事情,所以最好的解决方案是自己托管包,并修改节点属性以指向该源。我就是这么做的,属性看起来像这样(对于linux和samba共享):
这样,像Oracle所做的更改就不再有问题了。我听说Oracle最近做了一些更改,很可能会破坏自动下载。这不太可能是防火墙问题。我真的希望到时候会有另一种方式下载它们。。。你可能有这些信息的来源吗?我想读一读关于它的书,我正试图写一本安装Java的通用食谱——我并没有让每个人都能看到FTP服务器。也许有办法得到这些资源?
"java": {
"install_flavor": "oracle",
"jdk_version": "8",
"jdk" : {
"8" : {
"x86_64" : {
"url" : "file:///path/to/jdk-8u131-linux-x64.tar.gz",
"checksum": "the file's checksum"
}
}
}
}