工作中注意的事项



1、 千万不要执行:yum -y remove python 或者 rpm -e python --nodeps

       因为yum是使用python编写的,如果把python卸载了,则yum将不能再继续使用了

       如果想自己编译安装新版本的python,也千万不要卸载掉centos自带的python,不用管它就好




2、 千万不要执行:iptables -F

       因为如果你的filter表中的INPUT链默认的规则是所有的请求都拒绝的话,就完了

       [root@scj ~]# iptables -L

       Chain INPUT (policy DROP)

       target     prot opt source               destination         

       ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh 

       ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http 

       ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:zabbix-trapper 

       ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:zabbix-agent 


       Chain FORWARD (policy ACCEPT)

       target     prot opt source               destination         


       Chain OUTPUT (policy ACCEPT)

       target     prot opt source               destination         

       ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:zabbix-agent

       如上:如果是INPUT (policy DROP),当我们执行iptables -F,清空所有的规则后,默认INPUT链所有请求都拒绝的,所以22端口也会被拒绝,就无法远程登录了

       正确做法先iptables -L,若不是DROP再iptables -F;若是先执行iptables -P INPUT ACCEPT,再iptables -F清空





3、 修改配置文件里pid进程文件相关,socket文件相关的参数时,一定要记得先把服务stop掉

    尤其对于mysql服务,在my.cnf配置文件里修改pid-file参数的值时,一定要先把mysql服务stop掉,再去修改配置文件里参数的值