-
Notifications
You must be signed in to change notification settings - Fork 1
/
Manual_Service_Configuration
112 lines (76 loc) · 2.97 KB
/
Manual_Service_Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Document for Single Node Stack, Means (Web Server, App Server & DB Server on single node)
Step 1 : Db Server Setup.
1. Install DB Server
# yum install mariadb-server -y
2. Start MariaDB Service
# systemctl enable mariadb
# systemctl start mariadb
3. Create DB and Create users to access DB.
Create a file student.sql
# vim student.sql
Copy the following content into that file.
create database studentapp;
use studentapp;
CREATE TABLE Students(student_id INT NOT NULL AUTO_INCREMENT,
student_name VARCHAR(100) NOT NULL,
student_addr VARCHAR(100) NOT NULL,
student_age VARCHAR(3) NOT NULL,
student_qual VARCHAR(20) NOT NULL,
student_percent VARCHAR(10) NOT NULL,
student_year_passed VARCHAR(10) NOT NULL,
PRIMARY KEY (student_id)
);
grant all privileges on studentapp.* to 'student'@'%' identified by 'student@1';
flush privileges;
After that load this file to mysql.
# mysql < student.sql
Step 2 : App Server Setup. (Tomcat)
1. Install Java
# yum install java -y
2. Download Tomcat and extract it
# cd /root
# wget -O- https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.6/bin/apache-tomcat-9.0.6.tar.gz | tar -xz
3. Configure Tomcat
Download war and jar files
# cd /root/apache-tomcat-9.0.6
# rm -rf webapps/*
# wget https://github.com/cit-aliqui/APP-STACK/raw/master/student.war -O webapps/student.war
# wget https://github.com/cit-aliqui/APP-STACK/raw/master/mysql-connector-java-5.1.40.jar -O lib/mysql-connector-java-5.1.40.jar
Configure context.xml for DB connection.
Open conf/context.xml and add the following content just before the last line.
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="50" maxIdle="30" maxWait="10000"
username="student" password="student@1"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://10.142.0.7:3306/studentapp"/>
Note: IP 10.142.0.7 is DB server IP address, If you are using same host then give the IP address of that host, but not localhost
4. Start your tomcat
# /root/apache-tomcat-9.0.6/bin/startup.sh
Step 3 : Web Server Setup (HTTPD)
1. Install web server
# yum install httpd httpd-devel gcc -y
2. Download ModJK and comnpile it
# cd /root
# wget -O- http://www-us.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.43-src.tar.gz | tar -xz
# cd /root/tomcat-connectors-1.2.43-src/native
# ./configure --with-apxs=/usr/bin/apxs
# make
# make install
3. Create ModJK confif files
Create mod-jk.conf
# cat /etc/httpd/conf.d/mod-jk.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf.d/worker.properties
JkMount /student local
JkMount /student/* local
# Add following lines only if you want to redirect, Also change the IP address of URL.
RewriteEngine On
RewriteRule ^/$ http://35.231.223.147/student
Create worker.properties file
# cat /etc/httpd/conf.d/worker.properties
worker.list=local
worker.local.host=localhost
worker.local.port=8009
4. Restart Web Server.
# systemctl enable httpd
# systemctl start httpd