码迷,mamicode.com
首页 > 其他好文 > 详细

centos中创建服务和关闭防火墙的基本命令

时间:2019-11-20 19:19:59      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:创建   ini   临时   kconfig   相关   led   emc   isa   art   

centos 6

===========================================================================================

启动和关闭服务

service  xxx  start /restart/reload/status     # 临时启动、重启、重新加载、查看服务

/etc/init.d/xxx  start /restart/reload/status     # 临时启动、重启、重新加载、查看服务

chkconfig  xxx  on/off               # 添加到开机自启中,但是要保证这个服务已经是系统服务

chkconfig  xxx  list               # 查看这个服务是否已经添加了系统服务

chkconfig  xxx  --add              #添加系统服务

chkconfig  xxx  --del               #删除系统服务

 

关闭防火墙iptables和selinux

service  iptables  stop      # 临时关闭

chkconfig  iptables  off       # 永久关闭,即开机不会启动

setenforce 0           # 临时关闭

sed  -i  ‘7 s/enforcing/disabled/g‘  /etc/sysconfig/selinux  # 永久关闭

===========================================================================================

centos 7

===========================================================================================

启动或关闭服务

systemctl  start/restart/reload/status  xxx.service    # 临时启动、重启、重新加载、查看服务

systemctl  stop  xxx.service              # 临时关闭服务

systemctl  enable  xxx.service             # 永久开机,即开机自启

systemctl  disable  xxx.service             # 永久关闭,【注意disable没有d】

 

关闭防火墙firewalld,但是selinux 的相关命令没有改变

systemctl  stop firewalld                # 临时关闭firewalld

systemctl  disable firewalld               # 永久关闭firewalld

注意:centos7中默认的防火墙是firewalld,但是iptables也是存在的,但是需要安装 yum -y install iptables 

===========================================================================================

 

 

 

 

 

 

 

 

centos中创建服务和关闭防火墙的基本命令

标签:创建   ini   临时   kconfig   相关   led   emc   isa   art   

原文地址:https://www.cnblogs.com/yunjisuan1024/p/11899579.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!