Verified and Tested 1/21/15
This tutorial will take you through installing Tomcat 8 on CentOS 6.7 x86_64. Tomcat is an application server that is used to execute Java servlets and publish web pages that include Java coding. Tomcat requires Java to be installed which will be covered in this tutorial.
An Atlantic.Net Cloud Server with the CentOS 6.7 x86_64 operating system. If you do not have one, consider one of our many affordable VPS hosting solutions.
Installing Java and Tomcat on CentOS 6.7
The first step to installing Tomcat is to first install the Java JDK. At the time of this article, the most up-to-date version of Java is Java SE 8u25. It is very likely that Java will have updated from this point, but the process is the same. You can find the available JDKs from the Java website.
Once on the website, click the Download button under JDK to go to the JDK’s download page. Once there, choose and copy the link location for the OS that you need (in our case the Linux x64 version) and on your server type:
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense= accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u25-b1 7/jdk-8u25-linux-x64.rpm" -O jdk-8-linux-x64.rpm
This will download the JDK to your server where you can then install it by running:
rpm -Uvh jdk-8-linux-x64.rpm
Once that is installed, you only need to install Tomcat now. You can find the latest version of Tomcat on the Tomcat website. At the time of this article, the latest version of Tomcat 8 is Tomcat 8.0.15. You can install it by running:
Once downloaded, run the below to extract and essentially install it.
tar -xzf apache-tomcat-8.0.15.tar.gz
After extracting Tomcat from the download file, you have essentially installed it and it is ready for any configuration you’d like to do. Once the extraction is done, you can rename or move the freshly extracted folder “apache-tomcat-8.0.15” to anything/where you’d like. Be sure to keep track of it’s location, as to start/stop the service, you will need to use the startup.sh and shutdown.sh scripts that are contained in the /bin directory within the folder. Finally, to perform any configuration, you will need to edit the server.xml which is contained in the extracted folder’s /conf directory. You do not need to edit this to see if Tomcat is working. All you would need to do is run the startup.sh and the server will start Tomcat without any configuration changes being made. (Make sure you have the port open in your firewall!)
Congratulations! You have just installed Tomcat and Java on your CentOS 6.7 Cloud Server. Thank you for following along in this How-To, and check back with us for any new updates. You may want to follow the guides on changing the CentOS 6.7 hostname or spend some time learning the initial Centos 6 setup. For more information on our reliable VPS hosting solutions, contact us today for a consultation.