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.
- Machine 1 - MySQL
- Machine 2 - OvalEdge Application
- Machine 3 - Elasticsearch
Installing MySQL on VM-1
To install MySQL on Machine-1, complete the following steps using the commands mentioned below:
- 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.
- Install MySQL 8.0 on RHEL 7 using the below command.
sudo yum --enablerepo=mysql80-community install mysql-community-server. - Start MySQL 8 Server using the command
sudo systemctl enable --now mysqld.service - Confirm the service status return as running using the below command
sudo systemctl status mysqld - Restart the service using below command
sudo systemctl restart mysqld.service - 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 - Change the MySQL root user password and secure the MySQL installation using the below command.
sudo mysql_secure_installation - Secure the MySQL server deployment.
- Enter the password for the user root: ***********
- The existing password for the user account root has expired. Please set a new password.
New password: xxxx
Re-enter new password:xxxx
- The 'validate_password' component is installed on the server.
- The subsequent steps will run with the existing configuration of the component.
- Using existing password for root.
- 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 - 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
- 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
-
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 - Dropping test database…
Success. - Removing privileges on test database…
Success.
- 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!
- Login into MySQL using the command mysql -u root -p.
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
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
Installing Tomcat
- 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 - Unzip the downloaded apache tomcat archive
tar -xvzf apache-tomcat-9.0.70.tar.gz - 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/
- 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 - 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
- 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/ - 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 - Type “i” to go to insert mode.
- Do the changes you want and press ESC and type “:wq!” and press Enter.
- If you want to exit without making any changes, press ESC and type “:q!” and press Enter.
Externalizing oasis.properties
- cd /home/ovaledge
- 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 -
Create setenv.sh file
- Go to path /home/ovaledge/apache-tomcat-9.0.70/bin
- Create one file vi setenv.sh
- Insert the below code into it.
exportCATALINA_OPTS=”-Duse.http=true-Dext.properties.dir=file:/home/ovaledge/extprop/” - Now, Run the ./startup.sh under the tomcat bin folder.
Tomcat as a Service
- Go to path /etc/systemd/system
cd /ect/systemd/system - Create one service file using the below command
vim tomcat.service - 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 - Modify the file as per the user details.
- Follow the below commands to start, stop or restart the service
- To reload the service use the below command
systemctl daemon-reload - To start the service
systemctl start tomcat.service - To enable the service
systemctl enable tomcat.service - To check the status of the service
systemctl status tomcat.service
ElasticSearch Installation on VM-3
- Install Java
sudo yum install java-1.8.0-openjdk - Download and install the public signing key for the Elasticsearch repository.
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch - 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 -
Install elastic search using the command sudo yum install --assumeyes elasticsearch.
- Configure Elasticsearch service to automatically start during system boot.
sudo systemctl enable elasticsearch.service
- Start Elasticsearch service.
sudo systemctl start elasticsearch.service - Status of Elasticsearch service
sudo systemctl status elasticsearch.service - 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
- cluster.name: ovaledge
- network.host: 0.0.0.0
- transport.host: localhost
- transport.tcp.port: 9300
- http.port: 9200
- xpack.security.enabled: true
- Restart Elasticsearch service.
sudo systemctl restart elasticsearch.service
- 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- elastic
- apm_system
- kibana_system
- logstash_system
- beats_system
- remote_system
- Now, enter the below URL for the result.
http://IP:9200 - In order to integrate Elastic search with ovaledge application we need to edit the oasis.properties as shown in below screenshot.
- After editing this file we need to restart the tomcat service.
Custom Fields
Changing of MySQL Default directory & Port to Custom
- Identify Current MySQL Data Directory using below command
# mysql -u root -p -e "SELECT @@datadir;" - After you enter the MySQL password, the output should be similar to
- Stopping the Mysql service
# sudo service mysqld stop - Create a new data directory and move the content from the old one
- Creating a new data directory
# mkdir /app
# mkdir /app/mysql
# chown mysql:mysql /app/mysql
- Take a backup of data directory
# cp -R /var/lib/mysql /var/lib/mysql_bkp - Moving the original data files
# mv /var/lib/mysql/* /app/mysql/ - 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.logpid-file=/var/run/mysqld/mysqld.pid
- Save the file.
- Adjust parameters to accept the change. Should the following command output
“Permissive” or “Disabled”.
# getenforce
- Run the semanage command to add a context mapping for /app/mysql.
# semanage fcontext -a -t mysqld_db_t "/app/mysql(/.*)?" - Now use the restorecon command to apply this context mapping to the running system
# restorecon -Rv /data/mysql - Start the Mysql Server
# service mysqld start - Verifying access and connectivity
# sudo service mysql start - Verify the MySQL Data Directory using below command
# mysql -u root -p -e "SELECT @@datadir;” - 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.
- 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.
- 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. - 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:
- 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.
- 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)
- 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