標準卸載流程
# 1. 停止服務
/etc/init.d/httpd stop
# 2. 查詢已安裝套件
rpm -qa | grep httpd
# 輸出範例:
# httpd-2.2.3-63.el5.centos.1
# httpd-manual-2.2.3-63.el5.centos.1
# 3. 依相依順序移除 (先移除依賴 httpd 的套件)
rpm -e httpd-manual-2.2.3-63.el5.centos.1
rpm -e httpd-2.2.3-63.el5.centos.1
處理相依衝突 (以 gnome-user-share 為例)
# 嘗試直接移除 httpd 失敗
rpm -e httpd
# error: Failed dependencies:
# httpd >= 2.2.0 is needed by gnome-user-share-0.10-6.el5.i386
# 方法一:先移除依賴者
rpm -e gnome-user-share
rpm -e httpd
# 方法二:強制忽略相依 (不推薦生產環境)
rpm -e --nodeps httpd
驗證卸載乾淨
rpm -qa | grep httpd
# 無輸出即完全移除
ls /etc/httpd
# 目錄應不存在或為空
systemctl list-unit-files | grep httpd
# 無服務單元
yum 方式 (若原為 yum 安裝)
yum remove httpd httpd-manual
# 自動處理相依