关闭防火墙:systemctl stop firewalld
防火墙开机自启:systemctl enable firewalld
手动启动:systemctl disable firewalld
查找jdk安装包:yum list|grep jdk
下载:yum -y install java-1.8.0-openjdk-devel.i686
tomcat启动:/usr/local/apache-tomcat-9.0.91/bin/startup.sh
tomcat停用:/usr/local/apache-tomcat-9.0.91/bin/shutdown.sh
解压:
unzip todolist.jar
linux系统(虚拟机)配置java环境(以jdk17为例)可通用
1.在官网下载安装包(jdk17)
2.xshell连接,并输入:cd /usr/local
3.创建专用文件夹:mkdir java
4.进入java文件:cd java
6.获取管理员权限:su root(若在根目录下则2-6可不进行操作)
7.在Java文件内上传jdk-17的包
8.解压文件:tar -zxvf jdk-17.0.11 jdk-17_linux-x64_bin.tar.gz
9.修改配置文件:vim /etc/profile
export PATH=/opt/apache-maven-3.9.8/bin:$PATH (将Java的环境变量加入到PATH环境变量中)
export JAVA_HOME=/usr/local/java/jdk-17.0.11
10.重新加载资源: source /etc/profile
11.检查jdk是否安装成功:java -version //成功则显示版本号
找到可执行文件:/bin
[root@1 ~]# /usr/local/java/jdk-17.0.11/bin ./java -jar /root/todolist.jar //运行检测
![](https://i-blog.csdnimg.cn/direct/bb59d6aed44941fba869e59803102051.png)
njx端口:80 tomcat端口:8080
pythonweb环境
[root@1 bin]# whereis python //python位置,默认存在
python: /usr/bin/python /usr/bin/python2.7 /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz
[root@1 bin]# python2 //启动python
[root@1 bin]# python
>>> with open("a.txt","wb") as f:
... (tab)f.write("python是一个相对容易学习的脚本")
(tab)
>>> os.listdir("./")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'os' is not defined
>>> import os
>>> os.listdir("./")