Linux下jdk、tomcat(APR)及maven的安装(笔记)

jak安装 
路径:/usr/java
步骤:下载 rpm -ivh http://172.24.200.12:8080/swift/v1/RPM/jdk-8u91-linux-x64.rpm
 配置 vi /etc/profile 添加如下内容
export JAVA_HOME=/usr/java/jdk1.6.0_27
export JAVA_BIN=/usr/java/jdk1.6.0_27/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
 加载配置
source /etc/profile
查看
java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)


tomcat安装
路径:/opt/apache-tomcat-8.5.4
步骤:下载  wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.5.4/bin/apache-tomcat-8.5.4.tar.gz
 解压  tar -zxf apache-tomcat-8.5.4.tar.gz
 启动  cd apache-tomcat-8.5.4   sh bin/startup.sh
 查看日志 vi logs/catalina.out
 测试  curl -XGET http://127.0.0.1:8080/
 
检查GCC版本
ContOS
yum install gcc
gcc -v


unbutu
apt-get install gcc


ARP安装
下载(tmp 临时存放tar文件)
wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz
wget http://mirror.bit.edu.cn/apache//apr/apr-iconv-1.2.1.tar.gz
wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz

安装
tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make 
make install

----------==================-------------------
tar -zxvf apr-iconv-1.2.1.tar.gz
cd apr-iconv-1.2.1
    ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
    make
    make install


  ----------==================-------------------
tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr --with-apr-iconv=/usr/local/apr-iconv/bin/apriconv 
make
    make install


安装tomcat-native (压缩包在tomcat的lib目录下)
544  cd /opt/
545  cd apache-tomcat-8.5.4/
546  cd lib/
547  cd ..
548  cd bin/
549  tar -zxvf tomcat-native.tar.gz 
550  cd tomcat-native-1.2.8-src/
551  pwd
552  cd native/
553  ll
554  ./configure --with-apr=/usr/local/apr --with-java-home=/usr/java/jdk1.8.0_91
555  make
556  make install


配置 vi /etc/profile 添加如下内容
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
export CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib"
重新加载配置 source /etc/profile

修改tomcat conf/server.xml 配置
tomcat版本不同,优先级不同。若果安装apr后,默认启动apr
protocol="HTTP/1.1" ---->protocol="org.apache.coyote.http11.Http11AprProtocol"
<Connector port="8080"
               connectionTimeout="20000"
               protocol="org.apache.coyote.http11.Http11AprProtocol"
               redirectPort="8443" />

验证APR
启动tomcat
查看日志
27-Jul-2016 09:38:29.872 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-apr-8080"]
27-Jul-2016 09:38:29.873 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]


tomcat配置  ~/bin/setenv.sh  有则修改,无则新建
JAVA_OPTS="
-Djava.awt.headless=true  支持图片相关awt
-Djava.security.egd=file:/dev/./urandom  随机数
-server -Xms2048m -Xmx2048m 内存
-XX:ParallelGCThreads=8  物理内核数
-XX:SurvivorRatio=8 
-XX:MaxTenuringThreshold=0 
-XX:+UseConcMarkSweepGC"


验证
[root@cf-1 bin]# ps -elf|grep tomcat
0 S root     25350     1 24  80   0 - 1052155 futex_ 09:55 pts/1  00:00:04 /usr/java/jdk1.8.0_91/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -server -Xms2048m -Xmx2048m -XX:ParallelGCThreads=8 -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=0 -XX:+UseConcMarkSweepGC -Djdk.tls.ephemeralDHKeySize=2048 -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start


maven
下载
wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
配置
vi /etc/profile 添加内容如下
#maven
export M2_HOME=/opt/maven
export PATH=$M2_HOME/bin:$PATH
验证
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/maven
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_91/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.29.2.el6.x86_64", arch: "amd64", family: "unix"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值