CENTOS7 Deploying the Java Environment

Source: Internet
Author: User

#!/bin/bash
############# #检测软件包是否安装 ########################
For i in {java,java-1.8.0-openjdk-devel};
Do
If Rpm-qa | grep $i >>/dev/null;
Then
Echo-e "\033[32m $i installed \033[0m"
Else
Yum-y Install $i
Fi
Done

############## #查看java版本 #############################
Java-version
ECHO-E "\033[32m version display \033[0m"

########### #部署tomcat -9.0.7############################
For s in {apache-tomcat-9.0.7};
Do
If Rpm-qa | grep $s >>/dev/null;
Then
Echo-e "\033[32m $i installed \033[0m"
Else
Wget–c http://mirrors.hust.edu.cn/apache/tomcat/tomcat-9/v9.0.7/bin/apache-tomcat-9.0.7.tar.gz
Tar zxf apache-tomcat-9.0.7.tar.gz
Mv-f Apache-tomcat-9.0.7/usr/local/tomcat
Fi
Done
ECHO-E "\033[32M Deployment Complete \033[0m"

############# #配置环境变量 ###############################
Cat >>/etc/profile<<end
Export java_home= '/usr/lib/jvm/jre '
Export catalina_home= '/usr/local/tomcat '
End
Source/etc/profile
ECHO-E "\033[32M environment variable configuration complete \033[0m"

############ #启动tomcat ##################################
/usr/local/tomcat/bin/startup.sh
Echo-e "\033[32m Tomcat boot \033[0m"

############ #监听8080端口 ################################
Netstat-anutpl | grep 8080
Echo-e "\033[32m Java is listening \033[0m"

########### #移动war包 ####################################
MV tech-sdkwrapper.war/usr/local/tomcat/webapps/
Echo-e "\033[32m Complete War movement \033[0m"
Echo-e "\033[32m please visit \033[0m in browser"
Note: Because the current script is in the same directory as the Tomcat package and the war package, if it is not in the same directory, you need to modify the script appropriately.

Browser access mode:/HTTP Server ip:8080/
Browser access to the war package new features:/HTTP Server ip:8080/tech-sdkwrapper/remember not to access the suffix band. War directory

CENTOS7 Deploying the Java Environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.