1 选择服务器
可自行选择,我选择的为aliyun的个人服务器,108一年的。
2 服务器环境设置
2.1 安装java
1:查看当前java版本
[root@localhost software]# java -version
2:查看当前服务器已安装的java
[root@localhost software]# rpm -qa | grep java 显示: java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64 python-javapackages-3.4.1-11.el7.noarch tzdata-java-2016g-2.el7.noarch javapackages-tools-3.4.1-11.el7.noarch java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64 java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64 java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
3:卸载JDK
[root@localhost software]# rpm -e --nodeps tzdata-java-2016g-2.el7.noarch [root@localhost software]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64 [root@localhost software]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64 [root@localhost software]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64 [root@localhost software]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
或者:
[root@localhost jvm]# yum remove *openjdk*
再次查看java安装情况:显示
[root@localhost software]# rpm -qa | grep java python-javapackages-3.4.1-11.el7.noarch javapackages-tools-3.4.1-11.el7.noarch
4:安装JDK
上传解压JDK安装包(xftp软件):
[root@localhost software]# tar -zxvf jdk-8u131-linux-x64.tar.gz -C /home/jdk/
设置环境变量:
[root@localhost software]# vim /etc/profile 在最前面添加: export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_131 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
结果如下:
执行profile文件(使配置不用重启即生效):
[root@localhost software]# source /etc/profile
5:检查新安装JDK
[root@localhost software]# 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)
标签:java,项目,部署,1.8,Linux,root,el7,localhost,software From: https://www.cnblogs.com/chunxiaozhang/p/17321219.html