![清除后重新安装 Apache2:apt-get 说它已经是最新版本](https://linux22.com/image/112251/%E6%B8%85%E9%99%A4%E5%90%8E%E9%87%8D%E6%96%B0%E5%AE%89%E8%A3%85%20Apache2%EF%BC%9Aapt-get%20%E8%AF%B4%E5%AE%83%E5%B7%B2%E7%BB%8F%E6%98%AF%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC.png)
好吧,所以我卸载了 apache2(长话短说......)。
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
whereis apache2
然后我删除了 sudo rm -rf 列出的所有目录
现在我尝试重新安装 apache2,但似乎没有任何效果。
sudo apt-get install apache2
返回“apache2已经是最新版本”
一些搜索让我尝试
sudo apt-get install apache2 -d --reinstall
没有显示任何更新:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 93 not upgraded.
Need to get 0 B/208 kB of archives.
After this operation, 0 B of additional disk space will be used.
Download complete and in download only mode
whereis apache2
退货
Apache2:
没有别的。
现在我被困住了。关于如何恢复 apache 有什么想法吗?
我还应该补充一点,我的发行版是 Raspbian Jessie
dpkg -L apache2 的输出
/.
/etc
/etc/apache2
/etc/apache2/mods-enabled
/etc/apache2/conf-enabled
/etc/apache2/sites-enabled
/etc/apache2/apache2.conf
/etc/apache2/conf-available
/etc/apache2/conf-available/security.conf
/etc/apache2/conf-available/localized-error-pages.conf
/etc/apache2/conf-available/serve-cgi-bin.conf
/etc/apache2/conf-available/charset.conf
/etc/apache2/conf-available/other-vhosts-access-log.conf
/etc/apache2/envvars
/etc/apache2/magic
/etc/apache2/mods-available
/etc/apache2/mods-available/slotmem_plain.load
/etc/apache2/mods-available/speling.load
/etc/apache2/mods-available/autoindex.conf
/etc/apache2/mods-available/include.load
/etc/apache2/mods-available/authn_dbm.load
/etc/apache2/mods-available/mpm_worker.load
/etc/apache2/mods-available/reqtimeout.conf
/etc/apache2/mods-available/session_cookie.load
/etc/apache2/mods-available/log_forensic.load
/etc/apache2/mods-available/cgid.load
/etc/apache2/mods-available/proxy.load
/etc/apache2/mods-available/status.conf
/etc/apache2/mods-available/access_compat.load
/etc/apache2/mods-available/actions.conf
/etc/apache2/mods-available/buffer.load
/etc/apache2/mods-available/heartmonitor.load
/etc/apache2/mods-available/proxy_wstunnel.load
/etc/apache2/mods-available/mpm_prefork.load
/etc/apache2/mods-available/info.load
/etc/apache2/mods-available/dbd.load
/etc/apache2/mods-available/lbmethod_bybusyness.load
/etc/apache2/mods-available/authnz_ldap.load
/etc/apache2/mods-available/rewrite.load
/etc/apache2/mods-available/proxy_scgi.load
/etc/apache2/mods-available/userdir.load
/etc/apache2/mods-available/usertrack.load
/etc/apache2/mods-available/cgi.load
/etc/apache2/mods-available/mpm_event.conf
/etc/apache2/mods-available/alias.conf
/etc/apache2/mods-available/proxy_ajp.load
/etc/apache2/mods-available/ident.load
/etc/apache2/mods-available/ldap.conf
/etc/apache2/mods-available/dav_fs.load
/etc/apache2/mods-available/proxy_fdpass.load
/etc/apache2/mods-available/dialup.load
/etc/apache2/mods-available/sed.load
/etc/apache2/mods-available/mpm_event.load
/etc/apache2/mods-available/lbmethod_heartbeat.load
/etc/apache2/mods-available/ldap.load
/etc/apache2/mods-available/xml2enc.load
/etc/apache2/mods-available/mime.conf
/etc/apache2/mods-available/remoteip.load
/etc/apache2/mods-available/filter.load
/etc/apache2/mods-available/mime_magic.conf
/etc/apache2/mods-available/heartbeat.load
/etc/apache2/mods-available/lbmethod_byrequests.load
/etc/apache2/mods-available/unique_id.load
/etc/apache2/mods-available/autoindex.load
/etc/apache2/mods-available/authz_user.load
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-available/info.conf
/etc/apache2/mods-available/cache_socache.load
/etc/apache2/mods-available/setenvif.conf
/etc/apache2/mods-available/authn_file.load
/etc/apache2/mods-available/slotmem_shm.load
/etc/apache2/mods-available/cache_disk.load
/etc/apache2/mods-available/deflate.load
/etc/apache2/mods-available/dav.load
/etc/apache2/mods-available/proxy_balancer.conf
/etc/apache2/mods-available/deflate.conf
/etc/apache2/mods-available/proxy_connect.load
/etc/apache2/mods-available/echo.load
/etc/apache2/mods-available/dir.conf
/etc/apache2/mods-available/actions.load
/etc/apache2/mods-available/authz_owner.load
/etc/apache2/mods-available/dump_io.load
/etc/apache2/mods-available/setenvif.load
/etc/apache2/mods-available/file_cache.load
/etc/apache2/mods-available/env.load
/etc/apache2/mods-available/ext_filter.load
/etc/apache2/mods-available/mime.load
/etc/apache2/mods-available/negotiation.load
/etc/apache2/mods-available/ssl.conf
/etc/apache2/mods-available/dav_lock.load
/etc/apache2/mods-available/dir.load
/etc/apache2/mods-available/cache.load
/etc/apache2/mods-available/ssl.load
/etc/apache2/mods-available/auth_digest.load
/etc/apache2/mods-available/authz_groupfile.load
/etc/apache2/mods-available/substitute.load
/etc/apache2/mods-available/authn_core.load
/etc/apache2/mods-available/proxy_ftp.conf
/etc/apache2/mods-available/socache_shmcb.load
/etc/apache2/mods-available/userdir.conf
/etc/apache2/mods-available/auth_basic.load
/etc/apache2/mods-available/suexec.load
/etc/apache2/mods-available/session_crypto.load
/etc/apache2/mods-available/allowmethods.load
/etc/apache2/mods-available/dav_fs.conf
/etc/apache2/mods-available/reflector.load
/etc/apache2/mods-available/charset_lite.load
/etc/apache2/mods-available/mpm_worker.conf
/etc/apache2/mods-available/session_dbd.load
/etc/apache2/mods-available/authz_core.load
/etc/apache2/mods-available/proxy_ftp.load
/etc/apache2/mods-available/proxy_express.load
/etc/apache2/mods-available/vhost_alias.load
/etc/apache2/mods-available/headers.load
/etc/apache2/mods-available/ratelimit.load
/etc/apache2/mods-available/proxy_http.load
/etc/apache2/mods-available/log_debug.load
/etc/apache2/mods-available/authz_host.load
/etc/apache2/mods-available/authz_dbm.load
/etc/apache2/mods-available/proxy.conf
/etc/apache2/mods-available/cache_disk.conf
/etc/apache2/mods-available/data.load
/etc/apache2/mods-available/status.load
/etc/apache2/mods-available/request.load
/etc/apache2/mods-available/mime_magic.load
/etc/apache2/mods-available/proxy_html.conf
/etc/apache2/mods-available/alias.load
/etc/apache2/mods-available/proxy_balancer.load
/etc/apache2/mods-available/proxy_html.load
/etc/apache2/mods-available/proxy_fcgi.load
/etc/apache2/mods-available/negotiation.conf
/etc/apache2/mods-available/reqtimeout.load
/etc/apache2/mods-available/authn_socache.load
/etc/apache2/mods-available/expires.load
/etc/apache2/mods-available/lbmethod_bytraffic.load
/etc/apache2/mods-available/auth_form.load
/etc/apache2/mods-available/authnz_fcgi.load
/etc/apache2/mods-available/authz_dbd.load
/etc/apache2/mods-available/authn_anon.load
/etc/apache2/mods-available/cgid.conf
/etc/apache2/mods-available/macro.load
/etc/apache2/mods-available/socache_memcache.load
/etc/apache2/mods-available/session.load
/etc/apache2/mods-available/asis.load
/etc/apache2/mods-available/lua.load
/etc/apache2/mods-available/socache_dbm.load
/etc/apache2/mods-available/authn_dbd.load
/etc/apache2/ports.conf
/etc/apache2/sites-available
/etc/apache2/sites-available/000-default.conf
/etc/apache2/sites-available/default-ssl.conf
/etc/logrotate.d
/etc/logrotate.d/apache2
/etc/bash_completion.d
/etc/bash_completion.d/apache2
/etc/cron.daily
/etc/cron.daily/apache2
/etc/default
/etc/default/apache2
/etc/init.d
/etc/init.d/apache2
/usr
/usr/lib
/usr/lib/cgi-bin
/usr/share
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/apache2
/usr/share/bug
/usr/share/bug/apache2
/usr/share/apache2
/usr/share/apache2/ask-for-passphrase
/usr/share/apache2/apache2-maintscript-helper
/usr/share/doc
/usr/share/doc/apache2
/usr/share/doc/apache2/README.backtrace
/usr/share/doc/apache2/README.multiple-instances
/usr/share/doc/apache2/migrate-sites.pl
/usr/share/doc/apache2/copyright
/usr/share/doc/apache2/examples
/usr/share/doc/apache2/examples/setup-instance
/usr/share/doc/apache2/examples/secondary-init-script
/usr/share/doc/apache2/examples/apache2.monit
/usr/share/doc/apache2/PACKAGING.gz
/usr/share/doc/apache2/README.Debian.gz
/usr/share/doc/apache2/changelog.Debian.gz
/usr/share/doc/apache2/NEWS.Debian.gz
/usr/share/doc/apache2/changelog.gz
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/apache2ctl.8.gz
/usr/share/man/man8/a2enmod.8.gz
/usr/share/man/man8/a2ensite.8.gz
/usr/share/man/man8/a2enconf.8.gz
/usr/share/man/man1
/usr/share/man/man1/a2query.1.gz
/usr/sbin
/usr/sbin/a2enmod
/usr/sbin/apache2ctl
/usr/sbin/a2query
/var
/var/lib
/var/lib/apache2
/var/cache
/var/cache/apache2
/var/cache/apache2/mod_cache_disk
/var/log
/var/log/apache2
/var/www
/var/www/html
/lib
/lib/systemd
/lib/systemd/system
/lib/systemd/system/apache2.service.d
/lib/systemd/system/apache2.service.d/forking.conf
/usr/share/bug/apache2/control
/usr/share/bug/apache2/script
/usr/share/man/man8/a2disconf.8.gz
/usr/share/man/man8/apachectl.8.gz
/usr/share/man/man8/a2dismod.8.gz
/usr/share/man/man8/a2dissite.8.gz
/usr/sbin/apachectl
/usr/sbin/a2disconf
/usr/sbin/a2enconf
/usr/sbin/a2dissite
/usr/sbin/a2ensite
/usr/sbin/a2dismod
答案1
解决!
最终,我发现另一个帖子对于类似的事情,其中一个回应对我有用:
sudo apt-get remove --purge apache2*
sudo apt-get --reinstall install apache2.2-common
sudo apt-get --reinstall install apache2
我认为使用通配符的更强大的“清除”方法以及重新安装 apache2.2-common 是诀窍。
答案2
purge
rm -rf
如果清除不起作用并且没有报告错误,应该处理所有可能损坏某些东西或东西已经损坏的事情。我建议重新安装然后运行您的安装脚本。