<!-- lang: shell --> 下載: http://ant.apache.org/bindownload.cgi wget http://apache.tradebit.com/pub//ant/binaries/apache-ant-1.9.4-bin.zip 解壓縮 unzip apache-ant-1.9.4-bin.zip 安裝到 /opt/ 目錄下面 mv apache-ant-1.9.4/ /opt/ant 建立軟連接 ln -s /opt/ant/bin/ant /usr/bin/ant 設置環境變量 vi /etc/profile.d/ant.sh #!/bin/bash ANT_HOME=/opt/ant PATH=$ANT_HOME/bin:$PATH export PATH ANT_HOME export CLASSPATH=. 使文件可執行 chmod +x /etc/profile.d/ant.sh 首次初始化環境 source /etc/profile.d/ant.sh 校驗: ant -version 校驗環境變量: echo $ANT_HOME Maven 安裝: http://maven.apache.org/download.cgi wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.2.3/binaries/apache-maven-3.2.3-bin.zip 解壓縮: unzip apache-maven-3.2.3-bin.zip 安裝到 /opt/ 目錄下面: mv apache-maven-3.2.3/ /opt/maven 建立軟連接: ln -s /opt/maven/bin/mvn /usr/bin/mvn 設計Maven 環境變量: vim /etc/profile.d/mavem.sh ##!/bin/bash MAVEN_HOME=/opt/maven PATH=$MAVEN_HOME/bin:$PATH export PATH MAVEN_HOME export classPATH=. 使文件可執行 chmod +x /etc/profile.d/maven.sh 首次初始化環境變量 source /etc/profile.d/maven.sh mvn -version echo $MAVEN_HOME [root@lambda-laptop pics]# mvn -version Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T04:58:10+08:00) Maven home: /opt/maven Java version: 1.8.0_20, vendor: Oracle Corporation Java home: /usr/java/jdk1.8.0_20/jre Default locale: en_GB, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-123.6.3.el7.x86_64", arch: "amd64", family: "unix" Tomcat 安裝 http://tomcat.apache.org/download-70.cgi wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.zip unzip apache-tomcat-7.0.53.zip mv apache-tomcat-7.0.53/ /opt/tomcat source /etc/profile.d/tomcat.sh chmod +x $CATALINA_HOME/bin/startup.sh chmod +x $CATALINA_HOME/bin/shutdown.sh chmod +x $CATALINA_HOME/bin/catalina.sh vi /etc/profile.d/tomcat.sh #!/bin/bash CATALINA_HOME=/opt/tomcat PATH=$CATALINA_HOME/bin:$PATH export PATH CATALINA_HOME export CLASSPATH=. chmod +x /etc/profile.d/tomcat.sh cd $CATALINA_HOME/bin ./startup.sh 編輯: /etc/sysconfig/iptables 添加 -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT ./shutdown.sh vi /etc/init.d/tomcat #!/bin/sh # chkconfig: 2345 80 20 # Description: Tomcat Start/Shutdown script export JAVA_HOME=/usr/java/jdk1.8.0_05 case $1 in start) cd /opt/tomcat/bin/ ./startup.sh ;; stop) cd /opt/tomcat/bin/ ./shutdown.sh ;; restart) cd /opt/tomcat/bin/ ./shutdown.sh cd /opt/tomcat/bin/ ./startup.sh ;; esac exit 0 chmod a+x /etc/init.d/tomcat chkconfig --add tomcat