Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

CentOS 卸載 Apache (httpd) 完整方法:rpm 命令與依賴處理

編輯:關於伺服器

標準卸載流程

# 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
# 自動處理相依
Copyright © Windows教程網 All Rights Reserved