有你才完美WoW 发表于 2015-8-9 09:51:08

为RHEL5安装JDK和配置tomcat

http://www.linuxdiyf.com/viewarticle.php?id=120575

  为RHEL5安装JDK和配置tomcat
ericLi发布于 2008-12-19 | 515次阅读   字号: 大 中 小(网友评论 2 条) 我要评论 一、JDK配置:
1 . 下载jdk5.0 for linux 到sun的主页 http://java.sun.com/j2se/1.5.0/download.jsp
下载jdk安装文件jdk-1_5_0_16-linux-i586.bin
2 . 解压&安装jdk
    在shell终端下进入jdk-1_5_0_16-linux-i586.bin文件所在目录,
执行命令 ./jdk-1_5_0_16-linux-i586.bin
这时会出现一段协议,连继敲回车,当询问是否同意的时候,输入yes,回车。
之后会在当前目录下生成一个jdk-1.5.0_16目录,
可以将它复制到 任何一个目录下。
3 . 配置环境变量
两种配置方法:
(1)修改/etc/profile文件 -- 全部用户有效
在profile 文件的尾部面加入
JAVA_HOME=/usr/java/jdk1.5.0_16 -- jdk 的安装路径
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
export CATALINA_HOME
保存 退出
在shell输入 source /etc/profile
如果执行上面这个命令时报错,请仔细检查你在/etc/profile里新增的文本
是不是有错。
检测完没有错误 重新登录以后生效
(2) 修改.bashrc文件 --指定用户目录下的 .bashrc 文件
·在.bashrc文件末尾加入:
set JAVA_HOME=/usr/java/jdk1.5.0_16 --jdk 的安装路径
      export JAVA_HOME
      set PATH=$JAVA_HOME/bin:$PATH
export PATH
set CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH
4.测试安装 jdk 是否成功
在shell输入 java -version
看输出结果与安装版本是否一致
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Server VM (build 1.5.0_16-b02, mixed mode)
如果不一致可能是因为本机已经装过java 虚拟机 可以将其删除

二 、tomcat6安装 :
1 . 下载 apache-tomcat-6.0.18.tar.gz 解压后将文件夹放在任何目录下
修改D:\apache-tomcat-6.0.16\conf\tomcat-users.xml 文件
在 中加入

--根据自己情况
设置登陆名字和密码
修改端口:apache-tomcat-6.0.16\conf\server.xml 文件中
Connector port="8080" protocol="HTTP/1.1" enableLookups="false"
connectionTimeout="20000"
redirectPort="8443" />
将上面的8080端口改成与本机不冲突的端口
2 . 配置环境变量
修改/etc/profile文件
在配置jdk后面加入
CATALINA_HOME=/usr/tomcat6 --对应自己的安装路径
export CATALINA_HOME
保存 退出
在shell输入 source /etc/profile
如果执行上面这个命令时报错,请仔细检查你在/etc/profile里新增的文本是不
是有错。
检测完没有错误 重新登录
到/usr/tomcat6/bin 目录下
首次运行 在shell运行 ./startup.sh
正常启动:
# ./startup.sh
Using CATALINA_BASE: /usr/tomcat6
Using CATALINA_HOME: /usr/tomcat6
Using CATALINA_TMPDIR: /usr/tomcat6/temp
Using JRE_HOME: /usr/java/jdk1.5.0_16
打开浏览器 键入 http://localhost:8080 看看是否出现tomcat登录界面
如果普通用户不能正常启动tomcat ,可以将tomcat的所有者给要使用的普通用户
3.开机自启动tomcat6
修改文件/etc/rc.d/rc.local
倒数第二行中增加如下代码:
export JAVA_HOME=/usr/java/jdk1.5.0_16
export JDK_HOME=/usr/java/jdk1.5.0_16
/usr/tomcat6/bin/startup.sh
重启生效
【已有2位网友发表了看法】 【打印】 【关闭】
相关评论作者: ericLi 发布日期: 2008-12-191, 主板信息
.查看主板的序列号
--------------------------------------------------
#使用命令
dmidecode | grep -i 'serial number'
#查看板卡信息
cat /proc/pci
--------------------------------------------------
2, cpu信息
--------------------------------------------------
#通过/proc文件系统
1) cat /proc/cpuinfo
#通过查看开机信息
2) dmesg | grep -i 'cpu'
#
3)dmidecode -t processor
--------------------------------------------------
3, 硬盘信息
--------------------------------------------------
#查看分区情况
fdisk -l
#查看大小情况
df -h
#查看使用情况
du -h
#
hdparm -I /dev/sda
#
dmesg | grep sda
--------------------------------------------------
4, 内存信息
--------------------------------------------------
1) cat /proc/meminfo
2) dmesg | grep mem
3) free -m
4) vmstat
5) dmidecode | grep -i mem
--------------------------------------------------
5, 网卡信息
--------------------------------------------------
1) dmesg | grep -i 'eth'
2) cat /etc/sysconfig/hwconf | grep -i eth
3) lspci | grep -i 'eth'
--------------------------------------------------
6, 鼠标键盘和USB信息
查看键盘和鼠标:cat /proc/bus/input/devices
查看USB设备:cat /proc/bus/usb/devices
查看各设备的中断请求(IRQ):cat /proc/interrupts
7, 显卡信息
--------------------------------------------------
1)lspci |grep -i 'VGA'
2)dmesg | grep -i 'VGA'
--------------------------------------------------
8, 声卡信息
--------------------------------------------------
1)lspci |grep -i 'VGA'
2)dmesg | grep -i 'VGA'
--------------------------------------------------
7, 其他命令
.用硬件检测程序kuduz探测新硬件:service kudzu start ( or restart)
.dmesg (查看所有启动时检测到的硬件信息)
.lspci (显示外设信息, 如usb,网卡等信息)
.cat /etc/sysconfig/hwconf
.mpstat
8, 需要手动安装的工具
lshw,hwinfo,hal-device-manager
9, Solaris如何检测硬件参数
俺从别处发现了些有意思的东西:
Solaris的硬件相关命令
发表:2004-3-8 11:20:36 出处:你的博客网(yourblog.org)
--------------------------------------------------------------------------------
1).查看当前处理器的类型和速度(主频)
# psrinfo –v
Status of processor 1 as of: 11/24/01 10:34:41
Processor has been on-line since 11/24/01 10:18:20.
The sparcv9 processor operates at 432 MHz,
and has a sparcv9 floating point processor.
Status of processor 3 as of: 11/24/01 10:34:41
Processor has been on-line since 11/24/01 10:18:22.
The sparcv9 processor operates at 432 MHz,
and has a sparcv9 floating point processor.
2).打印当前的OBP版本号
# prtconf –V
OBP 3.20.0 2000/10/24 10:47
# /usr/platform/sun4u/sbin/prtdiag –v | grep OBP
OBP 3.20.0 2000/10/24 10:47 POST 6.1.0 2000/10/24 10:49
ok. .version
Release 3.20 Version 0 created 2000/10/24 10:47
OBP 3.20.0 2000/10/24 10:47
POST 6.1.0 2000/10/24 10:49
OBDIAG 4.5.1 2000/10/24 10:48
3).查看硬盘物理信息(vendor, RPM, Capacity)
# iostat –E
sd0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATE Product: ST34371W SUN4.2G Revision: 7462 Serial No:
JDX394220KW EBC
Size: 4.29GB ;
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
sd2 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSU Product: MAJ3364M SUN36G Revision: 0804 Serial No: 01M18144
Size: 36.42GB ;
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
sd3 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSU Product: MAJ3364M SUN36G Revision: 0804 Serial No: 01M16199
Size: 36.42GB ;
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
sd21 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: TOSHIBA Product: DVD-ROM SD-M1401 Revision: 1007 Serial No: 06/22/00
Size: 18446744073.71GB ;
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
4).查看磁盘的几何参数和分区信息
# prtvtoc /dev/rdsk/c0t0d0s0
* /dev/rdsk/c0t0d0s0 partition map
*
* Dimensions:
* 512 bytes/sector
* 135 sectors/track
* 16 tracks/cylinder
* 2160 sectors/cylinder
* 3882 cylinders
* 3880 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 8277120 103680 8380799
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory
0 2 00 0 2049840 2049839 /
1 3 01 2049840 615600 2665439
2 5 00 0 8380800 8380799
5 0 00 2665440 2458080 5123519 /opt
6 4 00 5123520 3073680 8197199 /usr
7 8 00 8197200 79920 8277119 /export/home
5).显示已经使用和未使用的i-node数目
# df –F ufs –o i
Filesystem iused ifree %iused Mounted on
/dev/dsk/c0t0d0s0 7859 479821 2% /
/dev/dsk/c0t0d0s6 37763 339517 10% /usr
/dev/dsk/c0t0d0s5 722 301102 0% /opt
/dev/dsk/c0t0d0s7 4 24380 0% /export/home
6).显示cpu使用率最高的进程
# ps –eo pid,pcpu,args | sort +1n
该命令输出当前系统进程的pid, CPU占用率及命令描述,并以pcpu来排序
7).显示内存占用率最高的进程
# ps –eo pid,vsz,args | sort +1n
该命令输出当前系统进程的pid,内存占用率及命令描述,并以vsz来排序
8).查看及启动系统的32位或64位内核模式
64位模式
# isalist –v
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7
sparc
# isainfo –v
64-bit sparcv9 applications
32-bit sparc applications
# isainfo –b
64
启动64位内核模式
ok. boot kernel/sparcv9/unix
32位模式
# isalist –v
sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
# isainfo –v
32-bit sparc applications
# isainfo –b
32
启动32位模式
ok. boot kernel/unix
9).查看当前的OpenWindows版本
# showrev –w
OpenWindows version:
X11 Version 6.4.1 5 November 2001
10).查看当前CDE的版本
# /usr/ccs/bin/what /usr/dt/bin/dtmail
/usr/dt/bin/dtmail:
CDE Version 1.4.6_06
CDEVersion1.4.6_06
11).测定当前的显示器刷新频率
/usr/sbin/ffbconfig –rev \?
Valid values for -res option are:
1024x768x60
1024x768x70
1024x768x75
1024x768x77
1024x800x84
1152x900x66
1152x900x76
1280x800x76
1280x1024x60
1280x1024x67
1280x1024x76
1280x1024x85
960x680x112s
960x680x108s
640x480x60
640x480x60i
768x575x50i
1440x900x76
1600x1000x66
1600x1000x76
1600x1280x76
1920x1080x72
1920x1080x76
1920x1200x70
1920x1200x75
svga
1152
1280
stereo
vga
ntsc
pal
none
Notes:
monitor does not support this resolution.
this version of FFB (FFB1) does not support this resolution
12).查看系统配置
# /usr/platform/sun4u/sbin/prtdiag –v
System Configuration: Sun Microsystems sun4u Sun Enterprise 450 (2 X
UltraSPAR
C-II 432MHz)
System clock frequency: 86 MHz
Memory size: 1024 Megabytes
========================= CPUs =========================
Run Ecache CPU CPU
Brd CPU Module MHz MB Impl. Mask
--More--
--- --- ------- ----- ------ ------ ----
SYS 1 1 432 4.0 US-II 10.0
SYS 3 3 432 4.0 US-II 10.0
========================= Memory =========================
Interlv. Socket Size
Bank Group Name (MB) Status
---- ----- ------ ---- ------
0 none 1901 256 OK
0 none 1902 256 OK
0 none 1903 256 OK
0 none 1904 256 OK
0 none 1701 256 OK
0 none 1702 256 OK
========================= IO Cards =========================
No failures found in System
===========================
========================= Environmental Status =========================
System Temperatures (Celsius):
------------------------------
AMBIENT 20
CPU 1 40
CPU 3 40
=================================
Front Status Panel:
-------------------
Keyswitch position is in On mode.
System LED Status: POWER GENERAL ERROR ACTIVITY
[ ON] [ ON]
DISK ERROR THERMAL ERROR POWER SUPPLY ERROR

Disk LED Status: OK = GREEN ERROR = YELLOW
DISK 2: DISK 3:
DISK 0: DISK 1:
=================================
Fans:
-----
Fan Bank Speed Status
-------- ----- ------
CPU 49 OK
PWR 31 OK
Power Supplies:
---------------
Supply Rating Temp Status
------ ------ ---- ------
0 550 W 33 OK
1 550 W 33 OK
========================= HW Revisions =========================
ASIC Revisions:
---------------
STP2223BGA: Rev 4
STP2223BGA: Rev 4
STP2223BGA: Rev 4
STP2003QFP: Rev 1
STP2205BGA: Rev 1
System PROM revisions:
----------------------
OBP 3.20.0 2000/10/24 10:47 POST 6.1.0 2000/10/24 10:49
# sysdef
*
* Hostid
*
80fee99b
*
* sun4u Configuration
*
*
* Devices
*
packages (driver not attached)
terminal-emulator (driver not attached)
deblocker (driver not attached)
obp-tftp (driver not attached)
disk-label (driver not attached)
SUNW,builtin-drivers (driver not attached)
sun-keyboard (driver not attached)
ufs-file-system (driver not attached)
chosen (driver not attached)
openprom (driver not attached)
client-services (driver not attached)
options, instance #0
aliases (driver not attached)
memory (driver not attached)
virtual-memory (driver not attached)
associations (driver not attached)
slot2disk (driver not attached)
slot2led (driver not attached)
slot2dev (driver not attached)
pci, instance #0
ebus, instance #0
auxio (driver not attached)
……
# prtconf –D
System Configuration: Sun Microsystems sun4u
Memory size: 1024 Megabytes
System Peripherals (Software Nodes):
SUNW,Ultra-4
packages
terminal-emulator
deblocker
obp-tftp
disk-label
SUNW,builtin-drivers
sun-keyboard
ufs-file-system
chosen
openprom
client-services
options, instance #0 (driver name: options)
aliases
memory
virtual-memory
associations
slot2disk
slot2led
slot2dev
pci, instance #0 (driver name: pcipsy)
ebus, instance #0 (driver name: ebus)
auxio
power (driver name: power)
SUNW,pll
sc
se, instance #0 (driver name: se)
su, instance #0 (driver name: su)
…..
13).查看当前系统中已经应用的补丁
# showrev –p
Patch: 109618-01 Obsoletes: Requires: Incompatibles: Packages: SUNWeuxwe,
SUN
Weuezt, SUNWeudlg, SUNWeudda
Patch: 109889-01 Obsoletes: 109353-04 Requires: Incompatibles: Packages:
SUNWk
vmx, SUNWkvm, SUNWmdb, SUNWhea, SUNWpstl, SUNWpstlx
Patch: 110369-05 Obsoletes: 110709-02 Requires: Incompatibles: Packages:
SUNWk
vmx, SUNWcarx, SUNWcsr
Patch: 110370-03 Obsoletes: 111643-01 Requires: Incompatibles: Packages:
SUNWk
vmx, SUNWkvm, SUNWmdb, SUNWhea, SUNWpstl, SUNWpstlx
Patch: 110373-04 Obsoletes: 111508-01 Requires: Incompatibles: Packages:
SUNWk
vmx, SUNWcarx, SUNWcsr
Patch: 110374-08 Obsoletes: 110136-02, 110516-02 Requires: Incompatibles:
Pack
ages: SUNWkvmx, SUNWcarx, SUNWcar, SUNWcsr, SUNWmdbx
…..
14).显示当前的运行级别
# who –rH
NAME LINE TIME IDLE PID COMMENTS
. run-level 3 Nov 24 10:18 3 0 S
15).查找一个文件所从属的包
# pkgchk –lp /usr/lib/sendmail
Pathname: /usr/lib/sendmail
Type: regular file
Expected mode: 4555
Expected owner: root
Expected group: bin
Expected file size (bytes): 761368
Expected sum(1) of contents: 41707
Expected last modification: Sep 24 03:13:13 2001
Referenced by the following packages:
SUNWsndmu
Current status: installed
16).查看当前的bind版本信息
# nslookup –class=chaos –q=txt version.bind
Server: ns.lnpta.net.cn
Address: 202.96.64.68作者: ericLi 发布日期: 2008-12-19需要进行编译。这类软件包有两种安装方法,
方法一:
1.执行rpm -i your-package.src.rpm
2. cd /usr/src/redhat/SPECS
3. rpmbuild -bp your-package.specs 一个和你的软件包同名的specs文件
4. cd /usr/src/redhat/BUILD/your-package/ 一个和你的软件包同名的目录
5. ./configure 这一步和编译普通的源码软件相同,能加上参数
6. make
7. make install
方法二:
1.执行rpm -i you-package.src.rpm
2. cd /usr/src/redhat/SPECS
前两步和方法一相同
3. rpmbuild -bb your-package.specs 一个和你的软件包同名的specs文件
这时,在/usr/src/redhat/RPM/i386/ (根据具体包的不同,也可能是i686,noarch等等)
在这个目录下,有一个新的rpm包,这个是编译好的二进制文件。
执行rpm -i new-package.rpm即可安装完成。
页: [1]
查看完整版本: 为RHEL5安装JDK和配置tomcat