Linux下配置JavaWeb環境(持續更新其餘軟件)

在JavaWeb開發中,JDK,Tomcat,Maven,Mysql等都是必不可少的。接下來我對在Linux上安裝JDK,Tomcat,Maven,Mysql等進行分享,使用環境:html

一、操做系統:CentOS 6.5 x64java

二、JDK:jdk-8u77-linux-x64linux

三、Tomcat:apache-tomcat-8.0.33sql

四、Maven:apache-maven-3.3.9apache

 

安裝:bootstrap

一、下載tomcat

    Tomcat:下載地址oracle

    JDK:下載地址maven

    Maven:下載地址ui

二、解壓

    1.tar zxvf jdk-8u77-linux-x64.tar.gz

    2.tar zxvf apache-tomcat-8.0.33.tar.gz

    3.tar zxvf apache-maven-3.3.9.tar.gz

三、安裝

    1.mkdir /usr/local/java/

    2.mv jdk-8u77-linux-x64/ /usr/local/java

    3.mv apache-tomcat-8.0.33 /usr/local

    4.mv apache-maven-3.3.9 /usr/local

四、配置環境變量

    編輯/etc/profile,並在最下方添加一下內容

    1. #java setting

    2. JAVA_HOME=/usr/local/java/jdk-8u77-linux-x64

    3. export JAVA_HOME

    4. PATH=$JAVA_HOME/bin:$PATH

    5. export PATH

    6. CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

    7. export PATH

    8. #tomcat setting

    9. CATALINA_HOME=/usr/local/apache-tomcat-8.0.33

    10. export CATALINA_HOME

    11. #Maven setting

    12. MAVEN_HOME=/usr/local/apache-maven-3.3.9

    13. export PATH=$PATH:$MAVEN_HOME/bin

    ok!

    運行 source /etc/profile 使環境變量生效

 

五、驗證是否安裝成功

    1.驗證JDK

        java -version

        將會看到以下信息:

        java version "1.8.0_77"
        Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
        Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

    2.驗證Tomcat

        /usr/local/apache-tomcat-8.0.33/bin/startup.sh

        將會看到以下啓動信息:

        Using CATALINA_BASE:   /usr/local/apache-tomcat-8.0.33
        Using CATALINA_HOME:   /usr/local/apache-tomcat-8.0.33
        Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.33/temp
        Using JRE_HOME:        /usr/local/java/jdk1.8.0_77
        Using CLASSPATH:       /usr/local/apache-tomcat-8.0.33/bin/bootstrap.jar:/usr/local/apache-tomcat-            8.0.33/bin/tomcat-juli.jar
        Tomcat started.

        如今就能夠經過IP:8080訪問Tomcat。

        注意:若是不能訪問請注意你的防火牆端口是否添加了8080端口。

        1.#查看防火牆端口

        2.service iptables

        3.#查看Tomcat是否在進程中

        4.ps -ef|grep tomcat

    3.驗證Maven

        mvn -version

        將會看到以下信息:

        Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
        Maven home: /usr/local/apache-maven-3.3.9
        Java version: 1.8.0_77, vendor: Oracle Corporation
        Java home: /usr/local/java/jdk1.8.0_77/jre
        Default locale: en_US, platform encoding: UTF-8
        OS name: "linux", version: "2.6.32-431.23.3.el6.x86_64", arch: "amd64", family: "unix"
        注意:若是提示mvn:permission denied

        緣由是mvn這個文件沒有可執行權限,須要加上可執行權限

            1.先cd到該文件的目錄下

            2.執行命令chmod a+x ./mvn

        而後再從新執行mvn -version看看  

相關文章
相關標籤/搜索