Here a list of commands i use to setup standard Java application server using OpenJDK11 + Tomcat9 + MariaDB10.3 on fresh instaled CentOS 8 Stream (Server without GUI Package) :
#preparation yum update reboot # make sure you have space df -h # install mariadb yum install mariadb-server # enabling mariadb service at startup systemctl enable --now mariadb # securing, setup root's password and remove test db and anonimous user mysql_secure_installation # test mysql -u root -p # install java, check available jdk yum info java* yum install java-11-openjdk-devel # test java -version # tomcat9 # prepare user to run tomcat service, never using root useradd -m -U -d /opt/tomcat -s /bin/false tomcat # download and install tomcat9, please check version availability on https://www-eu.apache.org/dist/tomcat/tomcat-9/ VERSION=9.0.68 wget https://www-eu.apache.org/dist/tomcat/tomcat-9/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz -P /tmp tar -xf /tmp/apache-tomcat-${VERSION}.tar.gz -C /opt/tomcat/ ln -s /opt/tomcat/apache-tomcat-${VERSION} /opt/tomcat/latest chown -R tomcat: /opt/tomcat sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh' # check ls -lah /opt/tomcat/latest/ ls -lah /opt/tomcat/latest/bin/ # create service for tomcat9 and put script below on it vim /etc/systemd/system/tomcat.service # script [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 # end of script # start tomcat systemctl daemon-reload # enabling tomcat serice at startup systemctl enable --now tomcat # check systemctl status tomcat # open port on firewall firewall-cmd --permanent --zone=public --add-port=8080/tcp firewall-cmd --reload # check and remove all unnecessary software cd /opt/tomcat/latest/webapps/ ls -lah rm -rf * ls # check log less +G ../logs/catalina.out # done