1,解壓jdk包,跟apache的gcc gcc-c++的底層源碼差很少java
卸載rpm安裝的jdk軟件包node
方法 1linux
[root@localhost ~]# rpm -qa | grep -i openjdk
java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.5.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64
java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64nginx
[root@localhost ~]# rpm -e java-1.8.0-openjdk --nodeps //卸載不了的軟件包加 --nodeps解除依賴關係
[root@localhost ~]# rpm -e java-1.7.0-openjdk-headless --nodeps
[root@localhost ~]# rpm -e java-1.8.0-openjdk-headless --nodeps
[root@localhost ~]# rpm -e java-1.7.0-openjdk --nodepsc++
方法 2apache
[root@localhost ~]# which java
/usr/bin/which: no java in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
[root@localhost ~]# rm -rf /usr/bin/java
[root@localhost ~]# java -versionbootstrap
2,jdk的安裝vim
[root@nginx ~]# tar xf jdk-8u191-linux-x64.tar.gz瀏覽器
[root@localhost ~]# mv jdk1.8.0_191/ /usr/local/java //移動到路徑取名叫javatomcat
[root@localhost ~]# java -version //查看顯示沒有環境變量
bash: java: 未找到命令...
[root@localhost ~]# vim /etc/profile //添加環境變量
在最下面加這個環境變量
export JAVA_HOME=/usr/local/java
export PATH=$PATH:$JAVA_HOME/bin
[root@localhost ~]# echo $PATH //一共有的查看環境變量
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost ~]# source /etc/profile //重新加載剛剛配置的環境變量
[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/java/bin //以後就能夠看到咱們剛剛配置的環境變量了
[root@localhost ~]# java -version //安裝好的jdk就出來了
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
3,Tomcat的安裝
[root@localhost ~]# tar xf apache-tomcat-8.5.40.tar.gz //解壓
[root@localhost ~]# mv apache-tomcat-8.5.40 /usr/local/tomcat8 //移動到對應路徑
[root@localhost ~]# ls /usr/local/tomcat8/bin/
bootstrap.jar configtest.bat setclasspath.sh tomcat-native.tar.gz
catalina.bat configtest.sh shutdown.bat tool-wrapper.bat
catalina.sh daemon.sh shutdown.sh tool-wrapper.sh //這裏面就是tomcat的全部文件,startup.sh 開啓腳本 shutdown.sh 關閉腳本
catalina-tasks.xml digest.bat startup.bat version.bat
commons-daemon.jar digest.sh startup.sh version.sh
commons-daemon-native.tar.gz setclasspath.bat tomcat-juli.jar
[root@localhost ~]# netstat -lnpt | grep :8080 //湯姆貓的端口的 8080
tcp6 0 0 :::8080 :::* LISTEN 4312/java
以後就能夠在瀏覽器訪問了,192.168.200.111:8080