在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 ...
随机推荐
- Spring+MyBatis时Access denied for user '高欢欢'@'localhost' (using password: YES)的异常解决方案
今天在做spring+mybatis整合的时候系统只要一运行就会报下面的错误,搞了几个小时硬是没有找的原因 警告: com.mchange.v2.resourcepool.BasicResourceP ...
- FC游戏修改教程(hack)小白文。
FC(NES)红白机Family Computer(简称FAMICOM)(或Nintendo Entertainment System)是任天堂公司发行的第一代家用游戏机. 修改FC游戏需要的工具有 ...
- Mybatis generator生成工具简单介绍
Mybatis generator 其主要的功能就是方便,快捷的创建好Dao,entry,xml 加快了开发速度,使用方面根据其提供的规则配置好就OK 这里还有一个重要的开发场景,开发过程中,对数据 ...
- 必懂的webpack高级配置
webpack高级配置 1.HTML中img标签的图片资源处理 使用时.只需要在html中正常引用图片即可.webpack就会找到对应的资源进行打包.并修改html中的引用路径 主要是将html中的i ...
- 【杂谈】Hash表与平衡树
hash表与平衡树查询数据的时间复杂度是多少? hash表为O(1),平衡树为O(logn) 这个时间复杂度是如何得出的? 时间复杂度是按照最糟糕的情况来的.但即使是最糟糕的情况,hash表也只需要计 ...
- golang在多个go routine中进行map或者slice操作应该注意的对象。
因为golang的map和列表切片都是引用类型,且非线程安全的,所以在多个go routine中进行读写操作的时候,会产生“map read and map write“的panic错误. 某一些类型 ...
- 【iOS】Xcode unexpected code bundles
如图所示: ……
- Is it a full physical image???
My friend asked me why she could not find some important files in a physical image acquired from an ...
- python redis连接 有序集合去重
# -*- coding: utf-8 -*- import redisfrom constant import redis_ip, redis_db, redis_pw, logger, redis ...
- ansible批量管理服务 下
1 ansible-playbook 任务剧本 1.1 剧本文件概念 (1)playbook可以将多个批量操作模块功能整合,完成一件事情.(2)简化运维工作复杂度(3)playbook通过yaml语法 ...