Install Apache Tomcat , You must have EC2 server with JAVA install on that:-
[root@WebServer ~]# cd /opt/
[root@WebServer opt]# wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.109/bin/apache-tomcat-9.0.109.tar.gz
chmod +x /opt/apache-tomcat-<version>/bin/startup.sh chmod +x /opt/apache-tomcat-<version>/bin/shutdown.sh
ln -s /opt/tomcat/bin/startup.sh /usr/local/bin/tomcatup ln -s /opt/tomcat/bin/shutdown.sh /usr/local/bin/tomcatdown
Add /usr/local/bin
to your $PATH
(if missing)
$PATH
:/usr/local/bin
is missing, add it temporarily:/root/.bashrc
or /root/.bash_profile
:[root@WebServer tomcat]# find / -name context.xml
/opt/tomcat/conf/context.xml
/opt/tomcat/webapps/docs/META-INF/context.xml
/opt/tomcat/webapps/examples/META-INF/context.xml
/opt/tomcat/webapps/host-manager/META-INF/context.xml
/opt/tomcat/webapps/manager/META-INF/context.xml
[root@WebServer tomcat]# vi /opt/tomcat/webapps/host-manager/META-INF/context.xml
[root@WebServer tomcat]# vi /opt/tomcat/webapps/manager/META-INF/context.xml
And comment below line in both files by adding
<!-- and at end -->
Add below line in this file at the end:-
[root@WebServer tomcat]# vi /opt/tomcat/conf/tomcat-users.xml
<role rolename="manager-gui"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <role rolename="manager-status"/> <user username="admin" password="admin" roles="manager-gui, manager-script, manager-jmx, manager-status"/> <user username="deployer" password="deployer" roles="manager-script"/> <user username="tomcat" password="s3cret" roles="manager-gui"/>
Now access by using public ip and port 8080 after stopping and starting tomcat server by using below command:-
tomcatdown
Using unique ports for each application is a best practice in an environment. But tomcat and Jenkins runs on ports number 8080. Hence lets change tomcat port number to 8090. Change port number in conf/server.xml file under tomcat home
cd /opt/apache-tomcat-<version>/conf # update port number in the "connecter port" field in server.xml # restart tomcat after configuration update tomcatdown tomcatup
No comments:
Post a Comment