复习:
(1)关闭防火墙
systemctl stop firewalld
(2)开机自启动防火墙
systemctl enable firewalld
(3)开机不自启动防火墙
systemctl disable firewalld
(4)开启防火墙
systemctl start firewalld
1.安装tomcat
(1)安装wget
yum -y install wget
(2)用wget安装tomcat 1.9.0版本
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.91/bin/apache-tomcat-9.0.91.tar.gz如果不可以用Xftp把文件上传。
(3)解压tomcat文件到/usr/local下
tar - zxvf apache-tomcat-9.0.91 .tar.gz /usr/local
(4)在/usr/local下可查看安装好的文件
apache-tomcat-9.0.91
(5)安装java环境
yum -y install java-1.8.0-openjdk-headless
(6)进入tomcat9目录下
cd /usr/local/apache-tomcat-9.0.91/
(7)启动tomcat服务(要关闭防火墙)
/usr/local/apache-tomcat-9.0.91/bin/startup.sh
3.安装vim,使用vim创建并修改test.txt文件
4.端口占用:就停止tomcat
5.创建一个静态资源
vim /usr/local/apache-tomcat-9.0.91/webapps/index.html
文件内容
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h1>我是一个简单的标签</h1>
</body>
<html>
在浏览器访问http://192.168.2.10(本机ip地址):8080/abc/index.html可以看到
安装jdk17
tar -zxvf openjdk-17.0.1_linux-x64_bin.tar.gz
mv jdk-17.0.1/ /usr/local/jdk17
[root@localhost jdk17]# cd bin //进入bin目录下
执行todolist文件
./java -jar /root/todolist.jar
可以看到
编写配置文件直接
vim /etc/profile
export PATH=/usr/local/maven3/bin/:/usr/local/jdk17/bin:$PATH //配置Java和maven环境变量(将java的可执行文件添加到环境变量$PATH中)
source /etc/profile 使配置文件生效
配置JAVA_HOME
修改配置文件(vim /etc/profile)
export PATH=/opt/apache-maven-3.9.8/bin:$PATH
export PATH=/usr/local/maven3/bin/:/usr/local/jdk17/bin:$PATH
export JAVA_HOME=/usr/local/jdk17/
source /etc/profile使文件生效
检验可以看到:
[root@localhost local]# $JAVA_HOME
-bash: /usr/local/jdk17/: 是一个目录
/usr/local/jdk22/bin/java -jar(检验)
python配置,python版本为2.5
[root@localhost local]# python
Python 2.7.5 (default, Apr 11 2018, 07:36:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
[root@localhost local]# python
>>> with open("a.txt","wb")as f:
... f.write("456 465 5")
...
>>> import os
>>> os.listdir("./")