一、 安装 JDK 8

1.1 下载 JDK 8cd /opt/

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"

1.2 安装 JDK 8tar xzf jdk-8u141-linux-x64.tar.gz

cd jdk1.8.0_141

alternatives --install /usr/bin/java java /opt/jdk1.8.0_141/bin/java 2

alternatives --config java

界面显示内容如下:

There is 1 program that provides 'java'.

Selection Command

-----------------------------------------------

*+ 1 /opt/jdk1.8.0_141/bin/java

Enter to keep the current selection[+], or type selection number:

输入 1 回车

1.3 设置 javac 和 jar 命令的路径alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_141/bin/jar 2

alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_141/bin/javac 2

alternatives --set jar /opt/jdk1.8.0_141/bin/jar

alternatives --set javac /opt/jdk1.8.0_141/bin/javac

1.4 查看是否正确安装java -version

1.5 设置环境变量export JAVA_HOME=/opt/jdk1.8.0_141

export JRE_HOME=/opt/jdk1.8.0_141/jre

export PATH=$PATH:/opt/jdk1.8.0_141/bin:/opt/jdk1.8.0_141/jre/bin

二、安装 Tomcat

2.1 下载 Tomcatwget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz

2.2 安装 Tomcattar xzf apache-tomcat-8.5.45.tar.gz

mv apache-tomcat-8.5.45 /usr/local/tomcat8

2.3 启动 Tomcat/usr/local/tomcat8/bin/startup.sh

注意关闭防火墙或放行端口,输入:ip:8080

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐