首页 > 代码库 > Linux 安装 Tomcat,maven ,Ant
Linux 安装 Tomcat,maven ,Ant
下载:
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
Linux 安装 Tomcat,maven ,Ant