Tomcat搭建jpress網站

來源:互聯網
上載者:User

標籤:設定   x86   uname   src   簡介   編譯   jstack   ble   其他   

Tomcat簡介

Tomcat是Apache軟體基金會(Apache Software Foundation)的Jakarta 項目中的一個核心項目,由Apache、Sun和其他一些公司及個人共同開發而成。Tomcat伺服器是一個免費的開放原始碼的Web應用伺服器,屬於輕量級應用伺服器,在中小型系統和並發訪問使用者不是很多的場合下被普遍使用,是開發和調試JSP程式的首選。Tomcat和Nginx、Apache(httpd)、lighttpd等Web伺服器一樣,具有處理HTML頁面的功能,另外它還是一個Servlet和JSP容器,獨立的Servlet容器是Tomcat的預設模式。不過,Tomcat處理靜態HTML的能力不如Nginx/Apache伺服器。目前Tomcat最新版本為9.0。Java容器還有resin、weblogic等。

JDK介紹

JDK是 Java 語言的軟體開發套件,主要用於行動裝置、嵌入式裝置上的java應用程式。JDK是整個java開發的核心,它包含了JAVA的運行環境(JVM+Java系統類別庫)和JAVA工具。
DK包含了一批用於Java開發的組件,其中包括:
javac:編譯器,將尾碼名為.java的原始碼編譯成尾碼名為“.class”的位元組碼
java:運行工具,運行.class的位元組碼
jar:打包工具,將相關的類檔案打包成一個檔案
javadoc:文檔產生器,從源碼注釋中提取文檔,注釋需匹配規範
jdb debugger:調試工具
jps:顯示當前java程式啟動並執行進程狀態
javap:反編譯器
appletviewer:運行和調試applet程式的工具,不需要使用瀏覽器
javah:從Java類產生C標頭檔和C源檔案。這些檔案提供了串連膠合,使Java和C代碼可進行互動。
javaws:運行JNLP程式
extcheck:一個檢測jar包衝突的工具
apt:注釋處理工具
jhat:java堆分析工具
jstack:棧跟蹤程式
jstat:JVM檢測統計工具
jstatd:jstat守護進程
jinfo:擷取正在運行或崩潰的java程式配置資訊
jmap:擷取java進程記憶體映射資訊
idlj:IDL-to-Java編譯器。將IDL語言轉化為java檔案
policytool:一個GUI的策略檔案建立和管理工具
jrunscript:命令列指令碼運行

準備環境

[[email protected] ~]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
[[email protected] ~]# uname -r
3.10.0-693.el7.x86_64
[[email protected] ~]# getenforce
Disabled
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# cd /opt/
[[email protected] opt]# wget -c http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz
[[email protected] opt]# tar xf jdk-10.0.2_linux-x64_bin.tar.gz -C /usr/local/
[[email protected] opt]# ln -s /usr/local/jdk-10.0.2/ /usr/local/jdk
[[email protected] opt]# java -version
java version “1.8.0_60”
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

下載安裝Tomcat

[[email protected] opt]# wget -c https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.50/bin/apache-tomcat-8.0.50.tar.gz
[[email protected] opt]# tar xf apache-tomcat-8.0.50.tar.gz -C /usr/local/
[[email protected] opt]# ln -s /usr/local/apache-tomcat-8.0.50/ /usr/local/tomcat
[[email protected] opt]# /usr/local/tomcat/bin/version.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS: –add-opens=java.base/java.lang=ALL-UNNAMED –add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Server version: Apache Tomcat/8.0.50
Server built: Feb 7 2018 20:06:05 UTC
Server number: 8.0.50.0
OS Name: Linux
OS Version: 3.10.0-693.el7.x86_64
Architecture: amd64
JVM Version: 10.0.2+13
JVM Vendor: “Oracle Corporation”

配置相關環境變數資訊

[[email protected] opt]# cat >>/etc/profile<<‘EOF‘
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
export TOMCAT_HOME=/usr/local/tomcat
EOF
[[email protected] opt]# source /etc/profile

設定jdk程式目錄許可權資訊

[[email protected] opt]# chown -R root.root /usr/local

檢查所有環境變數資訊是否配置成功

[[email protected] opt]# env|egrep -i "JAVA_HOME|PATH|CLASSPATH|TOMCAT_HOME"
TOMCAT_HOME=/usr/local/tomcat
PATH=/usr/local/jdk/bin:/usr/local/jdk/jre/bin:/application/jdk/bin:/application/jdk/jre/bin:/application/jdk/bin:/application/jdk/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
JAVA_HOME=/usr/local/jdk
CLASSPATH=.:/usr/local/jdk/lib:/usr/local/jdk/jre/lib:/usr/local/jdk/lib/tools.jar

啟動tomcat服務程式

[[email protected] opt]# /usr/local/tomcat/bin/startup.sh
[[email protected] opt]# netstat -lntup|grep java
tcp6 0 0 :::8080 ::: LISTEN 1781/java
tcp6 0 0 127.0.0.1:8005 :::
LISTEN 1781/java
tcp6 0 0 :::8009 :::* LISTEN 1781/java

網頁測試進行訪問

http://10.0.0.202:8080/

安裝資料庫程式並進行配置

[[email protected] opt]# yum -y install mariadb-server
[[email protected] opt]# systemctl start mariadb.service
[[email protected] opt]# systemctl enable mariadb.service
[[email protected] opt]# mysql
MariaDB [(none)]> create database jpress DEFAULT CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on jpress.* to [email protected]’localhost’ identified by ‘123456’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye

將開原始碼程式包上傳到tomcat網站目錄下

[[email protected] ~]# mv jpress-web-newest.war /usr/local/tomcat/webapps/
[[email protected] ~]# /usr/local/tomcat/bin/shutdown.sh
[[email protected] ~]# /usr/local/tomcat/bin/startup.sh
[[email protected] ~]# ll /usr/local/tomcat/webapps/
total 20316
drwxr-xr-x 14 root root 4096 Sep 1 00:10 docs
drwxr-xr-x 6 root root 83 Sep 1 00:10 examples
drwxr-xr-x 5 root root 87 Sep 1 00:10 host-manager
drwxr-xr-x 7 root root 102 Sep 1 01:09 jpress-web-newest
-rw-r–r– 1 root root 20797013 Mar 3 2017 jpress-web-newest.war
drwxr-xr-x 5 root root 103 Sep 1 00:10 manager
drwxr-xr-x 3 root root 306 Sep 1 00:10 ROOT

瀏覽器訪問jpress網站嚮導介面

http://10.0.0.202:8080/jpress-web-newest/install



[[email protected] ~]# /usr/local/tomcat/bin/shutdown.sh
[[email protected] ~]# /usr/local/tomcat/bin/startup.sh
http://10.0.0.202:8080/jpress-web-newest/admin/login

Tomcat搭建jpress網站

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.