Background
- url:https://help.aliyun.com/document_detail/172784.html
- Date: 2021-09-21
- Subject: Deploy Tomcat Web Service on Alibaba Cloud Linux 2 ECS
- Instance: ecs.s6-c1m2.small, 1 core 2 GiB
- OS: Alibaba Cloud Linux 3.2104 64bit
- JDK Version: JDK 1.8.0_302
- Apache Tomcat: 8.5.71
Step 1 Prepare
Config ECS Security Group Inbound Rules about port 1022(ssh) and 8080(http)
- ssh ECS (vim /etc/ssh/sshd_config, Port 1022, systemclt ssh restart)
- turn off firewalld
$ systemctl status firewalld #check status is inactive or active
$ systemctl stop firewalld #turn off firewalld temperately
$ systemctl disable firewalld #turn off firewalld for good
- turn off SELinux
$ getenforce #check SELinux status is Disabled or Enforcing
$ setenforce 0 #turn off temperately
$ vim /etc/selinux/config
#SELINUX=enforcing -> SELINUX=disabled
#restart to take effect
- creat normal user www to run Tomcat。
useradd www
mkdir -p /data/wwwroot/default #-p: create directoty even if no parent directory
chown -R www.www /data/wwwroot #-R: recursive
Step2 Install JDK1.8
yum -y list java* #check java package version
yum -y install java-1.8.0-openjdk-1.8.0.302.b08-0.1.al8.x86_64
java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)
vim /etc/profile
JAVA_HOME=/usr/lib/jvm/java-1.8.0.302.b08
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME CLASSPATH PATH #export: ensure the environment variables passed to child proces