0% found this document useful (0 votes)
50 views10 pages

Tomcat

The document provides steps to install and configure Tomcat on an AWS instance. It includes instructions for downloading and installing Tomcat, building a web application using Maven, deploying the application to Tomcat, and configuring security and other settings like ports.

Uploaded by

rahulchakri0369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views10 pages

Tomcat

The document provides steps to install and configure Tomcat on an AWS instance. It includes instructions for downloading and installing Tomcat, building a web application using Maven, deploying the application to Tomcat, and configuring security and other settings like ports.

Uploaded by

rahulchakri0369
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

TOMCAT

AWS Control Managerrequest to cyber security team SSL certificate email Forward to us 
SSL link add to Tomcat instance 
sudo yum update - for updating aws instance
sudo yum install java-1.8.0-openjdk-devel – install java
sudo yum install git – Install git or yum install -y git
git clone https://github.com/Rahul0104Amb/myweb.git -cloning repository
sudo yum install maven - install maven
mvn –version -check version
mvn clean install -for updating maven
cd myweb/ - we will find pom.file
ls
mvn clean package - it will run maven (in red coulur) Building war:
/home/ec2-user/myweb/target/myweb-8.2.0.war
cd target/
ls - this 2 commands will show target file myweb-8.2.0.war in red colour
sudo yum install java-1.8.0-openjdk-devel # For Amazon Linux
sudo apt install openjdk-8-jdk # For Ubuntu
type tomcat in google
open Tomcat 9.0-> copy tar,gz file
sudo wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.78/bin/apache-tomcat-9.0.78.tar.gz
- for downloading tomcat (wget means get from website) apache-tomcat-9.0.78.tar.gz
downloaded
ls – it will show apache-tomcat-9.0.78.tar.gzin red colour
tar -xvf apache-tomcat-9.0.78.tar.gz– x-unzip, v -verbose, f-forcefull
ls - it will get directory in blue colour TOMACAT INSTALLATION COMPLETED
cd apache-tomcat-9.0.78 - it will open below directories
bin -start/stop
conf – user.xml file
lib-
logs
webapps
cd webapps/ >
pwd > it will display home/ec2-user/myweb/target

open MAVEN instance copy pem file


vi /To.pem- it will open a window, press I and paste key file copied from note pad
press Esc :wql

chmod 700 / vi /To.pem > user level promotions change mode

pwd > it will display home/ec2-user/myweb/target

ls > select war file displayed in red colour

scp -i /To.pem myweb-8.2.0.war [email protected] (Tomcat public ip):/


home/ec2-user/myweb/target (copy after pwd file) secure copy,interactive,
Copying war file

If permission denied

cd.. > In tomcat instance

ls -l > it will display file permissions check permissions of webapps


chmod 777 webapps/ > it will give permissions for webapps

ls -l > it will display permissions

cd webapps/

pwd

ls > it will not show war file

Switch to Maven Instance

scp -i/tap/Tomc.pem myweb-8.2.0.war ec2-user@Tomcat publicIP:/home/ec2 (copy after pwd file)


secure copy,interactive, Copying war file – Now it will copy

Go to Tomcat Instance

ls > it will display war file in Tomcat

cd..

ls > it will display bin config lib logs to start tomcat we should go into bin

cd bin > it will display shell scrips which starts with sh

./startup.sh > to run shell script we should enter ./ for starting tomcat service

cd..

ls > it will will display few files ex: web apps

cd webapps/ >

ls > it will show directory which includes mywe b 8.2.0 in blue colour

Next copy Tomcat Public Ip & paste in browser 24.656.23.8:8080 it will display website and next
24.656.23.8:8080/web apps

mv myweb -8.2.0 Rahul For renaming myweb

ls

for checking Next copy Tomcat Public Ip & paste in browser 24.656.23.8:8080 it will display website and
next 24.656.23.8:8080/web apps

For providing security come back press pwd enter next

cd .. To come out

pwd It will display /home/ec2-user/apache-tomcat-9.0.65 (Home directory)

ls will display files ex webapps

cd webapps/ To enter into webapps


ls it will display files ex manager

cd manger/ Enter into manger

ls it will display files ex META INF

cd META-INF/ Enter META-INF

ls it will display files ex Context.xml

vi context.xml use vi it will open CLI

It will show 2 Tags Value tag & Manager tag, we should delete it as it as 127 – loop back address

Escape and press d for 2 times

Esc ;wq!

cd .. back to manager from META-INF

cd .. back to webapps from Manager

cd .. back to apache-tomcat-9.0.78 from webapps

pwd check where you are, it will show /home/ec2-user/apache-tomcat-9.0.65

ls will display files

Now create in conf directory (bin finished)

cd conf/

ls it will display file tomcat-users.xml

vi tomcat-users.xml scroll down to the last line & go to insert mode > enter at up arrow>select 1 st
3 lines & copy and paste end

and go to 1st line edit between “tomcat “ and change it to “manager-gui”

2nd line “role1” to “manager-script” for password

3rd line username= “Rahul” password “Rahul” roles “manager-gui:manager-script”- also we


can create more users
Esc :wq!

If we do nay modifications in tomcat we should stop and start services (go into bin)

Cd ..

Ls

Cd bin

Ls

./shutdown.sh

./startup.sh

for checking Next copy Tomcat Public Ip & paste in browser 24.656.23.8:8080 it will display website and
next 24.656.23.8:8080/web apps

To change tomcat port number

Cd ..

Ls it will show webapps

Cd conf/

Ls it will show file server.xml

Vi server.xml edit
Find the above and edit edit 8080 to2525

Esc :wq!

We need to stop and start tomcat

Cd .. for going back to home directory

Cd bin

ls

./shutdown.sh

./startup.sh

After bin we should go to conf directory

Cd .. we should come out from bin directory to home directory

Ls it will display conf file also

cd conf/ get inside conf directory

ls it will display server.xml , web.xml , tomcat-users.xml files

vi server.xml for searching any word we can see by pressing Esc /8080

scroll down for below and edit port no. from 8080 to 5678 example

And scroll down further for ssl certificate link and change the ssl certificate link in “” given by cyber
security team  aws control manager devops team

Scroll down further to find Realm

Esc :Wq!
If we do any modifications in tomcat we should go into bin directory & stop & start services

Cd ..

Cd bin

ls

./shutdown.sh

./startup.sh

Above index.jsp file is called welcome file list

We can check by doing below steps

Cd ..

Ls

Cd conf/ it will display web.xml file


Vi web.xml/ search index. Esc/

You might also like