• 安装Tomcat用于Jenkins持续发布


    安装Tomcat的步骤如下:

    yum install -y wget
    yum install -y java-1.8.0-openjdk-devel
    useradd -m -U -d /opt/tomcat -s /bin/false tomcat
    wget https://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.30/bin/apache-tomcat-9.0.30.tar.gz
    tar vxf apache-tomcat-9.0.30.tar.gz
    mv apache-tomcat-9.0.30 /opt/tomcat/
    cd /opt/tomcat/
    ln -s /opt/tomcat/apache-tomcat-9.0.30/ /opt/tomcat/latest
    chown -R tomcat: /opt/tomcat
    sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh'
    vim /etc/systemd/system/tomcat.service
    [Unit]
    Description=Tomcat 9 servlet container
    After=network.target
    
    [Service]
    Type=forking
    
    User=tomcat
    Group=tomcat
    
    Environment="JAVA_HOME=/usr/lib/jvm/jre"
    Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
    
    Environment="CATALINA_BASE=/opt/tomcat/latest"
    Environment="CATALINA_HOME=/opt/tomcat/latest"
    Environment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid"
    Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
    
    ExecStart=/opt/tomcat/latest/bin/startup.sh
    ExecStop=/opt/tomcat/latest/bin/shutdown.sh
    
    [Install]
    WantedBy=multi-user.target
    cd /opt/tomcat/latest/conf
    vim server.xml
        <Connector port="8090" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" />
    vim tomcat-users.xml
      <role rolename="manager-gui"/>
      <role rolename="manager-script"/>
      <role rolename="admin-gui"/>
      <user username="tomcat" password="tomcat" roles="manager-gui,manager-script,admin-gui"/>
    cd /opt/tomcat/latest/webapps/manager/META-INF/
    vim context.xml
    <Context antiResourceLocking="false" privileged="true" >
      <Valve className="org.apache.catalina.valves.RemoteAddrValve"
             allow="d+.d+.d+.d+|::1|0:0:0:0:0:0:0:1" />
      <Manager sessionAttributeValueClassNameFilter="java.lang.(?:Boolean|Integer|Long|Number|String)|org.apache.catalina.filters.CsrfPreventionFilter$LruCache(?:$1)?|java.util.(?:Linked)?HashMap"/>
    </Context>
    systemctl restart tomcat
  • 相关阅读:
    test
    在linux下安装tesseract-ocr
    xpath获取同级节点
    RobotFrameWork系统关键字之断言
    redis
    mybatis
    mysql事务隔离级别
    努力努力再努力
    不同分辨率下,页面如何自适应?
    市场上有多少种分辨率?
  • 原文地址:https://www.cnblogs.com/hengwei/p/12294358.html
Copyright © 2020-2023  润新知