Centos7 to install the correct posture of Tomcat8 and set the boot self-start practice notes


title: Centos7 installs the correct posture of Tomcat8 and sets the power-on self-start practice notes

categories: [Tomcat8,Centos 7]
tags: [Tomcat8,Centos 7] ##

**I use centos7X64 to install minimally **CentOS-7-x86_64-Minimal-1708

Personal blog on github: Personal blog powered by hexo

Students who have not installed jdk, please move to the article of [centos7 install jdk8 in the correct posture and set the boot autostart] article

1. Configure the firewall:

Either turn off the firewall or join the release port

1.1 Turn off the firewall directly###

systemctl stop firewalld.service #Stop firewall
systemctl disable firewalld.service #Prohibit firewall startup
firewall-cmd --state #View the default firewall status (notrunning will be displayed after it is turned off, and running)
[ root@localhost ~]# firewall-cmd --state
not running
[ root@localhost ~]#

1.2 Add release port###

firewall-cmd --zone=public--add-port=80/tcp --permanent #Add release port(--permanent takes effect permanently, it will become invalid after restart without this parameter)
firewall-cmd --reload #Refresh the firewall to take effect
firewall-cmd --zone=public--list-ports #View the firewall release port list
[ root@localhost ~]# firewall-cmd --zone=public--add-port=8080/tcp --permanent    #(--permanent takes effect permanently, after restarting without this parameter.effect)
success
[ root@localhost ~]# firewall-cmd --reload
success
[ root@localhost ~]# firewall-cmd --zone=public--list-ports
80 /tcp 8080/tcp
[ root@localhost ~]#
Indicates success

2. Install wget

yum -y install wget

3. Download tomcat8

wget http://mirrors.shuosc.org/apache/tomcat/tomcat-8/v8.5.42/bin/apache-tomcat-8.5.42.tar.gz

If it fails, check the download address on the official website yourself, or use the official original software I provided below

If the source address is invalid, use the Baidu cloud disk link to download and upload to the server yourself
Link: apache-tomcat-8.5.24.tar.gz official original Extraction code: y3hu

4. Unzip##

tar -zxvf apache-tomcat-8.5.42.tar.gz

5. Move to /usr/local

mv apache-tomcat-8.5.42/usr/local/tomcat8

6. Configure tomcat jdk environment variables##

yum -y install vim
vim /usr/local/tomcat8/bin/catalina.sh

Add the following code in front of OS specific support.:

export JAVA_HOME=/usr/local/java/jdk1.8.0_211
export JRE_HOME=$JAVA_HOME/jre

7. Configure tomcat8 boot

Add the tomcat8.service file in the /usr/lib/systemd/system directory, the content is as follows:

vi /usr/lib/systemd/system/tomcat8.service
[ Unit]
Description=Tomcat-8
After=syslog.target network.target remote-fs.target nss-lookup.target
  
[ Service]
Type=oneshot
ExecStart=/usr/local/tomcat8/bin/startup.sh
ExecStop=/usr/local/tomcat8/bin/shutdown.sh
ExecReload=/bin/kill -s HUP $MAINPID
RemainAfterExit=yes

[ Install]
WantedBy=multi-user.target

8. Allow tomcat8 to start up##

systemctl enable tomcat8

9. tomcat8 common commands##

systemctl enable tomcat.service    //Boot tomcat

systemctl disable tomcat.service    //Disable boot tomcat

systemctl start tomcat8.service    //Start tomcat

systemctl stop tomcat8.service    //Close tomcat

systemctl restart tomcat8.service   //Restart tomcat

systemctl status tomcat8.service   //View status tomcat

Recommended Posts

Centos7 to install the correct posture of Tomcat8 and set the boot self-start practice notes
Centos7 activemq startup failure to solve the correct posture practice notes
Centos7 installation jdk8 correct posture practice notes
How to install and uninstall tomcat on centos
Centos7 to install the correct posture of Tomcat8 and set the boot self-start practice notes
Centos7 activemq startup failure to solve the correct posture practice notes
Centos7 installation jdk8 correct posture practice notes
CentOS6.5 install Java 8 and Tomcat8
CentOS6.5 install Java 8 and Tomcat8
CentOS6.5 install Java 8 and Tomcat8
virtualBox install centos, and build tomcat
Centos install the latest version of cmake
Simple practice of RHCS cluster in CentOS6
Download of VM virtual machine and install centos7
How to install and uninstall tomcat on centos
Centos7.6 method to install Tomcat-8.5.39
CentOS6.5 install Java 8 and Tomcat8
CentOS6.5 install Java 8 and Tomcat8
CentOS6.5 install Java 8 and Tomcat8
Ubuntu adds the Chrome icon to the correct posture of the launcher
Introduction to CentOS7 installation process of openjdk, tomcat and mysql
Use CentOS 7.5 to uninstall the built-in jdk and install your own JDK1.8
How to install Tomcat 9 on CentOS 8
virtualBox install centos, and build tomcat
Centos install the latest version of cmake
Summary of CentOS method to set static IP
How to install and use Docker on CentOS 7
How to install and configure VNC on CentOS 8
The easiest way to install Chrome on CentOS 6
Download of VM virtual machine and install centos7
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8
Centos7.2 compile and install way to build phpMyAdmin
How to install and configure Redmine on CentOS 8
[Video] Teach you how to install the latest Linux version of QQ under Centos 8
Centos6.5 install Tomcat
CentOS 7 system to view the system version and machine digits
Environment configuration of JDK, mysql and tomcat under Centos7