#安装java dockerlee@lee-PC:~$ sudo apt-get install openjdk-7-jdk #查看java dockerlee@lee-PC:java$ sudo find / -name java /etc/ssl/certs/java /etc/apparmor.d/abstractions/ubuntu-browsers.d/java /etc/alternatives/java /usr/lib/jvm/java-7-openjdk-amd64/bin/java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java /usr/bin/java /usr/share/java /usr/share/bash-completion/completions/java /var/lib/dpkg/alternatives/java #配置java环境变量 dockerlee@lee-PC:~$ sudo vim /etc/profile export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH #使环境变量生效 dockerlee@lee-PC:~$ source /etc/profile
CentOS安装java
#下载java安装包,移动到/opt目录下,配置环境变量 export JAVA_HOME=/opt/jdk1.7.0_80 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export HADOOP_HOME=/opt/hadoop-1.2.1 export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$HADOOP_HOME/bin:$PATH