![重新安裝 apache2 ubuntu 14.04 時出現問題](https://rvso.com/image/1083756/%E9%87%8D%E6%96%B0%E5%AE%89%E8%A3%9D%20apache2%20ubuntu%2014.04%20%E6%99%82%E5%87%BA%E7%8F%BE%E5%95%8F%E9%A1%8C.png)
重新安裝時我遇到了一些問題apache2
。
我用:
sudo apt-get install --reinstall apache2 apache2-bin
然後出現此訊息錯誤,
/etc/init.d/apache2: 64: .: Can't open /etc/apache2/envvars
/etc/init.d/apache2: 76: .: Can't open /etc/apache2/envvars
ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvarsinvoke-rc.d: initscript apache2, action "restart" failed
我嘗試使用這個來清除:
sudo apt-get purge apache2
之後我嘗試再次使用此重新安裝:
sudo apt-get install apache2
當我嘗試使用該程式碼重新安裝 apache2 時,這是訊息:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
apache2-doc apache2-suexec-pristine apache2-suexec-custom apache2-utils
The following NEW packages will be installed:
apache2
0 upgraded, 1 newly installed, 0 to remove and 405 not upgraded.
Need to get 0 B/87,5 kB of archives.
After this operation, 473 kB of additional disk space will be used.
Selecting previously unselected package apache2.
(Reading database ... 170080 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.7-1ubuntu4.1_amd64.deb ...
Unpacking apache2 (2.4.7-1ubuntu4.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Setting up apache2 (2.4.7-1ubuntu4.1) ...
Enabling module mpm_event.
cp: cannot stat ‘/usr/share/apache2/default-site/index.html’: No such file or directory
dpkg: error processing package apache2 (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Errors were encountered while processing:
apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)
有人可以幫我解決這個問題嗎?
答案1
你可以看到 dpkg 抱怨什麼,
sudo dpkg --configure -a
sudo apt-get install -f
嘗試執行以下命令
sudo apt-get remove --purge apache2 apache2-utils
然後運行,
sudo apt-get install apache2
答案2
嘗試使用 Synaptic 套件管理器:https://apps.ubuntu.com/cat/applications/synaptic/。
搜尋該apache2
軟體包並選擇“完全卸載”選項。它應該清除配置的所有目錄和包apache2
。然後apache2
使用控制台或從 Synaptic Package Manager安裝該軟體包。