VPS服務(wù)器從linux系統(tǒng)版本centos 6.x到centos 7.x變化整體不大,不過還是有很多地方需要我們注意?,最為直觀的當(dāng)屬服務(wù)管理命令,之前centos 7.x之前的系統(tǒng)我們使用service和chkconfig來管理服務(wù)器,而到了centos 7.x 這個版本的linux中,systemctl 一個命令就搞定了,它集成了service和chkconfig 的功能于一身。這里今天簡單說明一下:
systemctl start *.service #啟動?服務(wù)systemctl stop *.service #停止某服務(wù)systemctl restart *.service #重啟某服務(wù)systemctl reload *.service #重載某服務(wù)配置文件systemctl status *.service #查詢某服務(wù)運行狀態(tài)systemctl is-enabled *.service #查看某服務(wù)是否開機啟動systemctl enable *.service #設(shè)置開機啟動systemctl disable *.service #取消開機啟動systemctl –failed #查看啟動失敗的服務(wù)
注:*指服務(wù)的名字,比如重啟、iptables,我?就會這樣操作:
補充一點小技巧:systemctl 默認(rèn)沒有服務(wù)器名補全,原因是最小化安裝沒有進行安裝包bash-completion,需要執(zhí)行下邊命令后重新登錄系統(tǒng)就可以看到命令補全了。