jdk安装
1.将jdk-8u45-linux-x64.tar.gz拷贝到/usr/lib/jdk/目录下面,这里如果没有jdk文件夹,则创建该文件夹,命令:
创建文件夹jdk
mkdir -p /usr/lib/jdk/
把下载的文件拷贝到新创建的目录下面
cd /usr/lib/jdk/
tar -zxvg jdk-8u45-linux-x64.tar.gz //解压缩文件
2.设置环境变量,编辑/etc/profile文件
vim /etc/profile
在文件的最后面增加:
export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_45
export JRE_HOME=/usr/lib/jdk/jdk1.8.0_45/jre
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
3.将系统默认的jdk修改过来
source /etc/profile
4.检测,输入java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
安装tomcat
上传tomcat包文件并解压
[[email protected] ~]# unzip apache-tomcat-6.0.30.zip
移到/usr/local/目录下
[[email protected] ~]# mv apache-tomcat-6.0.30/ /usr/local/
为其创建软链接
[[email protected] local]# ln -s /usr/local/apache-tomcat-6.0.30/ /usr/local/tomcat
修改catalina.sh脚本
[[email protected] bin]#vim /usr/local/tomcat/bin/catalina.sh
添加以下内容:
CATALINA_HOME=/usr/local/apache-tomcat-6.0.30/
给/usr/local/tomcat/bin/目录下所有sh文件执行权限
[[email protected] bin]#chmod +x *.sh
启动tomcat服务器
[[email protected] tomcat]# /usr/local/tomcat/bin/catalina.sh start
Using CATALINA_BASE: /usr/local/apache-tomcat-6.0.30/
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.30/
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.30//temp
Using JRE_HOME: /usr/local/jdk1.6.0_05
Using CLASSPATH: /usr/local/apache-tomcat-6.0.30//bin/bootstrap.jar
在浏览器中输入
http://localhost:8080/(如果不是本机,则输入对应的ip地址)
测试出现tomcat页面则测试成功