毕业实习:JSP开发环境TOMCAT系统安装调试报告
JSP开发环境TOMCAT系统安装调试报告1.说明
本文档是jsp开发环境TOMCAT系统安装调试的详细过程,作为系统管理、维护、分析的重要依据。
2. 软件准备:
Redhat Linux7.2(内核LINUX2.4.7)
Redhat发行的Redhat Linux7.2光盘套件。
proftp-1_2_5.tar.gz
下载网址http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.1.1/bin
SSHD-4_0_3-i386.rpm
Redhat发行的Redhat Linux7.2光盘套件中。
j2sdk-1.4.0-linux.bin
下载网址:http://java.sun.com/products/jdk/1.4/download-linux.html
jakarta-tomcat-4.1.18.tar.gz
下载网址:http://jakarta.apache.org/builds/jakarta-tomcat/release
3.软件安装和配置。
3.1 安装Redhat Linux7.2.
3.1.1 安装方法:本地光盘启动安装。
3.1.2 系统语言选择:ENGLISH(USA)
3.1.3 选择引导程序:GRUB
3.1.4 硬盘分区:在硬盘中划分8G空间,分区规划如下:
文件系统 类型 大小(M) 格式化
/boot EXT2 128M YES
(交换分区) SWAP 512M YES
/tmp EXT2 512M YES
/var EXT2 1024M YES
/ EXT2 1024M YES
/usr EXT2 2048M YES
/home EXT2 2944M YES
(分区程序划分过程可能与上述数据有差别,可以做出局部调整,要作详细记录)
3.1.5 系统安装方式:CUSTOM
3.1.6 系统软件包选择:
默认的X-Window System软件包。
默认的KDE软件包
默认的NetWork Support软件包
默认的Kernel Develop软件包
其他软件包不做选择。
要点:安装过程做出的各项选择的记录。
3.1.7 制作启动系统的引导盘:安装结束系统提示是否制作引导盘,把一张干净的软盘插入后,回答YES。
3.1.8 安装过程结束后,重新启动计算机。
3.2 配置LINUX.
在做下列配置管理之前,使用mkdir命令在/home目录中创建/home/bak目录,用来存放备份目录和备份文件
,下列提到的配置文件,在备份时在原文件名后加后缀".old"作标识。
3.2.1 用户管理:
1)设置超级用户root密码:
#passwd root
2)增加组及用户:
#groupadd qxh
#useradd -G qxh qxh
#passwd qxh
3)备份用户和组文件
#mkdir /home/bak/usr_mng
#cp /etc/passwd /home/bak/usr_mng/passwd.old
#cp /etc/group /home/bak/usr_mng/group.old
3.2.2 引导管理:
1)制作引导系统文件副本:
#cp /boot/vmlinuz-2.4.7-10 /boot/vmlinuz-2.4.7-10.bak
#cp /boot/initrd-2.4.7-10.img /boot/initrd-2.4.7-10.img.bak
2)修改grub引导文件/boot/grub/grub.conf
#vi /boot/grub/grub.conf
修改如下:
default=0(选择grub默认引导选项的标号)
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.7-10)
root (hd0,0)
kernel /vmlinuz-2.4.7-10 ro root=/dev/sda2
initrd /initrd-2.4.7-10.img
title Red Hat Linux bak(2.4.7-10)
root (hd0,0)
kernel /vmlinuz-2.4.7-10.bak ro root=/dev/sda2
initrd /initrd-2.4.7-10.img.bak
3)备份引导系统文件:
#mkdir /home/bak/boot_mng
#cp /boot/grub/grub.conf /home/bak/boot_mng/grub.conf.old
3.2.2 网络管理:
1)创建备份目录:
#mkdir /home/bak/net_mng
2)配置网卡:
#vi /etc/sysconfig/network-script/ifcfg-eth0
设置如下:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.52
NETMASK=255.255.255.0
GATEWAY=192.168.1.2
备份文件:
#cp /etc/sysconfig/network-script/ifcfg-eth0 /home/bak/net_mng/ifcfg-eth0.old
3)TCP/IP设置
设置主机的IP地址和对应的全域名:
#vi /etc/hosts
设置如下:
# that require network functionality will fail.
127.0.0.1 f52 localhost.localdomain localhost
192.168.1.51 f51 f51.localdomain
192.168.1.52 f52 f52.localdomain
192.168.1.53 f53 f53.localdomain
设置网络地址和它的网络名称:
#vi /etc/sysconfig/networks
设置如下:
NETWORKING=yes
HOSTNAME=f51
GATEWAY=192.168.1.2
设置解析器:
#vi /etc/host.conf
设置如下:
order hosts,bind
设置域名服务器的名称及其IP地址,还有缺省查找的域名:
#vi /etc/resolv.conf
设置如下:
search zist.edu.cn
nameserver 210.32.24.22
备份文件:
#cp /etc/host /home/bak/net_mng/host.old
#cp /etc/sysconfig/networks /home/bak/net_mng/networks.old
#cp /etc/host.conf /home/bak/net_mng/host.conf.old
#cp /etc/resolv.conf /home/bak/net_mng/resolv.conf.old
4) 网络服务程序管理和防火墙:
#setup
设置防火墙:
进入"Firewall configuration"设置"Security Level"为"High",进入"Customize"项设置如下
You can customize your firewall in two ways. First, you can select to x
x allow all traffic from certain network interfaces. Second, you can allowx
x certain protocols explicitly through the firewall. Specify additional x
x ports in the form 'service:protocol', such as 'imap:tcp'. x
x x
x Trusted Devices: [*] eth0 x
x x
x Allow incoming:[ ] DHCP [*] SSH [ ] Telnet x
x [*] WWW (HTTP) [ ] Mail (SMTP) [*] FTP x
x Other ports _________________________ x
x x
x x
x x OK x x
x x
x x
x
设置完成选择“ok”退出
设置启动服务程序:
进入"System services",设置xinetd程序启动的服务选项:把
"xinetd","ipchains","iptables","network","syslog"选项选上,其他的服务去除,选择“ok”退出。
3.2.3 配置完成,重新启动计算机。
3.3 安装配置proftp
3.3.1 安装proftp
解压安装到/usr/local/proftp
#cp proftp-1_2_5.tar.gz /home/software
#cd /home/software
#tar zvfx proftp-1_2_5.tar.gz
#cd proftp-1_2_5
#./configure --prefix=/usr/local/proftp
#make
#make install
#make clean
3.3.2 配置proftp
#cd /usr/local/proftp/etc/
#vi proftp.conf
配置如下:
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.It establishes a single server
# and a single anonymous login.It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.
ServerName "ProFTPD Default Installation"
ServerType standalone
DefaultServer on
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# To prevent DoS attacks, set the maximum number of child processes
# to 30.If you need to allow more than 30 concurrent connections
# at once, simply increase this value.Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30
# Set the user and group that the server normally runs at.
User nobody
Group nobody
# Normally, we want files to be overwriteable.
<Directory /*>
AllowOverwrite on
</Directory>
# A basic anonymous configuration, no upload directories.
<Anonymous ~ftp>
User ftp
Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
# Limit the maximum number of anonymous logins
MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayFirstChdir .message
# Limit WRITE everywhere in the anonymous chroot
<Limit READ>
AllowAll
</Limit>
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>
<Anonymous ~>
AnonRequirePassword on
User %U
Group ftp
RequireValidShell off
<Limit READ WRITE>
AllowAll
</Limit>
</Anonymous>
把proftp配置成系统自启动的standalone服务进程:
#cp /home/home/software/proftp-1_2_5/contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
#chmod u+x /etc/rc.d/init.d/proftpd
#vi /etc/rc.d/init.d/functions
修改:
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
修改后:
export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/proftp/sbin"
#chkconfig --level 345 proftpd on
便可把proftp配置系统自启动的standalone服务进程了。
3.3.3备份配置文件:
#mkdir /home/bak/proftp
#cp /usr/local/proftp/etc/proftp.conf /home/bak/proftp/proftp.conf.old
3.4 安装配置sshd
3.4.1 安装:
#cd /home/software/
#rpm -ivh SSHD-4_0_3-i386.rpm
3.4.2 配置sshd
采用SSH公钥和私钥方式验证
#cd /etc/sshd
#ssh-keygen
(生成root帐号SSH公钥和私钥,位于/root/.shh目录中)
Generating public/private rsa1 key pair.
Enter file in which to save the key (/root/.ssh/identity):(回车键)
Enter passphrase (empty for no passphrase):(输入私钥)
Enter same passphrase again:(重输)
#vi /etc/ssh/sshd_config
增加下列两项设置如下:
AllowHosts *.zist.edu.cn 192.168.1.*
AllowGroups root qxh
设置为系统自启动的standalone服务进程:
#cd /etc/rc.d/init.d
#chkconfig --level 345 sshd on
备份文件:
#mkdir /home/bak/sshd
#cp /etc/ssh/sshd_config /home/bak/sshd/sshd_config.old
3.5 安装J2SDK
软件包自解压安装
#cd /home/software
#chmod u+x j2sdk-1.4.0-linux.bin
#./j2sdk-1.4.0-linux.bin
#mv j2sdk-1.4.0 /usr/local/jdk
3.6 安装配置jakarta-tomcat
3.6.1 安装jakarta-tomcat-4.1.18
#cd /home/software
#tar zvfx jakarta-tomcat-4.1.18.tar.gz
#mv jakarta-tomcat-4.1.18 /usr/local/jakarta-tomcat
3.6.2 配置jakarta-tomcat-4.1.18
#cd /usr/local/jakarta-tomcat/conf
#vi server.xml
把服务监听端口由8080修改为80,把port="8080"修改为port="80",如下:
<Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
port="80" minProcessors="5" maxProcessors="100"
enableLookups="true" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
#vi tomcat-usrsers.xml
配置如下(其中把帐号tomcat变为系统管理员):
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="whahazyq" roles="tomcat,admin,manager"/>
<user username="role1" password="whahazyq" roles="role1"/>
<user username="both" password="whahazyq" roles="tomcat,role1"/>
</tomcat-users>
3.6.3 备份文件:
#mkdir /home/bak/tomcat
#cp /usr/local/jakarta-tomcat/conf/server.xml /home/bak/tomcat/server.xml.old
#cp /usr/local/jakarta-tomcat/conf/tomcat-usrsers.xml /home/bak/tomcat/tomcat-usrsers.xml.old
3.7 修改操作系统环境变量:
#vi /etc/profile
在文件结尾加入:
PATH="$PATH:/usr/local/jakarta-tomcat/bin:/usr/local/jdk/bin:/usr/local/jdk/jre/bin"
JAVA_HOME=/usr/local/jdk
export JAVA_HOME
JRE_HOME=/usr/local/jdk/jre
export JRE_HOME
TOMCAT_HOME=/usr/local/jakarta-tomcat
export TOMCAT_HOME
CLASSPATH=/usr/local/jdk/lib:/usr/local/jdk/jre/lib
export CLASSPATH
4.系统测试:
系统安装培植完成,重新启动计算机,以root登录。
4.1 测试proftp:
#ftp 127.0.0.1
4.2 测试sshd:
#ssh 127.0.0.1
4.3 测试jakarta-tomcat
服务器执行#/usr/local/jakarta-tomcat/bin/startup.sh
客户在浏览器地址栏输入:http://192.168.1.52
5.jsp和servlet程序测试:
5.1 jsp程序测试
5.1.1 建立jsp程序目录:
1)服务器启动:
#/usr/local/jakarta-tomcat/bin/startup.sh
2)使用客户端浏览器输入http://192.168.1.52/admin,在jakarta-tomcat系统登录界面然后使用“tomcat”
帐号登录。
3)在jakarta-tomcat系统管理界面,增加Context,设置下面两个选项:
Document Base /home/qxh/jsp
path: /jsp
5.1.2 上传jsp文件
1)使用ftp客户软件连接
2)建立目录:jsp
3)服务器上传测试的jsp文件到jsp目录:
5.1.3 测试jsp文件
1)重新启动jakarta-tomcat服务器:
#/usr/local/jakarta-tomcat/bin/shutdown.sh
#/usr/local/jakarta-tomcat/bin/startup.sh
2)客户端浏览器输入http://192.168.1.52/jsp/后接jsp文件名。
5.2 servlet程序测试
5.1.1 建立servlet程序目录:
1)服务器启动:
#/usr/local/jakarta-tomcat/bin/startup.sh
2)使用客户端浏览器输入http://192.168.1.52/admin,在jakarta-tomcat系统登录界面然后使用“tomcat”
帐号登录。
3)在jakarta-tomcat系统管理界面,增加Context,设置下面两个选项:
Document Base /home/qxh/servlet
path: /servlet
5.1.2 上传servlet文件
1)使用servlet客户软件连接
2)建立目录:servlet
3)服务器上传测试的servlet文件到servlet目录:
5.1.3 测试servlet文件
1)重新启动jakarta-tomcat服务器:
#/usr/local/jakarta-tomcat/bin/shutdown.sh
#/usr/local/jakarta-tomcat/bin/startup.sh
2)客户端浏览器输入http://192.168.1.52/servlet/后接servlet文件名。
眼睛都看花了,还是什么都没看懂。。。。 看不懂没关系,照着一步一步做就可以了配置成功了,这是楼住的毕业实习的手本哦
页:
[1]