环境:阿里云服务器centos_7_06_64
输入下面的命令查看支持的版本
[root@host-1 PythonWorkbench]# yum -y list java*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
java-1.6.0-openjdk.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-demo.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.6.0-openjdk-src.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.7.0-openjdk.x86_64 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.7.0-openjdk-accessibility.x86_64 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.7.0-openjdk-demo.x86_64 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.7.0-openjdk-headless.x86_64 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.7.0-openjdk-src.x86_64 1:1.7.0.221-2.6.18.0.el7_6 updates
java-1.8.0-openjdk.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-accessibility.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-accessibility-debug.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-accessibility-debug.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-debug.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-debug.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-demo.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-demo.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-demo-debug.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-devel.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-devel-debug.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-headless.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-headless-debug.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-javadoc-zip-debug.noarch 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-src.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-src.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-src-debug.i686 1:1.8.0.212.b04-0.el7_6 updates
java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.212.b04-0.el7_6 updates
java-11-openjdk.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-demo.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-demo.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-demo-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-demo-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-devel.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-devel.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-devel-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-devel-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-headless.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-headless.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-headless-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-headless-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc-zip.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc-zip.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc-zip-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-javadoc-zip-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-jmods.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-jmods.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-jmods-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-jmods-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-src.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-src.x86_64 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-src-debug.i686 1:11.0.3.7-0.el7_6 updates
java-11-openjdk-src-debug.x86_64 1:11.0.3.7-0.el7_6 updates
java-atk-wrapper.i686 0.30.4-5.el7 base
java-atk-wrapper.x86_64 0.30.4-5.el7 base
java-dirq.noarch 1.8-1.el7 epel
java-dirq-javadoc.noarch 1.8-1.el7 epel
java-latest-openjdk.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-demo.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-demo-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-devel.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-devel-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-headless.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-headless-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-javadoc.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-javadoc-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-javadoc-zip.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-javadoc-zip-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-jmods.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-jmods-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-src.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-latest-openjdk-src-debug.x86_64 1:12.0.1.12-1.rolling.el7 epel
java-oauth.noarch 20100601-13.el7 epel
java-oauth-javadoc.noarch 20100601-13.el7 epel
java-runtime-decompiler.noarch 2.0-5.el7 epel
java-runtime-decompiler-javadoc.noarch 2.0-5.el7 epel
java_cup.noarch 1:0.11a-16.el7 base
java_cup-javadoc.noarch 1:0.11a-16.el7 base
java_cup-manual.noarch 1:0.11a-16.el7 base
javacc.noarch 5.0-10.el7 base
javacc-demo.noarch 5.0-10.el7 base
javacc-javadoc.noarch 5.0-10.el7 base
javacc-manual.noarch 5.0-10.el7 base
javacc-maven-plugin.noarch 2.6-17.el7 base
javacc-maven-plugin-javadoc.noarch 2.6-17.el7 base
javamail.noarch 1.4.6-8.el7 base
javamail-javadoc.noarch 1.4.6-8.el7 base
javapackages-tools.noarch 3.4.1-11.el7 base
javaparser.noarch 1.0.11-3.el7 epel
javaparser-javadoc.noarch 1.0.11-3.el7 epel
javassist.noarch 3.16.1-10.el7 base
javassist-javadoc.noarch 3.16.1-10.el7 base
javastroke.x86_64 0.5.1-33.el7 epel
javawriter.noarch 2.5.1-4.el7 epel
javawriter-javadoc.noarch 2.5.1-4.el7 epel
因为我的是64位系统,所以选择java-1.8.0-openjdk.x86_64
然后输入安装指令,指定版本
[root@host-1 PythonWorkbench]# yum install -y java-1.8.0-openjdk-devel.x86_64
然后执行,执行成功会有提示,如下
Installed:
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.212.b04-0.el7_6
Dependency Installed:
atk.x86_64 0:2.28.1-1.el7
cairo.x86_64 0:1.15.12-3.el7
copy-jdk-configs.noarch 0:3.3-10.el7_5
dejavu-fonts-common.noarch 0:2.33-6.el7
dejavu-sans-fonts.noarch 0:2.33-6.el7
fontconfig.x86_64 0:2.13.0-4.3.el7
fontpackages-filesystem.noarch 0:1.44-8.el7
fribidi.x86_64 0:1.0.2-1.el7
gdk-pixbuf2.x86_64 0:2.36.12-3.el7
giflib.x86_64 0:4.1.6-9.el7
graphite2.x86_64 0:1.3.10-1.el7_3
gtk-update-icon-cache.x86_64 0:3.22.30-3.el7
gtk2.x86_64 0:2.24.31-1.el7
harfbuzz.x86_64 0:1.7.5-2.el7
hicolor-icon-theme.noarch 0:0.12-7.el7
jasper-libs.x86_64 0:1.900.1-33.el7
java-1.8.0-openjdk.x86_64 1:1.8.0.212.b04-0.el7_6
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.212.b04-0.el7_6
javapackages-tools.noarch 0:3.4.1-11.el7
jbigkit-libs.x86_64 0:2.0-11.el7
libICE.x86_64 0:1.0.9-9.el7
libSM.x86_64 0:1.2.2-2.el7
libX11.x86_64 0:1.6.5-2.el7
libX11-common.noarch 0:1.6.5-2.el7
libXau.x86_64 0:1.0.8-2.1.el7
libXcomposite.x86_64 0:0.4.4-4.1.el7
libXcursor.x86_64 0:1.1.15-1.el7
libXdamage.x86_64 0:1.1.4-4.1.el7
libXext.x86_64 0:1.3.3-3.el7
libXfixes.x86_64 0:5.0.3-1.el7
libXft.x86_64 0:2.3.2-2.el7
libXi.x86_64 0:1.7.9-1.el7
libXinerama.x86_64 0:1.1.3-2.1.el7
libXrandr.x86_64 0:1.5.1-2.el7
libXrender.x86_64 0:0.9.10-1.el7
libXtst.x86_64 0:1.2.3-1.el7
libXxf86vm.x86_64 0:1.1.4-1.el7
libfontenc.x86_64 0:1.1.3-3.el7
libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7
libglvnd-egl.x86_64 1:1.0.1-0.8.git5baa1e5.el7
libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7
libjpeg-turbo.x86_64 0:1.2.90-6.el7
libthai.x86_64 0:0.1.14-9.el7
libtiff.x86_64 0:4.0.3-27.el7_3
libwayland-client.x86_64 0:1.15.0-1.el7
libwayland-server.x86_64 0:1.15.0-1.el7
libxcb.x86_64 0:1.13-1.el7
libxshmfence.x86_64 0:1.2-1.el7
libxslt.x86_64 0:1.1.28-5.el7
lksctp-tools.x86_64 0:1.0.17-2.el7
mesa-libEGL.x86_64 0:18.0.5-4.el7_6
mesa-libGL.x86_64 0:18.0.5-4.el7_6
mesa-libgbm.x86_64 0:18.0.5-4.el7_6
mesa-libglapi.x86_64 0:18.0.5-4.el7_6
pango.x86_64 0:1.42.4-2.el7_6
pcsc-lite-libs.x86_64 0:1.8.8-8.el7
pixman.x86_64 0:0.34.0-1.el7
python-javapackages.noarch 0:3.4.1-11.el7
python-lxml.x86_64 0:3.2.1-4.el7
ttmkfdir.x86_64 0:3.0.9-42.el7
tzdata-java.noarch 0:2019b-1.el7
xorg-x11-font-utils.x86_64 1:7.5-21.el7
xorg-x11-fonts-Type1.noarch 0:7.5-9.el7
Complete!
然后查看安装情况
[root@host-1 PythonWorkbench]# java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)
如果出现上面的信息,至此安装jdk完成,通过命令安装会自动配置环境变量,也可以通过手动安装和配置环境变量,以前工作中为了保持jdk一致都是通过手动安装的,这次试试命令安装,简单好多呀
tomcat安装
官问下载想要的版本https://tomcat.apache.org
我选择现在最新的tomcat9.0~~~
然后通过文件传输助手把安装包放到一个你习惯放的地方
然后cd到对应目录,或者自己输路径,然后输入指令解压到想要解压到的路径下,我解压到opt下了
[root@host-1 etc]# tar zxvf apache-tomcat-9.0.22.tar.gz -C /opt
然后cd到对应的路径下的bin文件夹,输入指令
[root@host-1 bin]# ./startup.sh
在浏览器输入ip访问,出现下面的页面就是部署成功了
ps:这里的ip是我修改hosts文件弄得~~~~还有记得阿里云安全规则那里要要开对应的端口