第一、啟動、終止、重啟
systemctl start httpd.service #啟動
systemctl stop httpd.service #停止
systemctl restart httpd.service #重啟
第二、設置開機啟動/關閉
systemctl enable httpd.service #開機啟動
systemctl disable httpd.service #開機不啟動
第三、檢查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 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