How to install tomcat and deploy a Web site in Linux
This article introduces how to install tomcat in Linux and deploy the website, the content is very detailed, interested friends can refer to, hope to be helpful to you.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
Yum installation openjdk:
1. Find available jdk packages:
[root@linux ~] # yum list | grep jdk
two。 Select the corresponding version of the package installation:
[root@linux ~] # yum-y install java-1.8.0-openjdk
Install tomcat:
Tomcat official website: http://tomcat.apache.org/
Mainstream version of tomcat: 7.0Compact 8.5Unip 9.0
Download the tomcat binary package:
[root@linux ~] # cd / usr/local/src/ [root@linux src] # wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz
Decompress:
[root@linux src] # tar-xzvf apache-tomcat-9.0.27.tar.gz
Move to the / usr/local/ directory:
[root@linux src] # mv apache-tomcat-9.0.27 / usr/local/tomcat
Start tomcat:
[root@linux ~] # / usr/local/tomcat/bin/startup.sh Using CATALINA_BASE: / usr/local/tomcatUsing CATALINA_HOME: / usr/local/tomcatUsing CATALINA_TMPDIR: / usr/local/tomcat/tempUsing JRE_HOME: / usrUsing CLASSPATH: / usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jarTomcat started.
View the process:
Ps-ef | grep tomcat or ps-ef | grep java
View the listening port:
[root@linux ~] # netstat-lntp | grep javatcp6 00:: 8009: * LISTEN 13601/java tcp6 00:: 8080: * LISTEN 13601/java tcp6 00 127.0.0.1 grep javatcp6 8005: * LISTEN 13601/java
8080:web port
8005: management Port
8009:AJP port (for third-party application connections)
Deploy the website through tomcat using zrlog:
Zrlog is an open source java blog system, official website: https://www.zrlog.com/
Download zrlog:
[root@linux ~] # wget http://dl.zrlog.com/release/zrlog-2.1.3-b5f0d63-release.war?attname=ROOT.war&ref=index
Move to the webapps directory of tomcat:
[root@linux ~] # mv zrlog-2.1.3-b5f0d63-release.war\? attname\ = ROOT.war / usr/local/tomcat/webapps/zrlog.war
When you move the .war package to the webapps directory, it will be decompressed automatically:
[root@linux ~] # cd / usr/local/tomcat/webapps/ [root@linux webapps] # lsdocs examples host-manager manager ROOT zrlog zrlog.war
Rename the zrlog directory to ROOT:
[root@linux webapps] # mv ROOT ROOT.bak [root@linux webapps] # mv zrlog ROOT
Create a database for the zrlog blog site:
[root@linux] # mysql-uroot-p123456-e "create database zrlog"
Create a database user and authorize:
[root@linux] # mysql-uroot-p123456-e "grant all on zrlog.* to 'zrloguser'@'127.0.0.1' identified by' test123'"
# create user zrloguser, password test123, authorized host:127.0.01
On how to install tomcat in Linux and deploy the website to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.