hadoop13---centos安装jdk
由于各Linux开发厂商的不同,因此不同开发厂商的Linux版本操作细节也不一样,今天就来说一下CentOS下JDK的安装:
方法一:手动解压JDK的压缩包,然后设置环境变量
1.在/usr/目录下创建java目录
[root@localhost ~]# mkdir/usr/java
[root@localhost ~]# cd /usr/java
2.下载jdk,然后解压
[root@localhost java]# curl -O http://download.Oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
[root@localhost java]# tar -zxvf jdk-7u79-linux-x64.tar.gz
3.设置环境变量
[root@localhost java]# vi /etc/profile
在profile中添加如下内容:
#set java environment
JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
让修改生效:
[root@localhost java]# source /etc/profile
4.验证JDK有效性
[root@localhost java]# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
方法二:用yum安装JDK
1.查看yum库中都有哪些jdk版本(暂时只发现了openjdk)
[root@localhost ~]# yum search java|grep jdk
ldapjdk-javadoc.x86_64 : Javadoc for ldapjdk
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle
ldapjdk.x86_64 : The Mozilla LDAP Java SDK
2.选择版本,进行安装
//选择1.7版本进行安装
[root@localhost ~]# yum install java-1.7.0-openjdk
//安装完之后,默认的安装目录是在: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64
3.设置环境变量
[root@localhost ~]# vi /etc/profile
在profile文件中添加如下内容
#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
让修改生效
[root@localhost java]# source /etc/profile
4.验证(同上一方法)
方法三:用rpm安装JDK
1.下载rpm安装文件
[root@localhost ~]$ curl -O http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm
2.使用rpm命令安装
[root@localhost ~]# rpm -ivh jdk-7u79-linux-x64.rpm
3.设置环境变量
[root@localhost java]# vi /etc/profile
在打开的profile文件中添加如下内容
#set java environment
JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
让修改生效
[root@localhost java]# source /etc/profile
4.验证(同上一方法)
注:和yum安装类似,不用设置环境变量就可以运行java命令。rpm安装方式默认会把jdk安装到/usr/java/jdk1.7.0_79,然后通过三层链接,链接到/usr/bin,具体链接如下:
[root@localhost ~]# cd /bin
[root@localhost bin]# ll|grep java
lrwxrwxrwx. 1 root root 25 Mar 28 11:24 jar ->/usr/java/default/bin/jar
lrwxrwxrwx. 1 root root 26 Mar 28 11:24 java -> /usr/java/default/bin/java
lrwxrwxrwx. 1 root root 27 Mar 28 11:24 javac ->/usr/java/default/bin/javac
lrwxrwxrwx. 1 root root 29 Mar 28 11:24 javadoc ->/usr/java/default/bin/javadoc
lrwxrwxrwx. 1 root root 28 Mar 28 11:24 javaws ->/usr/java/default/bin/javaws
lrwxrwxrwx. 1 root root 30 Mar 28 11:24 jcontrol ->/usr/java/default/bin/jcontrol
[root@localhost bin]# cd /usr/java/
[root@localhost java]# ll
total 4
lrwxrwxrwx. 1 root root 16 Mar 28 11:24 default-> /usr/java/latest
drwxr-xr-x. 8 root root 4096 Mar 28 11:24 jdk1.7.0_79
lrwxrwxrwx. 1 root root 21 Mar 28 11:24 latest -> /usr/java/jdk1.7.0_79
方法四:Ubuntu 上使用apt-get安装JDK
1.查看apt库都有哪些jdk版本
root@linuxidc:~# apt-cache search java|grep jdk
default-jdk - Standard Java or Java compatible Development Kit
default-jdk-doc - Standard Java or Java compatible Development Kit (documentation)
gcj-4.6-jdk - gcj and classpath development tools for Java(TM)
gcj-jdk - gcj and classpath development tools for Java(TM)
openjdk-6-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-6-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-6-doc - OpenJDK Development Kit (JDK) documentation
openjdk-6-jdk - OpenJDK Development Kit (JDK)
openjdk-6-jre-lib - OpenJDK Java runtime (architecture independent libraries)
openjdk-6-source - OpenJDK Development Kit (JDK) source files
openjdk-7-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-7-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-7-doc - OpenJDK Development Kit (JDK) documentation
openjdk-7-jdk - OpenJDK Development Kit (JDK)
openjdk-7-source - OpenJDK Development Kit (JDK) source files
uwsgi-plugin-jvm-openjdk-6 - Java plugin for uWSGI (OpenJDK 6)
uwsgi-plugin-jwsgi-openjdk-6 - JWSGI plugin for uWSGI (OpenJDK 6)
openjdk-6-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-6-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-7-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-7-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-7-jre-lib - OpenJDK Java runtime (architecture independent libraries)
2.选择版本进行安装
root@linuxidc:~# apt-get install openjdk-7-jdk
3.设置环境变量
root@linuxidc:~# vi /etc/profile
在打开的profile文件中添加如下内容
#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
让修改生效
root@linuxidc:~# source /etc/profile
4.验证(同上一方法)
Ubuntu 14.04安装JDK1.8.0_25与配置环境变量 http://www.linuxidc.com/Linux/2015-01/112030.htm
CentOS 搭建JDK环境 http://www.linuxidc.com/Linux/2015-06/118879.htm
Ubuntu 14.04安装JDK1.8.0_25与配置环境变量 http://www.linuxidc.com/Linux/2015-01/112030.htm
Ubuntu 14.04 LTS安装Oracle JDK 1.8 http://www.linuxidc.com/Linux/2014-11/109216.htm
CentOS6.3安装JDK和环境配置 http://www.linuxidc.com/Linux/2012-09/70780.htm
Ubuntu 14.04 安装 JDK8 http://www.linuxidc.com/Linux/2014-09/106218.htm
Ubuntu下安装JDK图文解析 http://www.linuxidc.com/Linux/2014-09/107291.htm
hadoop13---centos安装jdk的更多相关文章
- Linux安装Jdk,CentOS安装Jdk
Linux安装Jdk,CentOS安装Jdk >>>>>>>>>>>>>>>>>>>& ...
- 搭建centos测试环境:window安装xshell,WinSCP 。 centos安装jdk tomcat
通过ssh实现远程访问linux系统: 由于xshell 连接centos,需要centos开启ssh服务.所以先启动SSH服务,没有ssh需要先安装. 1 . 查看SSH是否安装命令:rpm -qa ...
- java环境变量 windows centos 安装jdk
windows: 1.安装jdk,注意不是jre 2. 计算机→属性→高级系统设置→高级→环境变量,选择下面的那个系统环境变量 3. 系统变量→新建 JAVA_HOME 变量 . 变量值填写jdk的安 ...
- CentOS安装JDK 8
准备工作 首先,更新包: yum update 检查服务器上是否已安装旧版本的Java: java -version 如果有旧版本的Java则移除: yum remove java-1.6.0-ope ...
- CentOS安装jdk的三种方法
方法一:手动解压JDK的压缩包,然后设置环境变量 方法二:用yum安装JDK,(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的 ...
- CentOS安装JDK的三种办法
方法一:手动解压JDK的压缩包,然后设置环境变量 1.在/usr/目录下创建java目录 [root@localhost ~]# mkdir/usr/java[root@localhost ~]# c ...
- Centos安装JDK(java环境)
王小私下问我 centos 中 jdk 怎么安装呀,所以再次整理了这篇基础环境搭建的文章. 1.创建java目录2.下载上传jdk3.解压jdk4.配置环境变量 1.创建java目录 首先我们创建ja ...
- Centos——安装JDK
写在前面: Just mark! 创建linux虚拟机的时候经常要安装JDK,配置环境变量,却又经常忘记,这里记录一下. 环境:Centos-6.8-x86_64-minimal JDK :jdk-7 ...
- Centos 安装jdk jre
下载rpm http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk7-downloads-1880260.html wget ht ...
- centos安装jdk文件
1.到oracle官网选择要安装的jdk版本 http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html ...
随机推荐
- 在线生成条形码的解决方案(39码、EAN-13)
感谢博主:转自:http://xoyozo.eyuyao.com/blog/barcode.html public partial class ReceivablesFormView : System ...
- 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10 (转)
x-ua-compatible 用来指定IE浏览器解析编译页面的model x-ua-compatible 头标签大小写不敏感,必须用在 head 中,必须在除 title 外的其他 meta 之前使 ...
- base 64
我们的图片大部分都是可以转换成base64编码的data:image. 这个在将canvas保存为img的时候尤其有用.虽然除ie外,大部分现代浏览器都已经支持原生的基于base64的encode和d ...
- 【python】模块测试 if name main
verbose=1 def listing(module): if verbose: print '-'*30 print 'name:',module.__name__,'file:',module ...
- uva 465 - Overflow 高精度还是浮点数?
uva 465 - Overflow Overflow Write a program that reads an expression consisting of two non-negativ ...
- spring老项目转springboot项目 笔记
引入jar包 先不删除老的jar包 <parent> <groupId>org.springframework.boot</groupId> <artifac ...
- Redis 连接失败redis Can't init enough connections amount!
Can't init enough connections amount! Only 0 from 10 were initialized. Server: IP:6379 无法初始化足够的连接数量! ...
- 5秒后跳转到另一个页面的js代码
今天看视频学习时学习了一种新技术,即平时我们在一个页面点击“提交”或“确认”会自动跳转到一个页面. 在网上搜了一下,关于这个技术处理有多种方法,我只记下我在视频里学到的三种: 1.用一个respons ...
- script跨域之360搜索
思考: 布局: 1,flex元素上下左右居中,内部元素横向排列: div{ /* 100vh = viewport height*/ display: flex; justify-content: c ...
- 【BZOJ3166】[Heoi2013]Alo 可持久化Trie树+set
[BZOJ3166][Heoi2013]Alo Description Welcome to ALO ( Arithmetic and Logistic Online).这是一个VR MMORPG , ...