阿里云轻量级服务器的日常操作

1、使配置文件生效: source /etc/profile

2、查看配置环境path: echo $PATH

3、查看端口号: netstat -ano

  查看当前运行程序的端口:netstat -anpl | grep LISTEN

4、启动防火墙:systemctl start firewalld     关闭防火墙:systemctl stop firewalld    重启防火墙:systemctl restart firewalld

5、禁止开机启动防火墙:systemctl disable firewalld    设置开机自动启动防火墙:systemctl enable firewalld.service

6、查看防火墙状态:firewall-cmd --state    重新刷新防火墙:firewall-cmd --reload

7、查看防火墙开通的端口:

  firewall-cmd --permanent --list-ports

  firewall-cmd --zone=public --list-ports

  firewall-cmd --list-all

  查看是否开通3306端口:firewall-cmd --query-port=3306/tcp

8、开放8080端口:firewall-cmd --zone=public --permanent --add-port=8080/tcp

9、开放3306端口:firewall-cmd --zone=public --add-port=3306/tcp --permanent

  (注意:开放端口其实方法都可以,只要把端口号改了就可以)

10、移除8080端口:firewall-cmd --permanent --remove-port=8080/tcp

参考:https://blog.csdn.net/wbyzl1/article/details/105789522

  

posted @ 2021-03-09 00:27  虾虾哈哈  阅读(235)  评论(0编辑  收藏  举报