When installing jdk1.8 on linux, the installation package is downloaded incorrectly.

Step 1: Download the installation package, don’t download it by mistake. Download this one below.

Step 2: Upload the downloaded installation package to the Linux server

1: Installation command: rpm -ivh [installation package name]

 2: View the version information after JDK installation: java -version

 3: View the directory command after jdk installation: which java

4: Configure the java environment and modify etc/profile command: vim etc/profile

 #java environment  直接copy 过去
export JAVA_HOME=/usr/bin/java/jdk1.8.0_311-amd64
export CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin

5: Save and exit. Refresh configuration file command: source/etc/profile

6: Write a java program to verify vim test.java

 7: Run the program, which means the jdk installation and configuration is successful.

Turn on the server firewall:

# 查看firewall服务状态
systemctl status firewalld
 
# 开启、重启、关闭、firewalld.service服务
# 开启
service firewalld start
# 重启
service firewalld restart
# 关闭
service firewalld stop
 
# 查看防火墙规则
firewall-cmd --list-all    # 查看全部信息
firewall-cmd --list-ports  # 只看端口信息
 
# 开启端口
开端口命令:firewall-cmd --zone=public --add-port=80/tcp --permanent
重启防火墙:systemctl restart firewalld.service
 
命令含义:
--zone #作用域
--add-port=80/tcp  #添加端口,格式为:端口/通讯协议
--permanent   #永久生效,没有此参数重启后失效

Guess you like

Origin blog.csdn.net/beautifulYuan/article/details/122122383