Ali cloud ECS configuration JDK and tomcat

First, configure the JDK

1, connected using ECS ​​Xftp

 

2, New Folder

ECS put on a new archive folder, easy to organize

(Here may also be used in the new code xshell mkdir / Home / TEMP )

 

 

3, the JDK downloaded copy to the new folder

 

4, XSHEL connected ECS

 

Connecting a sign of success

 

5, configuration jdk

  • The JDK downloaded installation package uploaded to the server via xFTP, a customizable storage directory (/ home / temp) discharge and decompression, execute the command line as follows:
 # mkdir /home/temp  
 # cd  /home/temp  # tar  -zxvf  jdk-8u181-linux-x64.tar.gz
  • Moving [all data] jdk1.8.0_181 inside to the specified folder after decompression (e.g., / usr / java)
# mkdir /usr/java
  •  [] In the next jdk1.8.0_181 data copied to the java directory
# mv /home/temp/jdk1.8.0_181 /usr/java
  • Modify environment variables, the command
# Vi / etc / profile
  • With vim editor to edit the profile file, add it to the end of the file (press "i" to enter the edit):
export JAVA_HOME=/usr/java/jdk/jdk1.8.0_112 
export JRE_HOME=/usr/java/jdk/jdk1.8.0_112/jre 
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH 
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_HOME:$PATH
  • 然后按键盘左上角的"ESC"退出编辑,保存并退出(按:wq!)
  • 保存完之后,通过命令source /etc/profile让profile文件立即生效
  • 验证是否安装成功

①、使用javac命令,不会出现command not found错误

②、使用java -version,出现版本为java version "1.8.0_181"

③、echo $PATH,看看自己刚刚设置的的环境变量配置是否都正确

    测试没问题即安装成功

 

二、配置tomcat

参考:(https://www.cnblogs.com/congcongdi/p/10143821.html)

1、下载

2、通过Xshell、Xftp上传至CentosX的 某个目录下(如/home/temp/)

3、进入/home/temp目录下,解压tomcat安装包:

cd /home/temp tar -xzvf apache-tomcat-8.5.29.tar.gz

4、将解压缩后的tomcat文件夹移动至/usr/java目录下,并重命名:

mv  /home/temp/apache-tomcat-8.5.29   /usr/java/tomcat

5、配置tomcat server.xml

vi /home/tomcat/tomcat/conf/server.xml

 

然后保存退出

6、配置防火墙,开放80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent 
firewall-cmd --reload  


打开防火墙:systemctl start firewalld.service

 

 

7、启动tomcat

 

8、对于新买的一些云服务,上面操作都没问题还是无法访问,需要在购买的服务里加上安全规则,如图

 

9、通过网页访问Tomcat:浏览器地址栏输入:http://公网IP(若无法访问,请关闭防火墙)

 

Guess you like

Origin www.cnblogs.com/congcongdi/p/11227771.html