在centos6系列vps装Tomcat8.0
In the following tutorial you will learn how to install and set-up Apache Tomcat 8 on your CentOS 6 VPS.
What is Tomcat?
Apache Tomcat (before known as Jakarta Tomcat) is an application server developed by the Apache Software Foundation that executes Java servlets and renders Web pages that include Java Server Page coding.
UPDATE THE SYSTEM
Make sure you are in a screen session and your CentOS 6 based Linux Virtual Server is up-to-date by running:
`
screen -U -S tomcat8-screen
yum update
`
INSTALL JAVA 8
Download the latest JAVA 8 from here or use the following command to download JAVA JDK 8u5:
for 32bit systems use:
`
wget --no-cookies \
--no-check-certificate
--header "Cookie: oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.rpm"
-O /opt/jdk-8-linux-i586.rpm
for 64bit systems use:
wget --no-cookies \
--no-check-certificate
--header "Cookie: oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.rpm"
-O /opt/jdk-8-linux-x64.rpm
`
once the JAVA package has been downloaded, install it using rpm as follows:
for 32bit systems use:
## rpm -Uvh /opt/jdk-8-linux-i586.rpm
for 64bit systems use:
## rpm -Uvh /opt/jdk-8-linux-x64.rpm
CONFIGURE JAVA
configure the newly installed JAVA package using alternatives as in:
`
alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_05/jre/bin/java 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_05/bin/jar 20000
alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_05/bin/javac 20000
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_05/jre/bin/javaws 20000
alternatives --set java /usr/java/jdk1.8.0_05/jre/bin/java
alternatives --set javaws /usr/java/jdk1.8.0_05/jre/bin/javaws
alternatives --set javac /usr/java/jdk1.8.0_05/bin/javac
alternatives --set jar /usr/java/jdk1.8.0_05/bin/jar
`
check the JAVA version running on your system:
## java -version
INSTALL TOMCAT 8
Create a separate user which will run the Tomcat server:
## useradd -r tomcat8 --shell /bin/false
Download the latest Tomcat 8 version from here or use the following command to download Tomcat 8.0.5
## wget http://mirrors.koehn.com/apache/tomcat/tomcat-8/v8.0.5/bin/apache-tomcat-8.0.5.tar.gz -P /tmp
Extract the contents of the Tomcat archive to /opt using the following command:
`
tar -zxf /tmp/apache-tomcat-8.0.5.tar.gz -C /opt
ln -s /opt/apache-tomcat-8.0.5 /opt/tomcat-latest
chown -hR tomcat8: /opt/tomcat-latest /opt/apache-tomcat-8.0.5
`
START THE TOMCAT 8 SERVICE
Create the following init script in /etc/init.d/tomcat8
#
# tomcat8
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat8
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Tomcat 8
# Short-Description: start and stop tomcat
### END INIT INFO
## Source function library.
#. /etc/rc.d/init.d/functions
export JAVA_HOME=/usr/java/default
export JAVA_OPTS="-Dfile.encoding=UTF-8 \
-Dnet.sf.ehcache.skipUpdateCheck=true \
-XX:+UseConcMarkSweepGC \
-XX:+CMSClassUnloadingEnabled \
-XX:+UseParNewGC \
-XX:MaxPermSize=128m \
-Xms512m -Xmx512m"
export PATH=$JAVA_HOME/bin:$PATH
TOMCAT_HOME=/opt/tomcat-latest
TOMCAT_USER=tomcat8
SHUTDOWN_WAIT=20
tomcat_pid() {
echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}
start() {
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Tomcat is already running (pid: $pid)"
else
# Start tomcat
echo "Starting tomcat"
ulimit -n 100000
umask 007
/bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
fi
return 0
}
stop() {
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Stoping Tomcat"
/bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh
let kwait=$SHUTDOWN_WAIT
count=0;
until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]
do
echo -n -e "\nwaiting for processes to exit";
sleep 1
let count=$count+1;
done
if [ $count -gt $kwait ]; then
echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seconds"
kill -9 $pid
fi
else
echo "Tomcat is not running"
fi
return 0
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo "Tomcat is running with pid: $pid"
else
echo "Tomcat is not running"
fi
;;
esac
exit 0
make the script executable using chmod
chmod +x /etc/init.d/tomcat8
Start the Tomcat 8 server using:
service tomcat8 start
Add the Tomcat 8 service to system startup:
chkconfig tomcat8 on
Access your newly installed Tomcat at http://YOUR_IP:8080
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Tomcat 8 for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
在centos6系列vps装Tomcat8.0的更多相关文章
- Centos6.3 下使用 Tomcat-6.0.43 非root用户 jsvc模式部署 生产环境 端口80 vsftp
一.安装JDK环境 方法一. 官方下载链接 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260 ...
- Centos6.3 下使用 Tomcat-6.0.43 非root用户 部署 生产环境 端口转发方式
一.安装JDK环境 方法一. 官方下载链接 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260 ...
- MyEclipse2015+Tomcat8.0+Maven3.3项目环境搭建
之前一直用自己的笔记本进行web项目的开发,实验室配了一台台式机,软件和环境都需要重新配置和安装.最近准备用SSM(Spring,SpringMVC,MyBatis)框架编写一个图书管理系统,主要使用 ...
- Apache 2.4.12 64位+Tomcat-8.0.32-windows-x64负载集群方案
上次搞了Apache 2.2的集群方案,但是现在自己的机器和客户的服务器一般都是64位的,而且tomcat已经到8了.重新做Apache 2.4.12 64位+Tomcat-8.0.32-window ...
- Eclipse_luna_J2EE_For_JS+tomcat8.0环境搭建、配置、开发入门
一.所有需要的软件.插件等下载地址 J2SE的官方下载路径:http://www.oracle.com/technetwork/java/javase/downloads/index.html Ecl ...
- CentOS6.5升级为CentOS7.0
CentOS6.5升级为CentOS7.0 CentOS6.5升级为CentOS7 升级前: [root@localhost ~]# cat /proc/version Linux version ...
- 阿里云ECS每天一件事D7:安装tomcat8.0
这一D,跨越了几个月啊,人是越来越懒,集中写一些,就懒得再记录了.也是因为测试需要,搭建个jsp的服务环境,只是测试,考虑用tomcat就够了. 在Tomcat官网下载最新Core版本,下载之后,将文 ...
- Linux下Tomcat8.0.44安装使用Apr
听说Apr可以提高tomcat很多的性能,配置具体如下1.安装apr 1.5.2 [root@ecs-3c46 ]# cd /usr/local/src [root@ecs-3c46 src]# wg ...
- [js高手之路]深入浅出webpack教程系列1-安装与基本打包用法和命令参数
[js高手之路]深入浅出webpack教程系列索引目录: [js高手之路]深入浅出webpack教程系列1-安装与基本打包用法和命令参数 [js高手之路]深入浅出webpack教程系列2-配置文件we ...
随机推荐
- 无法在<fastCGI>应用程序配置中找到<handler> scriptProcessor
在打开php文件的时候发现iis7.5报错了 每次在切换php版本的时候不知道为什么会出现这个错误,有的时候就又不会报错直接可以正常使用,然而php版本确定已经下载好,才可能的打开这个页面,那么就是i ...
- Java编程思想:标准I/O
import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils; import java.io.*; public class Test { ...
- [原创]自动化部署K8S(v1.10.11)集群
标准运维实现自动化部署K8S集群主要分两步,第一步是部署gse-agent,拱第二步执行部署. 第一步:部署gse-agent.如下: 第二步:部署k8s集群.主要通过作业平台分为5小步执 ...
- C# 与 JS 之间传值在 cshtml页面中
@{ string It = "sss"; ; } @functions{ string Mod = "ajssaioi"; public string Itm ...
- 浅谈redis
1.Redis简介: Redis是一个开源的使用ANSI C语言编写,遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.它通常被称为数据结构服务 ...
- ehcache的使用 Shiro与Ehcache的结合(附:EhcacheUtils)
ehcache 缓存的使用 合理的使用缓存会极大的提高程序的运行效率.切记:缓存请勿滥用. 配置ehcache与Shiro shiro初识请查看该文章 https://blog.csdn.net/py ...
- 「Sqlserver」数据分析师有理由爱Sqlserver之九-无利益关系推荐Sqlserver书单
在前面系列文章的讲述下,部分读者有兴趣进入Sqlserver的世界的话,笔者不太可能在自媒体的载体上给予全方位的带领,最合适的方式是通过系统的书籍来学习,此篇给大家梳理下笔者曾经看过的自觉不错值得推荐 ...
- 二、SQL Server 2008附加数据库时出错的解决方法
错误中提示“数据库的版本为661,无法打开.此服务器支持655版及更低版本.不支持降级路径”. 这种情况是由于高版本的数据库文件在低版本的数据库上造成的,即我们要附加的数据库文件的版本高于当前SQL ...
- 【ironic】ironic介绍与原理
[ironic]ironic介绍与原理 零,配置文件 0.1 配置驱动 文件ironic.conf, ipmi硬件类型,默认值也是ipmi, pxe_ipmitool驱动也是默认值,配置驱动 [DEF ...
- java - tcp如何保证传输的可靠性和有序性
TCP提供的是一种面向连接的,可靠性的字节流服务. 可靠性: 1.应用数据被TCP划分为最适合发送的数据包: 2.在TCP发送一个数据块后,将启动一个定时器,用以接收目的端的确认信息,若不能及时得到确 ...