On-Premise

OE Application Installation Guide

Introduction

This document provides information about installing various services such as MySQL, Java, Tomcat, Elasticsearch, and Web Application (OvalEdge) on different machines. 

Based on the client's requirement the following services are installed in three Machines.

  1. Machine 1 - MySQL 
  2. Machine 2 - OvalEdge Application
  3. Machine 3 - Elasticsearch

Installing MySQL on VM-1

To install MySQL on Machine-1, complete the following steps using the commands mentioned below:

  1. Download the rpm bundles in the home path using sudo yum localinstall command.

    https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm

    Press y key to proceed with the installation.

  2. Install MySQL 8.0 on RHEL 7 using the below command.
    sudo yum --enablerepo=mysql80-community install mysql-community-server.
  3. Start MySQL 8 Server using the command
    sudo systemctl enable --now mysqld.service
  4. Confirm the service status return as running using the below command
    sudo systemctl status mysqld
  5. Restart the service using below command
    sudo systemctl restart mysqld.service
  6. Set MySQL root password ( The installation of MySQL 8.0 on RHEL 7 generates a temporary password and it can be viewed by running the below command)
    grep 'A temporary password is generated for root@localhost' /var/log/mysqld.log |tail -1
  7. Change the MySQL root user password and secure the MySQL installation using the below command.
    sudo mysql_secure_installation
  8. Secure the MySQL server deployment.
  9. Enter the password for the user root: ***********
  10. The existing password for the user account root has expired. Please set a new password.

    New password: xxxx

    Re-enter new password:xxxx

  11. The 'validate_password' component is installed on the server.
  12. The subsequent steps will run with the existing configuration of the component.
    1. Using existing password for root.
    2. Estimated strength of the password: 100
      Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
    3. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing and to make the installation go a bit smoother. You should remove them before moving into a production environment.

      Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

      Success

    4. Normally, root should only be allowed to connect from localhost. This ensures that someone cannot guess at the root password from the network.

      Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

      Success

    5. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing and should be removed before moving into a production environment.
      Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y

      1. Dropping test database…
        Success.
      2. Removing privileges on test database…

        Success.

      3. Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
        Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
        Success.
        All done!
    6. Login into MySQL using the command mysql -u root -p.
      1-Mar-10-2023-09-56-59-9182-AM

    Run Database Scripts

    Run the below scripts to prepare the master database.

    mysql>source /home/ec2-user/masterscripts.sql   

    mysql>​show databases; 

    +--------------------+

    | Database           |

    +--------------------+

    | information_schema |

    | innodb             |

    | mysql              |

    | ovaledgedb         |

    | performance_schema |

    | sys                |

    +--------------------+

    6 rows in set (0.00 sec)

    Now you can see the ovaledgedb database is created successfully.

    Installing Java & Tomcat on VM-2

    Creating a User for Tomcat

    >sudo useradd ovaledge (Inplace of ovaledge any username can be given)    

    >passwd ovaledge

    New password

    Retype new password

    2-Mar-10-2023-10-07-46-5272-AM

    Installing Java

    Use following commands to install java

    sudo yum -y update

    sudo yum install java-1.8.0-openjdk

    Verify the Java version with the command

    java -version

    3-Mar-10-2023-10-11-35-9324-AM

    Installing Tomcat

    1. Install Tomcat using the below command
      wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.70/bin/apache-tomcat-9.0.70.tar.gz
    2. Unzip the downloaded apache tomcat archive
      tar -xvzf apache-tomcat-9.0.70.tar.gz
    3. After unzipping we can see the unzipped file

      #Pass the username that is created in the above step

      linux_user@ip-XXX-XX-X-XX:~$ ​mv /home/ovaledge/ovaledge.war 

      /home/ovaledge/apache-tomcat-9.0.70/webapps/

    4. Run the below command to start the Tomcat Server
      ovaledge@ip-XXX-XX-X-XX:~$ ​cd apache-tomcat-9.0.70/bin/ 
      ovaledge@ip-XXX-XX-X-XX:~/apache-tomcat-9.0.70/bin$ ​./startup.sh 
    5. Run the command below to stop the Tomcat server. 
      ovaledge@ip-XXX-XX-X-XX:~/apache-tomcat-9.0.70/bin$ ​./shutdown.sh

    Settings in ​oasis.properties​ file

    1. Move to
      /home/ovaledge/apache-tomcat-9.0.70/webapps/ovaledge/WEB-INF/classes​ folder to enter the mysql details in oasis.properties file
      linux_user@ip-XXX-XX-X-XX:~$ ​cd
      /home/ovaledge/apache-tomcat-9.0.70/webapps/ovaledge/WEB-INF/classes/
    2. To Edit the content of the file, use vim command as shown below
      ovaledge@ip-XXX-XX-X-XX:~/apache-tomcat-9.0.70/webapps/ovaledge/WEB-INF/classes$ ​vim oasis.properties
      4-Mar-10-2023-10-11-59-8928-AM
    3. Type “i” to go to insert mode.
    4. Do the changes you want and press ESC and type “:wq!” and press Enter. 
    5. If you want to exit without making any changes, press ESC and type “:q!” and press Enter.

    Externalizing oasis.properties

    1. cd /home/ovaledge
    2. Create a directory to make a copy of oasis.properties file

      mkdir ext-prop

      cp
      /home/ovaledge/apache-tomcat-9.0.70/webapps/ovaledge/WEB-INF/classes/oasis.properties /home/ovaledge/ext-prop

    3. Create setenv.sh file

    4. Go to path /home/ovaledge/apache-tomcat-9.0.70/bin
    5. Create one file  vi setenv.sh
    6. Insert the below code into it.
      exportCATALINA_OPTS=”-Duse.http=true-Dext.properties.dir=file:/home/ovaledge/extprop/”
      5-Mar-10-2023-10-12-24-9265-AM
    7. Now, Run the ./startup.sh under the tomcat bin folder.

    Tomcat as a Service

    1. Go to path /etc/systemd/system
      cd /ect/systemd/system
    2. Create one service file using the below command
      vim tomcat.service
    3. Insert the below code in tomcat.service file.
      [Unit]

      Description=Apache Tomcat Web Application Container

      After=mysql.service network.target

      Requires=mysql.service

      [Service]

      Type=forking

      Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre

      Environment=CATALINA_PID=/home/ovaledge/apache-tomcat-9.0.70/temp

      Environment=CATALINA_HOME=/home/ovaledge/apache-tomcat-9.0.70

      Environment=CATALINA_BASE=/home/ovaledge/apache-tomcat-9.0.70

      ExecStart=/home/ovaledge/apache-tomcat-9.0.70/bin/startup.sh

      ExecStop=/home/ovaledge/apache-tomcat-9.0.70/bin/shutdown.sh

      User=ovaledge

      Group=ovaledge

      UMask=0007

      RestartSec=10

      Restart=always

      [Install]

      WantedBy=multi-user.target
    4. Modify the file as per the user details.
    5. Follow the below commands to start, stop or restart the service
    6. To reload the service use the below command
      systemctl daemon-reload
    7. To start the service
      systemctl start tomcat.service
    8. To enable the service
      systemctl enable tomcat.service
    9. To check the status of the service
      systemctl status tomcat.service

    ElasticSearch Installation on VM-3

    1. Install Java
      sudo yum install java-1.8.0-openjdk
    2. Download and install the public signing key for the Elasticsearch repository.
      sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
    3. Create and add an Elasticsearch repository for yum
      sudo tee /etc/yum.repos.d/elasticsearch.repo <<EOF

      [elasticsearch-7.x]

      name=Elasticsearch repository for 7.x packages

      baseurl=https://artifacts.elastic.co/packages/7.x/yum

      gpgcheck=1

      gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch

      enabled=1

      autorefresh=1

      type=rpm-md

      EOF
    4. Install elastic search using the command sudo yum install --assumeyes elasticsearch.
      6-Mar-10-2023-10-13-27-8744-AM

    5. Configure Elasticsearch service to automatically start during system boot.

      sudo systemctl enable elasticsearch.service

    6. Start Elasticsearch service.
      sudo systemctl start elasticsearch.service
      7-Mar-10-2023-10-13-49-4621-AM
    7. Status of  Elasticsearch service
      sudo systemctl status elasticsearch.service
      8-Mar-10-2023-10-16-13-3470-AM
    8. Open the Elasticsearch configuration file using your favorite text editor to edit configuration options. Here we will add below-listed configurations and enable security for elastic search.
      sudo vi /etc/elasticsearch/elasticsearch.yml
      1. cluster.name: ovaledge
      2. network.host: 0.0.0.0
      3. transport.host: localhost
      4. transport.tcp.port: 9300
      5. http.port: 9200
      6. xpack.security.enabled: true
        9-Mar-10-2023-10-16-44-7956-AM
    9. Restart Elasticsearch service.

      sudo systemctl restart elasticsearch.service

    10. Now, Go to the bin path ( /usr/share/elasticsearch/bin) and give the following command

      ./elasticsearch-setup-passwords interactive
      Note:  It will ask to provide a password and verify password for below users

      1. elastic
      2. apm_system
      3. kibana_system
      4. logstash_system
      5. beats_system
      6. remote_system
        10-Mar-10-2023-10-17-12-6577-AM
    11. Now, enter the below URL for the result.
      http://IP:9200
      11-Mar-10-2023-10-17-32-0064-AM
    12. In order to integrate Elastic search with ovaledge application we need to edit the oasis.properties as shown in below screenshot. 
      12-Mar-10-2023-10-17-50-4773-AM
    13. After editing this file we need to restart the tomcat service.

    Custom Fields

    Changing of MySQL Default directory & Port to Custom

    1. Identify Current MySQL Data Directory using below command
      # mysql -u root -p -e "SELECT @@datadir;"
    2. After you enter the MySQL password, the output should be similar to
      13-Mar-10-2023-10-18-37-0735-AM
    3. Stopping the Mysql service
      # sudo service mysqld stop
    4. Create a new data directory and move the content from the old one
    5. Creating a new data directory

      # mkdir /app

      # mkdir /app/mysql

      # chown mysql:mysql /app/mysql

    6. Take a backup of data directory
      # cp -R /var/lib/mysql /var/lib/mysql_bkp
    7. Moving the original data files 
      # mv /var/lib/mysql/* /app/mysql/
    8. Correct the MySQL configuration file

      Edit the /etc/my.cnf file

      # vi /etc/my.cnf

      Change 

      datadir=/var/lib/mysql

      socket=/var/lib/mysql/mysql.sock

      To 

      datadir=/app/mysql

      socket=/app/mysql/mysql.sock 

      port=3375

      user=mysql

      And add
      [client]

      socket=/data/mysql/mysql.sock

      port=3375
      And also comment the below params
      log-error=/var/log/mysqld.log

      pid-file=/var/run/mysqld/mysqld.pid

      14-Mar-10-2023-10-18-56-1746-AM
    9. Save the file.
    10. Adjust parameters to accept the change. Should the following command output
      “Permissive” or “Disabled”.
      # getenforce
      1. Run the semanage command to add a context mapping for /app/mysql.
        # semanage fcontext -a -t mysqld_db_t "/app/mysql(/.*)?"
      2. Now use the restorecon command to apply this context mapping to the running system
        # restorecon -Rv /data/mysql
      3. Start the Mysql Server
        # service mysqld start
      4. Verifying access and connectivity
        # sudo service mysql start
      5. Verify the MySQL Data Directory using below command
        # mysql -u root -p -e "SELECT @@datadir;”
      6. Verify the MySQL port using below Command 
        #  mysql -u root -p -e "SELECT @@port;”

      Database upgradation to Enterprise_version

      Q1. What is the various MYSQL upgradation process from Community to Enterprise?

      Ans: 

      As per several blogs and the oracle support pages on the web related to the upgrade of the community version to the enterprise is not possible directly. Below are the steps that need to be followed. 

      1. The Enterprise package that needs to be downloaded from the Oracle cloud is different from the Community version that is installed from the features standpoint, so the Packages that are included as part of the download differ.
      2. Below is the link of Oracle cloud from where the Enterprise version has to be downloaded. Go to the Oracle Software Delivery website: https://edelivery.oracle.com
        It is required for the user to register the organization at the above link. 
      3. The existing MYSQL (Community version ) has to be uninstalled by taking the Database backup and then uninstalling the Community version. Install the Enterprise version of the MYSQL with additional packages for Audit logging, Technical Support, Slow Queries..etc Configure the MYSQL and restore the data from the Backup that has been taken.

      Q2. What Client can do, in case of upgradation to the enterprise is required?

      Ans: 

      1. Purchase the enterprise license from the Oracle Partners so that the consultants will be doing the upgradation from the Community version to the Enterprise version. 
      2. OE will provide the Support once the client procures the Enterprise version the activities of backup of DB, uninstalling the community version, Upgrading to the enterprise version, and restoring the Database dump(Backed up) 
      3. If the above process needs to be avoided then the client has to procure the Enterprise version up front of the production to avoid the multiple installations, Uninstallations and Back up of the data.

      Copyright © 2023, OvalEdge LLC, Peachtree Corners GA USA