这里采用tomcat安装包
tomcat 版本说明: 9.0.17
nginx 版本说明: 1.14.2
jdk 版本说明: 1.8.0
创建目录[root@web02 /]# mkdir /application/[root@web02 /]# cd /application/
1.下载安装并配置jdk
链接: https://pan.baidu.com/s/11r9WgIZA9MMt1uRgG2McQg 提取码: d2ys [root@web02 application]# tar xf jdk-8u60-linux-x64.tar.gz [root@web02 application]# mv jdk1.8.0_60 jdk [root@web02 application]# cat >>/etc/profile<<'EOF' export JAVA_HOME=/application/jdk export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar EOF [root@web01 tools]# . /etc/profile [root@web01 tools]# java -version #能查询到说明环境配置成功 java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
2.部署Tomcat
[root@web02 application]# wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-9/v9.0.17/bin/apache-tomcat-9.0.17.tar.gz [root@web02 application]# tar xf apache-tomcat-9.0.17.tar.gz [root@web02 application]# mv apache-tomcat-9.0.17.tar.gz tomcat [root@web02 application]# export TOMCAT_HOME=/application/tomcat>>/etc/profile [root@web02 application]# source /etc/profile
3. 检查tomcat jdk环境
[root@web02 tomcat]# /application/tomcat/bin/version.sh Using CATALINA_BASE: /application/tomcat Using CATALINA_HOME: /application/tomcat Using CATALINA_TMPDIR: /application/tomcat/temp Using JRE_HOME: /application/jdk Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar Server version: Apache Tomcat/9.0.17 Server built: Mar 13 2019 15:55:27 UTC Server number: 9.0.17.0 OS Name: Linux OS Version: 3.10.0-862.el7.x86_64 Architecture: amd64 JVM Version: 1.8.0_60-b27 JVM Vendor: Oracle Corporation
4.启动tomcat
[root@web02 tomcat]# /application/tomcat/bin/startup.sh Using CATALINA_BASE: /application/tomcatUsing CATALINA_HOME: /application/tomcatUsing CATALINA_TMPDIR: /application/tomcat/tempUsing JRE_HOME: /application/jdkUsing CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jarTomcat started.[root@web02 tomcat]# netstat -lntup|grep java #查询到端口和进程既开启成功tcp6 0 0 127.0.0.1:8005 :::* LISTEN 2125/java tcp6 0 0 :::8009 :::* LISTEN 2125/java tcp6 0 0 :::8080 :::* LISTEN 2125/java [root@web02 tomcat]# ps -ef|grep [j]ava root 2125 1 5 16:44 pts/1 00:00:04 /application/jdk/bin/java -Djava.util.logging.config.file=/application/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat -Djava.io.tmpdir=/application/tomcat/temp org.apache.catalina.startup.Bootstrap start 访问 http://10.0.0.8:8080 有tomcat界面既为成功
5. 安装jpress
远程数据库或者本地数据库..先创建好用户 数据库操作: 创建用户: create database jpress DEFAULT CHARACTER SET utf8; 添加用户 授予权限 grant all on jpress.* to jpress@'localhost' identified by '123456'; grant all on jpress.* to jpress@'172.16.1.%' identified by '123456'
6. 将war包放入/application/tomcat/webapps中 该包会自动解压.
下载完成后请检查war包完整性 #亲测linux wget 下载该包会不完整,建议浏览器下载导入服务器
7.浏览器安装即可
http://10.0.0.8:8080/jpress-web-newest/install
8.故障说明
打开界面安装jpress时显示数据库错误,请查看数据库是否已经存在jpres的表如果存在删除即可
9. tomcat多网站部署及nginx配置参考
https://www.cnblogs.com/asheng2016/p/tomcat.html
以下是摘抄:
详细操作步骤如下:
1 复制一份webapps并命名为webapps-jpress
[root@web01 ~]# cp -rp /usr/share/tomcat/webapps/ /usr/share/tomcat/webapps-jpress
2 把jpress的代码全部移动到/usr/share/tomcat/webapps-jpress
[root@web01 webapps-jpress]# cd /usr/share/tomcat/webapps-jpress; pwd/usr/share/tomcat/webapps-jpress[root@web01 webapps-jpress]# rm -rf ROOT/*[root@web01 webapps-jpress]# mv jpress-web-newest/* ROOT/[root@web01 webapps-jpress]# ls -l /usr/share/tomcat/webapps-jpress/ROOT/total 4drwxr-xr-x 3 tomcat tomcat 38 Oct 3 16:42 META-INF-rw-r--r-- 1 tomcat tomcat 96 Jul 27 2016 robots.txtdrwxr-xr-x 11 tomcat tomcat 139 Oct 3 16:42 staticdrwxr-xr-x 4 tomcat tomcat 31 Oct 3 16:42 templatesdrwxr-xr-x 6 tomcat tomcat 75 Oct 3 16:42 WEB-INF
3 修改/usr/share/tomcat/conf/server.xml
配置nginx
server { listen 80; server_name eee.com; #本地hosts做好解析 location / { proxy_pass http://127.0.0.1:7070/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 30; proxy_send_timeout 60; proxy_read_timeout 60; proxy_buffering on; proxy_buffer_size 32k; proxy_buffers 4 128k; }}
访问网站即可