Apache Tomcat is a free and open-source implementation of the Java Servlet, JavaServer Pages, Java Expression Language, and WebSocket technologies. Tomcat provides a “pure Java” HTTP web server environment in which Java code can run.
Tomcat was originally written as a fork of the Apache Jakarta Project by Joshua Chase Blose, Bill Burke, and Jim Jagielski, though Tomcat has evolved considerably since its initial release.
Tomcat was later ported to many other operating systems in addition to Linux, including Mac OS X, Solaris, and HP-UX. Windows support was added with version 3.0. The final Tomcat 6 release (the first Cactus release) was released on December 20, 2006.
If the Tomcat instance needs to be used for applications that require a lot of I/O,
it may be advantageous to allocate a large sum of memory (using the -Xmx JVM parameter) and have either lots of CPUs or a faster CPU.
If enough memory is allocated, this may reduce the number of file system calls (which are often expensive) an application makes. This in turn will allow Tomcat to process more requests per second for these types of applications.
- Ubuntu 20
- zip, wget
#install zip and wget if you don't have alreadyapt update && apt upgrade -yapt install unzip wget#download tomcat from there official websitecd /tmpwget https://downloads.apache.org/tomcat/tomcat-10/v10.0.6/bin/apache-tomcat-10.0.6.zipunzip apache-tomcat-10.0.6.zipsudo mkdir -p /opt/tomcatmv apache-tomcat-10.0.6 /opt/tomcatcd /opt/tomcatcd apache-tomcat-10.0.6mv * ..# search for connector and change the port to 8070nano conf/server.xml#change file permission for excutecd /opt/tomcat/binchmod +x *#start tomcat/opt/tomcat/bin/startup.sh# now to go to your browserlocalhost:8070#config to connect with Jenkinsnano /opt/tomcat/conf/nano tomcat-users.xml#add the code at the bottom<role rolename="manager-script"/><role rolename="manager-gui"/><user username="tomcat" password="Abcd#4321" roles="manager-gui"/>#restart tomcat/opt/tomcat/bin/shutdown.sh/opt/tomcat/bin/startup.sh#if you see 503 access denied then follow this stepscd /opt/tomcat/webapps/manager/META-INFnano context.xml# command out this line<!--<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"sameSiteCookies="strict" /><Valve className="org.apache.catalina.valves.RemoteAddrValve"allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /><Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>--># again restast/opt/tomcat/bin/shutdown.sh/opt/tomcat/bin/startup.sh# now can access your manager pagehttp://yourmachineip:8070/manager/html# now config tomcat for productioncd /opt/tomcatls# you will seeapache-tomcat-version#shutdown tomcat/opt/tomcat/apache-tomcat-10.0.6/bin/shutdown.sh#copy to same place for prodcutioncp /opt/tomcat/apache-tomcat-10.0.6 /opt/tomcat/apache-tomcat-10.0.6-prod -r# change the portnano /opt/tomcat/apache-tomcat-10.0.6-prod/confi/server.xml#find connector and port 8005# change connecter to new port and 8005 to 8006<Connector port="8071" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443" /># and<Server port="8006" shutdown="SHUTDOWN"># save file# restart both/opt/tomcat/apache-tomcat-10.0.6/bin/startup.sh/opt/tomcat/apache-tomcat-10.0.6-prod/bin/startup.sh# access staging and production serverlocalhost:9070localhost:9071# check the log if you needtail -f apache-tomcat-10.0.6-prod/logs/catalina.out