安装java
[root@localhost ~]# java -version #查看当前java相关
[root@localhost ~]# rpm -qa | grep java #查看相关rpm包
[root@localhost ~]# rpm -e –nodeps xxxxxx #卸载相关rpm
https://www.oracle.com/java/technologies/jdk8-downloads.html 下载并上传rpm包
[root@localhost ~]# rpm -ivh jdk-8u221-linux-x64.rpm
[root@localhost ~]# vim /etc/profile #配置环境变量
尾部添加:
export JAVA_HOME=/usr/java/jdk1.8.0_101
export JRE_HOME=/usr/java/jdk1.8.0_101/jre
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
安装tomcat
http://tomcat.apache.org/download-80.cgi 下载tomcat8
[root@localhost ~]# cd /usr/local #上传并打开此目录
[root@localhost ~]# tar -zxvf apache-tomcat-8.5.15.tar.gz #解压
[root@localhost ~]# mv apache-tomcat-8.5.45 tomcat8 #重命名解压出来的文件夹
[root@localhost ~]# vim /etc/selinux/config #编辑禁用selinux
[root@localhost ~]# vim /usr/local/tomcat8/conf/server.xml #修改tomcat默认端口
修改connector port=”8080” 此为tomcat默认打开端口
[root@localhost ~]# systemctl stop firewalld #关闭防火墙
打开tomcat默认页面。正常
转载请注明:IT运维空间 » Tomcat » Centos7.x安装java、tomcat教程
发表评论