Java环境安装包下载路径:
Tomcat安装包下载路径:
jpress软件下载:
Java环境安装
上传jdk环境安装包和Tomcat软件包
jdk-8u211-linux-x64.rpmapache-tomcat-9.0.21.zip jdk-8u211-linux-x64.tar.gz
安装jdk环境
[root@m01 ~]# tar xf jdk-8u211-linux-x64.tar.gz -C /usr/local/[root@m01 ~]# ln -s /usr/local/jdk1.8.0_211/ /usr/local/jdk[root@m01 ~]# yum -y install jdk-8u211-linux-x64.rpm[root@m01 ~]# java -versionopenjdk version "1.8.0_131"OpenJDK Runtime Environment (build 1.8.0_131-b12)OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
tomcat部署
创建tomcat存放目录
[root@m01 ~]# cd /usr/local/
将tomcat解压存放目录
[root@m01 ~]# unzip apache-tomcat-9.0.21.zip -d /usr/local/
创建软连接
[root@m01 ~]# cd /usr/local/[root@m01 local]# ln -s apache-tomcat-9.0.21/ tomcat[root@m01 local]# chmod +x /usr/local/tomcat/bin/*.sh [root@m01 local]# /usr/local/tomcat/bin/version.sh
配置相关环境变量信息
[root@m01 local]# cat >>/etc/profile<<'EOF'export JAVA_HOME=/usr/local/jdkexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jarexport TOMCAT_HOME=/usr/local/tomcatEOF [root@m01 local]# source /etc/profile
设置jdk程序目录权限信息
[root@m01 local]# chown -R root.root /usr/local
检查所有环境变量信息是否配置成功
[root@m01 local]# env|egrep -i "JAVA_HOME|PATH|CLASSPATH|TOMCAT_HOME"TOMCAT_HOME=/usr/local/tomcatPATH=/usr/local/jdk/bin:/usr/local/jdk/jre/bin:/application/jdk/bin:/application/jdk/jre/bin:/application/jdk/bin:/application/jdk/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/binJAVA_HOME=/usr/local/jdkCLASSPATH=.:/usr/local/jdk/lib:/usr/local/jdk/jre/lib:/usr/local/jdk/lib/tools.jar
启动tomcat服务程序
[root@m01 local]# /usr/local/tomcat/bin/startup.sh [root@m01 local]# netstat -lntup|grep javatcp6 0 0 :::8080 :::* LISTEN 1781/javatcp6 0 0 127.0.0.1:8005 :::* LISTEN 1781/javatcp6 0 0 :::8009 :::* LISTEN 1781/java
安装数据库程序并进行配置
源码编译安装mysql,因为数据库需要5.6以上版本
[root@db01 ~]# mysqlMariaDB [(none)]> create database jpress DEFAULT CHARACTER SET utf8mb4;Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> grant all on jpress.* to jpress@'%' identified by '123456';Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> exitBye
将开源代码程序包上传到tomcat站点目录下并解压
[root@centos7 ~]# mv jpress-v2.0.3.war /usr/local/tomcat/webapps/ROOT[root@centos7 ~]# jar xf jpress-v2.0.3.war[root@centos7 ~]# /usr/local/tomcat/bin/shutdown.sh[root@centos7 ~]# /usr/local/tomcat/bin/startup.sh
浏览器数据URL进行安装:
写nginx配置文件,使其可以用域名访问
server { listen 80; server_name jpress.xly.com; location / { proxy_pass http://127.0.0.1:8080; 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; }}