1. 查看Linux启动的服务 chkconfig --list 查询出所有当前运行的服务 chkconfig --list atd 查询atd服务的当前状态 2.停止所有服务并且在下次系统启动时不再启动,如下所示: chkconfig --levels 12345 NetworkManager off 如果想查看当前处于运行状态的服务,用如下语句过滤即可 chkconfig --list |grep on
3.如果只是想当前的设置状态有效,在系统重启动后即不生效的话,可以用如下命令停止服务 service sshd stop
另外,下图是Linux系统中包括的比较齐全的服务的说明及是否需要启动的说明 服务名称 | 功能 | 默认开启 | 推荐 | 说明 | NetworkManager | 为了自动连接网络的服务 | | x | 可以不用 | acpid | 高级配置和电源管理接口 | ■ | ○ | 开启,高级电源管理 | anacron | 一个自动化运行任务的服务 | ■ | x | 比crond高级的玩意,可以不用 | apmd | 高级电源管理(支持旧硬件) | ■ | x | 可以不用,apmdacpid二选一 | atd | 类似于cron的任务调度系统 | ■ | x | 按需启用,一般用cron | auditd | 内核审计守护程序 | ■ | x | 可以不用,Seliux相关 | autofs | 光驱NFSSMB自动加载卸载功能 | ■ | △ | 按需启用 |
服务名称 | 功能 | 默认开启 | 推荐 | 说明 | avahi-daemon | 查找基于zeroconf协议的机器 | ■ | x | 可以不用 | avahi-dnsconfd | Avahi DNS demo | | x | 可以不用 | bluetooth | 蓝牙无线通信 | ■ | x | 可以不用 | clvmd | Cluster LVM | ■ | x | 集群相关 | cman | | ■ | x | 集群相关 | conman | remote consoles managed by conmand | | x | 可以不用 | cpuspeed | 调节cpu频率,可能会导致时间问题 | ■ | x | 可以不用 | crond | 与计划任务 | ■ | ○ | 强烈建议开启 | cups | 打印服务 | ■ | x | 可以不用 | dnsmasq | dns cache服务器 | ■ | x | 可以不用 | dund | supports dialup networking over bluetooth | ■ | x | 可以不用 | firstboot | 系统安装后初期设定工具 | ■ | x | 可以不用 | gfs | global file system | ■ | x | 集群相关 | gfs2 | | ■ | x | 集群相关 | gpm | console环境下的鼠标支持 | ■ | ○ | 建议开启 | haldaemon | 实现硬件自动检测挂载的功能 | ■ | ○ | 建议开启(依赖messagebus服务) | hidd | 蓝牙H.I.D.服 | ■ | x | 可以不用 | httpd | apache | ■ | △ | 按需启用 | ibmasm | ibm硬件管理 | ■ | x | 可以不用 | ip6tables | ipv6防火墙 | ■ | x | 可以不用 | ipmi | 智能平台管理界面 可以监控系统状况 | ■ | x | 可以不用 | iptables | ipv4防火墙 | ■ | △ | 按需启用 | ipvsadm | 集群负荷分散相关 | ■ | x | 集群相关 | irda | 红外线通信 | ■ | x | 可以不用 | irqbalance | cpu负载均衡 | ■ | ○ | 多核cpu以上需要 | kdump | 内核崩溃时转储内存运行参数用的 | ■ | x | 可以不用 | kudzu | 硬件变动检测程序 | ■ | x | 可以不用 | lm_sensors | cpu温度检测工具(?) | ■ | x | 可以不用 | luci | cluster服务相关 | ■ | x | 集群相关 | lvm2-monitor | lvm相关 | ■ | x | 集群相关 | mcstrans | 在开启Selinux下用于检查context的 | ■ | x | 可以不用Selinux相关 | mdmonitor | 软Raid管理工具 | ■ | △ | 按需启用 | mdmpd | 软Raid管理监视工具 | ■ | △ | 按需启用 | messagebus | 负责在各个系统进程之间传递消息 | ■ | ○ | 开启haldaemon必须 | microcode_ctl | | ■ | x | 可以不用 | modclusterd | cluster相关 | ■ | x | 可以不用 | multipathd | 监控多路径设备 | ■ | x | 可以不用 | mysqld | mysql数据库 | | △ | 按需启用 | named | bind9 DNS服务器 | | △ | 按需启用 | netconsole | 初始化网络控制日志 | ■ | x | 可以不用 | netfs | 安装和卸载NFS、SAMBA和NCP网络文件系统 | ■ | x | 可以不用 | netplugd | 网卡精灵进程 网线热插拔监视 | ■ | x | 可以不用 | network | 网络服务 | ■ | ○ | 开启 | nfs | NFS Network File System | ■ | x | 可以不用 | nfslock | NFS 文件Lock守护程序 | ■ | x | 可以不用 | nscd | name cache,名称服务缓存守护程式 | ■ | x | 可以不用,named相关 | ntpd | 网络/系统时钟同步服务 | ■ | x | 可以不用 | oddjobd | 与D-Bus相关 | ■ | x | 可以不用 | openais | 与Cluster相关,Heartbeat类似 | ■ | △ | 集群相关 | pand | BlueZ Bluetooth PAN | ■ | x | 可以不用,Bluetooth相关 | pcscd | 智能卡、读卡器支持 | ■ | x | 可以不用 | piranha-gui | 与cluster相关 | ■ | x | 集群相关 | portmap | NFS/NIS用于RPC动态端口分配的守护进程 | ■ | x | 可以不用,NFS相关 | psacct | 进程审计守护进程 | ■ | x | 可以不用 | pulse | LVS LVM相关 | | x | 集群相关 | qdiskd | 与cluster相关 | ■ | x | 集群相关 | rdisc | 实现客户端的ICMP路由器发现协议 | ■ | x | 只有一个路由器可以不用 | readahead_early | 预先加载特定的应用程序到内存中以提供性能 | ■ | ○ | 开启 | readahead_later | 同上 | ■ | x | 系统默认设置 | restorecond | Selinux关联项目 | ■ | x | 可以不用,Selinux相磁 | rgmanager | 与cluster相关 | ■ | x | 集群相关 | ricci | 与cluster相关 | ■ | x | 集群相关 | rpcgssd | NFS相关 | ■ | x | 可以不用,NFS相关 | rpcidmapd | RPC name to UID/GID mapper | ■ | x | 可以不用,NFS相关 | rpcsvcgssd | NFS相关 | ■ | x | 可以不用,NFS相关 | saslauthd | 使用SASL的认证守护进程,sendmail相关 | ■ | x | 可以不用,Sendmail相关 | scsi_reserve | SCSI Persistent Reservations Cluster相关 | | x | 集群相关 | sendmail | mail demo | ■ | △ | 按需启用,Sendmail相关 | setroubleshoot | 查看selinux日志的程序,Selinux相关 | ■ | x | 可以不用,Selinux相关 | smartd | 硬盘自动检测的守护进程 | ■ | ○ | 开启 | smb | Samba文件服务器 | ■ | △ | 按需启用 | snmpd | snmp相关 | ■ | △ | 按需启用,集群之间时间同步需要 | snmptrapd | snmp相关 | ■ | x | 按需启用,集群之间时间同步需要 | sshd | ssh服务 | ■ | ○ | 开启 | syslog | 系统登录、日志必要程序 | ■ | ○ | 开启 | tog-pegasus | 集群相关 | ■ | x | 可以不用,集群相关 | vncserver | vnc远程控制 | | △ | 按需启用 | wdaemon | x web邮件系统World2.1的一部分,用来提供HTTP接口Client | x | 可以不用 | winbind | 允许Unix系统利用Windows NT的用户账号信息, | samba相关 | x | 可以不用 | wpa_supplicant | wifi-wpa认证 | | △ | 按需启用 | xfs | X Window字型服务器守护进程 | ■ | x | 可以不用 | ypbind | Network Information Service(NIS) 客户端 | ■ | △ | 按需启用 | yum-updatesd | yum自动升级 | ■ | △ | 自动升级。有时候自动升级会导致问题,特别是使用php的时候。 |
示例,可以把不需要启动的服务写入到一个脚本中,直接用sh 文件名一执行就可以了 chkconfig --levels 0123456 NetworkManager off chkconfig --levels 0123456 anacron off chkconfig --levels 0123456 auditd off chkconfig --levels 0123456 avahi-daemon off chkconfig --levels 0123456 bluetooth off chkconfig --levels 0123456 clvmd off chkconfig --levels 0123456 cman off chkconfig --levels 0123456 cups off chkconfig --levels 0123456 gfs off chkconfig --levels 0123456 gfs2 off chkconfig --levels 0123456 hidd off chkconfig --levels 0123456 httpd off chkconfig --levels 0123456 iptables off chkconfig --levels 0123456 ip6tables off chkconfig --levels 0123456 ipvsadm off chkconfig --levels 0123456 luci off chkconfig --levels 0123456 mcstrans off chkconfig --levels 0123456 pand off chkconfig --levels 0123456 Nrestorecond off chkconfig --levels 0123456 ricci off chkconfig --levels 0123456 rmanager off chkconfig --levels 0123456 saslauthd off chkconfig --levels 0123456 sendmail off chkconfig --levels 0123456 smb off chkconfig --levels 0123456 snmp off chkconfig --levels 0123456 snmptrapd off chkconfig --levels 0123456 tog-pegasus off chkconfig --levels 0123456 wdaemon off
|