rpm安装JDK方法

  • 由于版权原因,Linux发行版并没有包含官方版的Oracle JDK,必须自己从官网上下载安装。Oracle官网用Cookie限制下载方式,使得眼下只能用浏览器进行下载,使用其他方式可能会导致下载失败。但还是有方法可以在Linux进行下载的,本文以wget为例。
  • 我们需要三个参数:–no-check-certificate、–no-cookies、–header,通过man wget命令可以查到。
  • 用于禁止检查证书
--no-check-certificate
       Don‘t check the server certificate against the available certificate authorities.  Also don‘t require the URL host name to match the common name presented by the certificate.

       As of Wget 1.10, the default is to verify the server‘s certificate against the recognized certificate authorities, breaking the SSL handshake and aborting the download if the verification fails.  Although this provides more secure downloads, it does
       break interoperability with some sites that worked with previous Wget versions, particularly those using self-signed, expired, or otherwise invalid certificates.  This option forces an "insecure" mode of operation that turns the certificate
       verification errors into warnings and allows you to proceed.

       If you encounter "certificate verification" errors or ones saying that "common name doesn‘t match requested host name", you can use this option to bypass the verification and proceed with the download.  Only use this option if you are otherwise
       convinced of the site‘s authenticity, or if you really don‘t care about the validity of its certificate.  It is almost always a bad idea not to check the certificates when transmitting confidential or important data.
  • 用于禁用Cookies
--no-cookies
       Disable the use of cookies.  Cookies are a mechanism for maintaining server-side state.  The server sends the client a cookie using the "Set-Cookie" header, and the client responds with the same cookie upon further requests.  Since cookies allow the
       server owners to keep track of visitors and for sites to exchange this information, some consider them a breach of privacy.  The default is to use cookies; however, storing cookies is not on by default.
  • 用于定义请求头信息
--header=header-line
       Send header-line along with the rest of the headers in each HTTP request.  The supplied header is sent as-is, which means it must contain name and value separated by colon, and must not contain newlines.

       You may define more than one additional header by specifying --header more than once.

               wget --header=‘Accept-Charset: iso-8859-2‘                     --header=‘Accept-Language: hr‘                              http://fly.srk.fer.hr/

       Specification of an empty string as the header value will clear all previous user-defined headers.

       As of Wget 1.10, this option can be used to override headers otherwise generated automatically.  This example instructs Wget to connect to localhost, but to specify foo.bar in the "Host" header:

               wget --header="Host: foo.bar" http://localhost/

       In versions of Wget prior to 1.10 such use of --header caused sending of duplicate headers.
  • 接下来我们就可以用wget命令愉快的下载JDK了

    1. 首先我们要找到要下载JDK的URL地址,例如:http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm。这个地址可以去Orcale的官网找到。
    2. 通过wget命令下载:
      wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
      • 1
    3. JDK我一般放在/usr/java目录下,现在我们把下载的rpm文件挪过去:
      //创建目录
      mkdir /usr/java
      
      //把下载的rpm文件copy过去
      cp jdk-8u131-linux-x64.rpm /usr/java/
    4. 添加执行权限:
      //进入目录
      mkdir cd /usr/java
      
      //添加可执行权限
      chmod +x jdk-8u101-linux-x64.rpm
    5. 执行rpm命令安装:
      //安装rpm软件包
      rpm -ivh jdk-8u101-linux-x64.rpm
    6. 查看是否安装成功:
      //查看java的版本信息
      java -version
  • 能够显示出版本信息就说明安装成功了。 
    java version “1.8.0_131” 
    Java(TM) SE Runtime Environment (build 1.8.0_131-b11) 
    Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

    借鉴:http://www.omgdba.com/download-oracle-jdk-from-official-website-using-wget-on-linux.html?utm_source=tuicool&utm_medium=referral

时间: 2024-10-30 03:33:33

rpm安装JDK方法的相关文章

rpm安装jdk

rpm安装jdk:(https://blog.csdn.net/daerzei/article/details/80136457) 1.卸载系统自带的JDK rpm -qa|grep java # xxx yyy zzz为你要卸载的插件,插件之间以空格隔开 rpm -e --nodeps xxx yyy zzz 2.下载jdk rpm包(官方下载) 3.安装jdk rpm -ivh jdk-8u172-linux-x64.rpm 4.查看是否安装成功 java -version 原文地址:htt

通过rpm安装jdk

通过rpm安装,安装在/usr/local 1 .编辑系统环境变量 vi /etc/profile 输入i 加入内容如下: export JAVA_HOME=/usr/local/jdk1.7.0_71 export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$JAVA_HOME/bin:$PATH (JAVA_HOME  jdk的安装路劲) 2 .加载刚设置的变量 source /etc/pro

CentOS 7 rpm安装jdk

RPM 安装jdk1.8.0_111 1,查询系统自带的jdk rpm -qa | grep java 查询结果如下: [[email protected] ~]# rpm -qa | grep java javapackages-tools-3.4.1-5.el7.noarch javamail-1.4.6-8.el7.noarch java-1.7.0-openjdk-headless-1.7.0.51-2.4.5.5.el7.x86_64 tzdata-java-2014b-1.el7.n

linux下用rpm 安装jdk

转:http://blog.csdn.net/ldl22847/article/details/7605650 1.下载jdk的rpm安装包,这里以jdk-7u4-Linux-i586.rpm为例进行说明 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html 2. 将jdk-7u4-linux-i586.rpm 移动到合适的安装目录上,安装软件不要在/home路径下,这样很容易涉及到不同用户的访问权限,这样

CentOS安装jdk的三种方法

环境 Linux版本:CentOS 6.5.Ubuntu 12.04.5 JDK版本:JDK 1.7 目录 方法一:手动解压JDK的压缩包,然后设置环境变量 方法二:用yum安装JDK 方法三:用rpm安装JDK 方法四:Ubuntu 上使用apt-get安装JDK 内容 方法一:手动解压JDK的压缩包,然后设置环境变量 1.在/usr/目录下创建java目录  [[email protected] ~]# mkdir/usr/java [[email protected] ~]# cd /us

CentOS下安装JDK的三种方法

由于各Linux开发厂商的不同,因此不同开发厂商的Linux版本操作细节也不一样,今天就来说一下CentOS下JDK的安装: 方法一:手动解压JDK的压缩包,然后设置环境变量 1.在/usr/目录下创建java目录 [[email protected] ~]# mkdir/usr/java [[email protected] ~]# cd /usr/java 2.下载jdk,然后解压 [[email protected] java]# curl -O http://download.Oracl

虚拟机上在Linux系统中安装JDK的方法

1.   mkdir /soft      (创建一个目录,用于存放安装软件 ) 2.     cd /soft      (切换到soft目录 ) 3. rz(从windows中选择安装包) 4.rmp  -ivh jdk-7u45-linux-x64.rpm   (安装JDK) 5.find / -name 'jdk' 6.vi /etc/profile  (编辑环境变量)  在profile的最后写下面的地址 export JAVA_HOME=/usr/java/jdk1.7.0_45ex

在CentOS7.4中安装jdk的几种方法及配置环境变量

一.下载jdk jdk下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 下载jdk-8u152-linux-x64.rpm 或 jdk-8u152-linux-x64.tar.gz(根据自己的系统位数选择对应的包) 如图: 二.安装jdk 1.因为我安装的CentOS7.4系统自带jdk1.8,所以为了演示如何安装jdk,我需要先卸载系统自带的jdk 查看当前系统jdk

Ubuntu安装 jdk.rpm 报错问题解决

报错问题出现原因 第一次使用Ubuntu操作系统,很多命令及软件安装方式与以往使用的Linux操作系统(CentOS)有很大区别.现在总结使用Ubuntu在安装JDK中,遇到的问题及解决方法. [email protected]:~/hadoop# rpm -i jdk-7u80-linux-x64.rpm rpm: RPM should not be used directly install RPM packages, use Alien instead!rpm: However assum