Installing tomcat in DigitalOcian CentOS Server and setting Manager and Admin users to access from the remote system instead of accessing tomcat from the browser of tomcat installed system

<pre>
wget http://mirrors.wuchna.com/apachemirror/tomcat/tomcat-9/v9.0.12/bin/apache-tomcat-9.0.12.tar.gz
  tar xzf apache-tomcat-9.0.12.tar.gz
  mv apache-tomcat-9.0.12 /usr/local/tomcat9

  //Add path to the .bashrc user
  cat .bashrc
  echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc

  cat .bashrc
  source ~/.bashrc

 //FOR MANAGER
 // Open below file
 sudo vi /usr/local/tomcat9/conf/tomcat-users.xml

 // Add below User inside the <tomcat-users> element and then save and exit
 <!-- user manager can access only manager section -->
 <role rolename="manager-gui"/>
 <user username="tomcat_manager" password="tomcat@123" roles="manager-gui"/>

 // Open below file and comment the 2 tags inside the <Context>  element & and then save and exit
 sudo vi  /usr/local/tomcat9/webapps/manager/META-INF/context.xml

 //FOR HOST MANAGER

 // Add below User inside the <tomcat-users> element and then save and exit
 sudo vi /usr/local/tomcat9/conf/tomcat-users.xml
 <!-- user admin can access manager and admin section both -->
 <role rolename="admin-gui" />
 <user username="tomcat_admin" password="tomcat@123" roles="manager-gui,admin-gui" />

 // Open below file and comment the 2 tags inside the <Context>  element & and then save and exit
 sudo vi  /usr/local/tomcat9/webapps/host-manager/META-INF/context.xml

 // Server restart is not required.
 sudo  /usr/local/tomcat9/bin/shutdown.sh
 sudo  /usr/local/tomcat9/bin/startup.sh
 netstat -tlpn
 free -m

 // TO SEE USER AND PASSWORD
 sudo cat /usr/local/tomcat9/conf/tomcat-users.xml | grep 'tomcat_manager'
 sudo cat /usr/local/tomcat9/conf/tomcat-users.xml | grep 'tomcat_admin'

 // To logout from the Manager OR Host Manager, just close the BROWSER. Automatically it will be logged out.


 Reference Links:
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7
 https://stackoverflow.com/questions/36703856/access-tomcat-manager-app-from-different-host
 https://stackoverflow.com/questions/18415578/how-to-change-tomcat-port-number
 https://tecadmin.net/install-apache-tomcat-9-on-centos/
 </pre>

Comments