下载jdk,
得到文件jdk-6u31-linux-i586-rpm.bin
[root@hxl ftp]# sh jdk-6u31-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-6u31-linux-i586.rpm
inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
Installing JavaDB
Preparing... ########################################### [100%]
1:sun-javadb-common ########################################### [ 17%]
2:sun-javadb-core ########################################### [ 33%]
3:sun-javadb-client ########################################### [ 50%]
4:sun-javadb-demo ########################################### [ 67%]
5:sun-javadb-docs ########################################### [ 83%]
6:sun-javadb-javadoc ########################################### [100%]
Java(TM) SE Development Kit 6 successfully installed.
Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation
Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.
For more information on what data Registration collects and
how it is managed and used, see:
Press Enter to continue.....
Done.
安装完后还需要配置环境变量
在命令行输入: vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.6.0_31
export JAVA_BIN=/usr/java/jdk1.6.0_31/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
若想非root用户直接敲入java命令运行,需要在该用户的profile文件中添加如上的内容.
最后为了平时方便使用在/usr/bin/创建两个快捷方式
cd /usr/bin
ln -s -f /usr/java/jdk1.6.0_31/jre/bin/ java
ln -s -f /usr/java/jdk1.6.0_31/bin/ javac
退出重新登录后,输入 java –version 测试一下
[root@hxl ~]# java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)
安装Tomcat6
1.下载Tomcat6
下载地址
#tar xvzf apache-tomcat-6.0.33.tar.gz
生成文件夹apache-tomcat-6.0.33,将该目录迁移到/opt下
[root@hxl ftp]# mv apache-tomcat-6.0.33 /opt
启动tomcat
[root@hxl bin]# ./startup.sh
Using CATALINA_BASE: /opt/apache-tomcat-6.0.33
Using CATALINA_HOME: /opt/apache-tomcat-6.0.33
Using CATALINA_TMPDIR: /opt/apache-tomcat-6.0.33/temp
Using JRE_HOME: /usr/java/jdk1.6.0_31
Using CLASSPATH: /opt/apache-tomcat-6.0.33/bin/bootstrap.jar
安装后JDK和Tomcat后,在本地浏览器中输入IP和端口号(默认端口8080)测试,就可以看到Tomcat完成安装的界面了.
注:如果想修改Tomcat的端口(例如改8080端口为80端口),就用vi打开Tomcat目录下的/conf/server.xml
修改
为
修改完这个配置文件后,重启服务器即可.
说明:可以使用lsof查看8080端口是否启用.
[root@hxl bin]# lsof -i:8080
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
java 10169 root 34u IPv6 33706 TCP *:webcache (LISTEN)
--The End--