Installing Java 1.8 and Tomcat 8 in Centos 7
I have been setting up our servers in Amazon AWS and found that installing JDK is not as straightforward as I thought it would be 🙂
I had to do some googling before I could settle down on a method to setup and run tomcat 8 using jdk 1.8 in centos. Putting the steps below for reference to anyone who is trying to achieve the same in AWS:
Setting up Java 8
- Login into server
- Execute cd /opt
- Install wget using yum install wget
- wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm
NOTE : Please change the version if using a different version
Reference:
http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/
- Run the command :
rpm –ivh jdk-8u45-linux-x64.rpm - Check the java version using
java –version - Set the global environments
export JAVA_HOME=/usr/java/jdk1.8.0_45/
export PATH=$PATH:$JAVA_HOME - Add to the startup profile
vi /etc/profile.d/java.sh - Put the following content in the file
#!/bin/bash
JAVA_HOME=/usr/java/jdk1.8.0_45/
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
export CLASSPATH=. - Change the permission from all
chmod +x /etc/profile.d/java.sh - Set the environment variables permanently
source /etc/profile.d/java.sh
Reference
http://www.unixmen.com/install-oracle-java-jdk-8-centos-76-56-4/
Setting up Apache Tomcat 8
Setting up of tomcat is pretty straightforward. We just need to have the latest version downloaded and extracted to /opt
- Login into the server
- cd /opt
- wget http://mirrors.advancedhosters.com/apache/tomcat/tomcat-8/v8.0.22/bin/apache-tomcat-8.0.22.tar.gzNote: Replace the link with the latest version
- Extract the tar file
tar xzf apache-tomcat-8.0.21.tar.gz
- Setup the environment variable for the catalina home
echo “export CATALINA_HOME=\”/opt/apache-tomcat-8.0.22\”” >> ~/.bashrc
source ~/.bashrc
- Start the tomcat from bin folder
Reference :
http://tecadmin.net/install-tomcat-8-on-centos-rhel-and-ubuntu/
1 Response
[…] I am currently using centos 7 with Java 8 installed . The web container used is Tomcat8. You can read about the setting up of Java 8 and Tomcat 8 here. […]