在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 ...
随机推荐
- 算法与数据结构基础 - 堆(Heap)和优先级队列(Priority queue)
堆基础 堆(Heap)是具有这样性质的数据结构:1/完全二叉树 2/所有节点的值大于等于(或小于等于)子节点的值: 图片来源:这里 堆可以用数组存储,插入.删除会触发节点shift_down.shif ...
- [记录]优化Linux 的内核参数来提高服务器并发处理能力
优化Linux 的内核参数来提高服务器并发处理能力PS:在服务器硬件资源额定有限的情况下,最大的压榨服务器的性能,提高服务器的并发处理能力,是很多运维技术人员思考的问题.要提高Linux 系统下的负载 ...
- python安装及typora使用
第一章 环境搭建 1.1Python安装 1.1.1python官网www.python.org 1.1.2根据电脑系统选择下载 1.1.3确定电脑系统属性,此处我们以win10的64位操作系统为例 ...
- 新手小白快速登天日记之安装python以及环境变量和pycharm解释器较为详细教程
Python解释器安装及环境变量配置 Python官方网站:www.python.org 首先打开这个网址,找到downloads选择,因为我是Windows所以下载windows的,因电脑而异 然后 ...
- sql注入------基于时间延迟benchmark函数注入脚本
#author:windy_2import requests urlx = 'http://127.0.0.1/?id= 1 and if((substr((select database()),' ...
- js数字格式化(截断格式化或四舍五入格式化)
/*** * 数字格式化(适合金融产品截断小数位后展示) * @param num * @param pattern (标准格式:#,###.## 或#.## 或#,###00.00) * @para ...
- Masstransit的应用服务总线
Masstransit 是一个非常优秀的基于消息进行通信的分布式应用程序框架,详情参考官网. 在介绍AA.ServiceBus之前,先介绍下几个概念. 分布式 分布式系统如何定义?这里引用一下Dist ...
- linux初学者-用户管理篇
linux的用户管理是非常以后工作中重要的一部分,也是linux系统安全的防线. 1.用户理解 那么到底什么是用户呢?用户就是系统使用者的身份. 用户是以怎样的方式储存在计算机中的呢?在系统中用户存储 ...
- module中module.exports与exports的区别(转)
转https://cnodejs.org/topic/55ccace5b25bd72150842c0a require 用来加载代码,而 exports 和 module.exports 则用来导出代 ...
- Maven国内镜像 Maven阿里云镜像
<mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name&g ...