第1、启动、终止、重启php
systemctl start httpd.service #启动mysql
systemctl stop httpd.service #中止linux
systemctl restart httpd.service #重启web
第2、设置开机启动/关闭sql
systemctl enable httpd.service #开机启动数据库
systemctl disable httpd.service #开机不启动apache
第3、检查httpd状态缓存
systemctl status httpd.service服务器
另外,下表是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 offchkconfig --levels 0123456 anacron offchkconfig --levels 0123456 auditd offchkconfig --levels 0123456 avahi-daemon offchkconfig --levels 0123456 bluetooth offchkconfig --levels 0123456 clvmd offchkconfig --levels 0123456 cman offchkconfig --levels 0123456 cups offchkconfig --levels 0123456 gfs offchkconfig --levels 0123456 gfs2 offchkconfig --levels 0123456 hidd offchkconfig --levels 0123456 httpd offchkconfig --levels 0123456 iptables offchkconfig --levels 0123456 ip6tables offchkconfig --levels 0123456 ipvsadm offchkconfig --levels 0123456 luci offchkconfig --levels 0123456 mcstrans offchkconfig --levels 0123456 pand offchkconfig --levels 0123456 Nrestorecond offchkconfig --levels 0123456 ricci offchkconfig --levels 0123456 rmanager offchkconfig --levels 0123456 saslauthd offchkconfig --levels 0123456 sendmail offchkconfig --levels 0123456 smb offchkconfig --levels 0123456 snmp offchkconfig --levels 0123456 snmptrapd offchkconfig --levels 0123456 tog-pegasus offchkconfig --levels 0123456 wdaemon off