一、安装JDK:
1.创建JDK的安装目录:
sudo mkdir /usr/jdk
2.将jdk-7u25-linux-x64.tar.gz拷贝至/usr/jdk目录下
sudo cp jdk-7u25-linux-x64.tar.gz /usr/jdk
3.解压tar.gz
sudo tar -zxvf jdk-7u25-linux-x64.tar.gz
jdk官网地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
二、安装tomcat:
1.创建tomcat的安装目录:
sudo mkdir /usr/tomcat
2.将apache-tomcat-7.0.29.tar.gz拷贝至/usr/tomcat目录下
sudo cp apache-tomcat-7.0.29.tar.gz /usr/tomcat
3.解压tar.gz
sudo tar -zxvf apache-tomcat-7.0.29.tar.gz
tomcat官网地址:http://tomcat.apache.org/
三、安装maven:
1.创建maven的安装目录:
sudo mkdir /usr/maven
2.将apache-maven-3.3.9-bin.tar.gz拷贝至/usr/maven目录下
sudo cp apache-maven-3.3.9-bin.tar.gz /usr/maven
3.解压tar.gz
sudo tar -zxvf apache-maven-3.3.9-bin.tar.gz
maven官网地址:http://maven.apache.org/
四、使配置环境生效:
1.修改/etc/profile文件
sudo nano /etc/profile
在最后添加如下信息:
#set environment variable
JAVA_HOME=/javaSoft/jdk/jdk1.7.0_25
CLASSPATH=.:$JAVA_HOME/lib.tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
export TOMCAT_HOME=/javaSoft/tomcat/apache-tomcat-7.0.29
export CATALINA_HOME=/javaSoft/tomcat/apache-tomcat-7.0.29
export MAVEN_HOME=/javaSoft/maven/apache-maven-3.3.9
export PATH=${MAVEN_HOME}/bin:${PATH}
2.执行source /etc/profile 让配置文件生效
source /etc/profile
3.验证jdk、maven是否安装正确
验证jdk: java -version
验证maven: mvn -v