简体   繁体   English

如何在不使用PPA的情况下使用Ansible安装Java 8

[英]How to Install Java 8 Using Ansible Without PPA

I normally would install Java 8 with Ansible with the following code: 我通常会使用以下代码使用Ansible安装Java 8:

---
- name: Install add-apt-repostory
  become: yes
  apt: name=software-properties-common state=latest

- name: Add Oracle Java Repository
  become: yes
  apt_repository: repo='ppa:webupd8team/java'

- name: Accept Java 8 License
  become: yes
  debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'

- name: Install Oracle Java 8
  become: yes
  apt: name={{item}} state=latest
  with_items:
    - oracle-java8-installer
    - ca-certificates
    - oracle-java8-set-default

Ref. 参考 the following stacked overflow question for original author. 以下是原始作者的堆积式溢出问题。

How to install Oracle Java 8 using Ansible 如何使用Ansible安装Oracle Java 8

However, since the Oracle JDK License has changed for releases on April 16, 2019. This PPA has been discontinued and my ansible code now returns the following error when attempting to install Java 8... 但是,由于Oracle JDK许可证已于2019年4月16日发布,因此已更改。此PPA已终止,并且在尝试安装Java 8时,我的ansible代码现在返回以下错误...

Package oracle-java8-installer is not available, but is referred to by another package. 软件包oracle-java8-installer不可用,但由另一个软件包引用。 This may mean that the package is missing, has been obsoleted, or is only available from another source 这可能意味着该软件包已丢失,已被废弃或只能从其他来源获得

E: Package 'oracle-java8-installer' has no installation candidate E:软件包“ oracle-java8-installer”没有安装候选

Does anyone know how to automate the installation of Java 8 with Ansible now that the PPA has been discontinued and the Oracle Licences have changed? 既然PPA已停止使用并且Oracle许可证已更改,是否有人知道如何使用Ansible自动化Java 8的安装?

In my case, I sign up for oracle account then download the .rpm/.tar.gz package directly from Oracle into one of my PC. 就我而言,我注册了oracle帐户,然后直接从Oracle将.rpm / .tar.gz软件包下载到我的一台PC中。 I transfer the files to an ansible control server and use ansible playbook to distribute the files to other remote servers using copy module. 我将文件传输到ansible控制服务器,并使用ansible剧本使用复制模块将文件分发到其他远程服务器。 Finally I write the ansible role to extract and install them locally using the following methods. 最后,我使用以下方法编写了ansible角色,以将其提取并本地安装。

CentOS: You can easily use yum to install the rpm package. CentOS:您可以轻松地使用yum安装rpm软件包。

Ubuntu: Follow these steps. Ubuntu:请遵循以下步骤。 https://www.vultr.com/docs/how-to-manually-install-java-8-on-ubuntu-16-04 https://www.vultr.com/docs/how-to-manually-install-java-8-on-ubuntu-16-04

It's not quite a good way since you need to transfer the installer to each server. 这不是一个好方法,因为您需要将安装程序转移到每个服务器。 I too still looking for a way to use script to download from the oracle website directly, but there is no way to do without sign on authentication. 我也仍然在寻找一种使用脚本直接从oracle网站下载的方法,但是没有登录验证就没有办法。

You havr to download JDK (Java Devolpment Kit) and install. 您需要下载并安装JDK(Java开发工具包)。 There is a file of name readme or something like this in text format. 有一个名为readme或类似文本格式的文件。 Then copy the text and paste. 然后复制文本并粘贴。 This type of info you can find easily on internet. 您可以在互联网上轻松找到此类信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM