Setup basic apache tomcat on CentOS 7 with mariadb

From Notes_Wiki

Home > CentOS > CentOS 6.x > Tomcat server configuration > Setup basic apache tomcat on CentOS 7 with mariadb

To setup basic apache tomcat on CentOS-7 with mariadb use following steps:

  1. Install CentOS 7 (One can also use CentOS 7 VM from AWS)
  2. (Optionally) Setup fail2ban
    yum -y install epel-release
    yum -y install fail2ban
    systemctl start fail2ban
    systemctl enable fail2ban
  3. Setup tomcat, mariadb
    yum -y install vim tomcat mariadb-server
    systemctl start tomcat
    systemctl start mariadb
    systemctl enable tomcat
    systemctl enable mariadb
  4. Put war file or other files in /usr/share/tomcat/webapps/ROOT folder. ROOT folder may not exist and would have to be created.
  5. In case of war file optionally extract it in webapps/ROOT folder using:
    yum -y install unzip
    unzip -x <site>.war
  6. Setup mysql using:
    mysql
    create database <dbname>;
    grant all on <dbname>.* to '<username>'@'locahost' identified by '<password>';
    flush privileges;
    \q

Things to worry about:

  • MySQL backups
  • Shifting tomcat to listen to port 80, instead of 8080 (Refer apache apj backend)
  • DNS entries to point to new server



Deploying application using war file

Note that extracting war file as suggested in steps above is not necessary. For deploying application using war file, simply copying file to /var/lib/tomcat/webapps folder is enough. After few seconds tomcat extracts the war file and the internal folders also contain few configuration files which can be modified to configure the application.

This information was learned from http://stackoverflow.com/questions/5109112/how-to-deploy-a-war-file-in-tomcat-7


Home > CentOS > CentOS 6.x > Tomcat server configuration > Setup basic apache tomcat on CentOS 7 with mariadb