1) 使用默议方式建立tomcat用户
useradd tomcat
2) 修改tomcat用户密码
passwd tomcat
1.1. 配置Tomcat 7
1) 建立tomcat安装目录
mkdir /usr/local/tomcat
2) 将目录访问权限更改至tomcat用户下
[root@localhost local]# chown -R -v tomcat /usr/local/tomcat
changed ownership of `/usr/local/tomcat/apache-tomcat-7.0.61.tar.gz' to tomcat
changed ownership of `/usr/local/tomcat' to tomcat
[root@localhost local]# ls -al
total 52
drwxr-xr-x. 13 root root 4096 May 14 18:17 .
drwxr-xr-x. 16 root root 4096 Sep 26 2014 ..
drwxr-xr-x. 2 root root 4096 Dec 31 03:02 bin
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 3 root root 4096 Dec 31 02:56 include
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib
drwxr-xr-x. 3 root root 4096 Nov 12 2014 lib64
drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec
drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin
drwxr-xr-x. 6 root root 4096 Nov 12 2014 share
drwxr-xr-x. 2 root root 4096 Sep 23 2011 src
drwxr-xr-x. 2 tomcat root 4096 May 14 18:17 tomcat
[root@localhost local]#
3) 进入/usr/local/tomcat目录,解压tomcat程序包
tar -xvf apache-tomcat-7.0.61.tar.gz
4) 验证tomcat安装成功
进入/usr/local/tomcat/apache-tomcat-7.0.61/bin目录
执行sh startup.sh
访问默认端口地址 http://192.168.1.231:8080/
5) 调整tomcat端口
vi /usr/local/tomcat/apache-tomcat-7.0.61/conf/server.xml
http 8080 –> 5306
https 8443 –> 5303
ajp 8009 –> 5309
6) 配置tomcat jvm参数
vi /usr/local/tomcat/apache-tomcat-7.0.61/bin/catalina.sh
JAVA_OPTS="-server -Xms512m -Xmx512m -Xss256k -XX:PermSize=128M -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=80 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:../logs/gc.log"
7) 配置tomcat应用服务