Bootstrap

实训DAY02

开启防火墙 

systemctl start firewalld

关闭防火墙

systemctl stop firewalld

开机自启动防火墙

systemctl enable firewalld

开机不启动防火墙

systemctl disable firewalld

安装jdk17、22

先卸载低版本jdk,装jdk17,22版本
卸载之前的版本

1.下载

[root@aabbcc ~]# yum -y remove java-1.8.0-openjdk-headless-1.8.0.161-2.b14.el7.x86_64

[root@aabbcc ~]#  ls
anaconda-ks.cfg  jdk-22_linux-x64_bin.tar.gz

2.解压

[root@aabbcc ~]# tar -zxvf jdk-22_linux-x64_bin.tar.gz
 
[root@aabbcc ~]# ls

3.移动到/usr/local

[root@aabbcc ~]# mv jdk-22.0.1/ /usr/local/
 
[root@aabbcc ~]# cd /usr/local/
 
[root@aabbcc local]# ls
 
apache-tomcat-10.1.25  bin  games    jdk-22.0.1  lib64    sbin   src
 
apache-tomcat-9.0.91   etc  include  lib         libexec  share
 
[root@aabbcc local]# cd /usr/local/jdk-22.0.1/
 
[root@aabbcc jdk-22.0.1]# cd bin/
 
[root@aabbcc bin]#  pwd
 
/usr/local/jdk-22.0.1/bin

4.修改环境变量

[root@aabbcc bin]#  vim /etc/profile
 
export PATH=/usr/local/jdk-22.0.1/bin:$PATH 

5.让该文件立即生效

[root@aabbcc bin]#  source /etc/profile          
 
[root@aabbcc bin]# java -version
 
java version "22.0.1" 2024-04-16

Java(TM) SE Runtime Environment (build 22.0.1+8-16)

6.开启防火墙

systemctl start firewalld

 7.开机自启动防火墙

systemctl enable firewalld 
 
8.启动tomcat

[root@aabbcc bin]#  cd /usr/local/apache-tomcat-9.0.91/
 
[root@aabbcc  apache-tomcat-9.0.91]# ./bin/startup.sh
 
Using CATALINA_BASE:   /usr/local/apache-tomcat-9.0.91
 
Using CATALINA_HOME:   /usr/local/apache-tomcat-9.0.91
 
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-9.0.91/temp
 
Using JRE_HOME:        /usr/local/jdk-22.0.1
 
Using CLASSPATH:       /usr/local/apache-tomcat-9.0.91/bin/bootstrap.jar:/usr/local/apache-tomcat-9.0.91/bin/tomcat-juli.jar
 
Using CATALINA_OPTS:   
 
Tomcat started.

9.启动maven

[root@aabbcc  apache-tomcat-9.0.91]# cd /opt /apache-maven-3.9.8/bin/
 
[root@aabbcc bin]#  mvn -v    //启动maven
[root@aabbcc bin]#  vim /etc/profile
 
export PATH=/usr/local/maven3/bin/:/usr/local/jdk-22.0.1/bin/:$PATH
 
export JAVA_HOME=/usr/local/ jdk-22.0.1/   
 
[root@aabbcc bin]# source /etc/profile
 
[root@aabbcc bin]# $JAVA_HOME
 
-bash: /usr/local/jdk-22.0.1/: 是一个目录

下载python3

官网tar包连接:Python Source Releases | Python.org
1.pythonweb
2.人工智能环境
3.数据分析

[root@aabbcc bin]# 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.
 
>>> with open("b.txt","wb") as f:
 
...       f.write("我,秦始皇,打钱")
 
>>> import os
 
>>> os.listdir("./")
 
['.bash_logout', '.bash_profile', '.bashrc', '.cshrc', '.tcshrc', 'anaconda-ks.cfg', 'RHEL7-extras.iso', 'RHEL7OSP-10.iso', '.bash_history', 'jdk-22_linux-x64_bin.tar.gz.0', '.viminfo', 'b.txt', 'RHEL7-extras.iso.0', 'do', 'httpd.tar.gz', 'myos.tar(1).gz', 'nginx.tar.gz', 'ubuntu.tar.gz', '.lesshst', '2f57195050ebb3412bdf98d60d59aa5441e7b08931cb5fbac0e880d9840d1ba9.json', '618dd2138e07055b0acb7bd242b00403e37870dfed7b85b5e48ee92922897552', '7132dc6b963aa1930bfa115af5b738cd868aa5dd172e53b97df41f9b756c186b', 'manifest.json', 'repositories', 'myimg', 'nginx-1.8.0.tar.gz', 'nginx-1.8.0', 'zabbix-3.2.3.tar.gz', 'zabbix-3.2.3.tar.gz.0', 'zabbix-3.2.3', '.mysql_history', 'zabbix.conf_(9).php', 'apache-tomcat-10.1.25.tar.gz', 'jdk-22_linux-x64_bin.tar.gz', 'todolist.jar', 'Python-3.12.4.tgz']
;