Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
tutorial:adm:server_preparation_tmp [2020/07/24 08:52] fiserp [Tomcat] |
tutorial:adm:server_preparation_tmp [2020/07/24 09:07] fiserp [Java - CentOS8] |
dnf install -y java-11-openjdk-headless java-11-openjdk-devel | dnf install -y java-11-openjdk-headless java-11-openjdk-devel |
</code> | </code> |
| |
Then create the file ''/etc/profile.d/java.sh'' with following: | |
<file bash java.sh> | |
[ -d /usr/lib/jvm/java-openjdk ] && export JAVA_HOME=/usr/lib/jvm/java-openjdk | |
</file> | |
| |
| |
[Unit] | [Unit] |
Description=Apache Tomcat Web Application Container | Description=Apache Tomcat Web Application Container |
After=syslog.target network.target | After=syslog.target network.target postgresql.service |
| |
[Service] | [Service] |
WantedBy=multi-user.target | WantedBy=multi-user.target |
</file> | </file> |
| <note> |
| * Values of ''-Xms'' and ''-Xmx'' se are closely dependent on server sizing. If you have enough memory, we strongly recommend to use ''-Xmx 6128M'' or more. |
| * Tomcat will be started under user ''tomcat:tomcat''. |
| </note> |
| |
* Values of Xms a Xmx se are closely dependent on server sizing. If you have enough memory it is strongly advised to use Xmx 6128M or more. | * Reload systemd configuration: |
| |
* Tomcat will be started under user ''tomcat:tomcat'' a will use java installed in ''/usr/lib/jvm/java-1.8.0-openjdk''. | |
* After every systemd configuration change it is necessary to reload: | |
| |
<code> | <code> |
systemctl daemon-reload | systemctl daemon-reload |
</code> | </code> |
* Test start: | |
| * Start the Tomcat to ensure it is configured properly. Enable its start on OS start. |
<code> | <code> |
systemctl start tomcat | systemctl start tomcat |
| systemctl enable tomcat |
</code> | </code> |
| |
* Check that Tomcat runs with desirable parameters: | * Check that Tomcat runs with desirable parameters: |
| |
<code bash> | <code bash> |
[root@tomcat1 logs]# ps -u tomcat -fwww | [root@tomcat1 logs]# ps -u tomcat -fwww |
tomcat 1602 1 1 09:44 ? 00:00:02 /usr/lib/jvm/java-openjdk/bin/java -Djava.util.logging.config.file=/opt/tomcat/current/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Djavax.servlet.request.encoding=UTF-8 -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xms512M -Xmx1024M -server -XX:+UseParallelGC -classpath /opt/tomcat/current/bin/bootstrap.jar:/opt/tomcat/current/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat/current -Dcatalina.home=/opt/tomcat/current -Djava.io.tmpdir=/opt/tomcat/current/temp org.apache.catalina.startup.Bootstrap start | tomcat 1602 1 1 09:44 ? 00:00:02 /usr/lib/jvm/java-openjdk/bin/java -Djava.util.logging.config.file=/opt/tomcat/current/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Djavax.servlet.request.encoding=UTF-8 -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Xms512M -Xmx1024M -server -XX:+UseParallelGC -classpath /opt/tomcat/current/bin/bootstrap.jar:/opt/tomcat/current/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat/current -Dcatalina.home=/opt/tomcat/current -Djava.io.tmpdir=/opt/tomcat/current/temp org.apache.catalina.startup.Bootstrap start |
</code> | </code> |
* Stop Apache Tomcat: | |
| * Stop the Tomcat. |
<code> | <code> |
systemctl stop tomcat | systemctl stop tomcat |
</code> | |
* Enable tomcat start after OS start: | |
<code bash> | |
systemctl enable tomcat | |
</code> | </code> |
| |