1.java部署
下载安装包
进入 http://tomcat.apache.org/download-80.cgi
1.1环境准备
mkdir /usr/local/tomcat
cd /usr/local/tomcat
wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.35/bin/apache-tomcat-8.5.35.tar.gz
tar xf apache-tomcat-8.5.35.tar.gz -C /usr/local/tomcat
rm -rf open-falcon-v0.2.1.tar.gz
1.2 java准备
1.2.1 是否安装jdk
[root@10 ~]# 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)
1.2.2 若没有
sudo yum install java-1.8.0-openjdk.x86_64
1.2.3 查找java环境变量
echo $JAVA_HOME
或
[admin@broad-heading ~]$ which java
/usr/bin/java
[admin@broad-heading ~]$ ll /usr/bin/java
lrwxrwxrwx 1 root root 22 Jun 11 14:28 /usr/bin/java -> /etc/alternatives/java
[admin@broad-heading ~]$ ll /etc/alternatives/java
lrwxrwxrwx 1 root root 73 Jun 11 14:28 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64/jre/bin/java
1.2.4 修改开机文件
sudo cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
vim /etc/init.d/tomcat #在第二行加入
# chkconfig: 112 63 37
# description: tomcat server init script
# Source Function Library
. /etc/init.d/functions
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64/jre #jdk位置
CATALINA_HOME=/usr/local/tomcat #tomcat安装位置
chomd 755 /etc/init.d/tomcat
vim /etc/init.d/tomcat #在第二行加入
# chkconfig: 112 63 37
# description: tomcat server init script
# Source Function Library
. /etc/init.d/functions
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64/jre #jdk位置
CATALINA_HOME=/usr/local/tomcat #tomcat安装位置
chomd 755 /etc/init.d/tomcat
配置防火墙开启8080 端口 #firewall
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
配置防火墙开启8080 端口 #iptables
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
1.2.5 开机
cd /usr/local/tomcat/bin
./startup.sh #开机
./shutdown.sh #关闭
2. 部署小幺鸡
1. 下载小幺鸡 war包
wget https://github.com/zhoujingjie/xiaoyaoji/releases/download/2.1.62/
2. 解压
unzip xiaoyaoji-2.1.62.war -d /usr/local/tomcat/webapps/ROOT
3. 建表
CREATE DATABASE `xiaoyaoji` CHARACTER SET utf8;
4. 创建表结构
use xiaoyaoji;
source /tmp/apiManager/doc/xiaoyaoji.sql
5. 修改配置文件
/usr/local/tomcat/webapps/ROOT/WEB-INF/classes/config.properties
6.测试
启动tomcat 访问:http:ip:port