部署 jre8

  • 下载 oracle jre8,下载界面
  • 解压
    1
    2
    
    tar zxf jre-8u221-linux-x64.tar.gz -C /opt/
    cd /opt && mv jre-8u221-linux jre
    
  • 创建 /etc/profile.d/jre.sh,内容如下
    1
    2
    
    export JAVA_HOME=/opt/jre
    export PATH=$JAVA_HOME/bin:$PATH
    

部署 tomcat8

  • 下载 tomcat
    1
    
    curl -O http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz
    
  • 解压
    1
    2
    
    tar zxf apache-tomcat-8.5.45.tar.gz -C /opt/
    cd /opt/ && mv apache-tomcat-8.5.45 tomcat
    
  • 创建文件 /opt/tomcat/bin/setenv.sh,内容如下
    1
    2
    3
    4
    5
    
    export JAVA_HOME=/opt/jre
    export JAVA_OPTS="$JAVA_OPTS -server -Xms8192M -Xmx8192M -Xmn3072M -Xss512K -Djava.security.egd=file:/dev/./urandom -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -Ddruid.registerToSysProperty=true"
    # -Djava.library.path=/opt/tomcat/libs/tcnative # tcnative 库位置
    #export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=10087"
    export CATALINA_PID="/var/run/tomcat.pid"
    
  • 创建 /usr/lib/systemd/system/tomcat.service 文件,内容如下
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    
    [Unit]
    Description=The Apache Tomcat
    After=network.target
    
    [Service]
    Type=forking
    PIDFile=/var/run/tomcat.pid
    ExecStart=/opt/tomcat/bin/catalina.sh start
    ExecStop=/opt/tomcat/bin/catalina.sh stop
    SuccessExitStatus=143
    
    [Install]
    WantedBy=multi-user.target
    
  • 启动 tomcat 服务
    1
    2
    
    systemctl daemon-reload
    systemctl start tomcat
    

验证码字体

1
yum install dejagnu dejavu-sans-mono-fonts dejavu