意外删除了 apache2 服务器

意外删除了 apache2 服务器

我确实在我的实时服务器上使用 sudo 执行了以下命令

dpkg -i mod-pagespeed-*.deb
apt-get -f install

它告诉我现在我无法安装 apache2,请帮助我。

> Reading package lists... Done Building dependency tree        Reading
> state information... Done Correcting dependencies... Done The
> following packages were automatically installed and are no longer
> required:   libemail-send-io-perl libgd-text-perl libchart-perl
> libmime-types-perl libemail-mime-encodings-perl libalgorithm-c3-perl  
> libgd-graph3d-perl libclass-load-perl libio-all-perl libgd-gd2-perl
> libxml-parser-perl libmime-tools-perl libmath-round-perl  
> libemail-abstract-perl dbconfig-common libclass-c3-perl libfcgi-perl
> libdatetime-timezone-perl libgd-graph-perl cvs  
> libparams-validate-perl libcgi-pm-perl libemail-mime-contenttype-perl
> libmro-compat-perl libdatetime-perl libdatetime-locale-perl  
> libjs-yui libemail-messageid-perl libfilter-perl
> libtemplate-plugin-gd-perl libemail-date-format-perl
> libreturn-value-perl   libspiffy-perl libperl5.12 libemail-mime-perl
> liblist-moreutils-perl libemail-send-perl libconvert-binhex-perl
> libmail-sendmail-perl   perlmagick libappconfig-perl
> libsys-hostname-long-perl libemail-simple-perl libclass-singleton-perl
> libemail-address-perl   libclass-c3-xs-perl libtemplate-perl
> libc6:i386 libgcc1:i386 libstdc++6:i386 gcc-4.6-base:i386 Use 'apt-get
> autoremove' to remove them. The following extra packages will be
> installed:   gcc-4.6-base:i386 krb5-multidev libc-bin:i386
> libc-dev-bin libc6 libc6:i386 libc6-dev libexpat1 libgcc1:i386
> libgnutls26   libgssapi-krb5-2 libgssrpc4 libk5crypto3
> libkadm5clnt-mit8 libkadm5srv-mit8 libkrb5-3 libkrb5-dev
> libkrb5support0 libssl-dev libssl1.0.0   libstdc++6:i386 libtasn1-3
> Suggested packages:   krb5-doc glibc-doc glibc-doc:i386 locales:i386
> gnutls-bin krb5-user The following packages will be REMOVED:   apache2
> apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common
> bugzilla3 libapache2-mod-php5 libapr1 libaprutil1  
> libaprutil1-dbd-sqlite3 libaprutil1-ldap libc-bin libcap2
> mod-pagespeed-stable:i386 The following NEW packages will be
> installed:   gcc-4.6-base:i386 libc-bin:i386 libc6:i386 libgcc1:i386
> libstdc++6:i386 The following packages will be upgraded:  
> krb5-multidev libc-dev-bin libc6 libc6-dev libexpat1 libgnutls26
> libgssapi-krb5-2 libgssrpc4 libk5crypto3 libkadm5clnt-mit8  
> libkadm5srv-mit8 libkrb5-3 libkrb5-dev libkrb5support0 libssl-dev
> libssl1.0.0 libtasn1-3 WARNING: The following essential packages will
> be removed. This should NOT be done unless you know exactly what you
> are doing!   libc-bin 17 upgraded, 5 newly installed, 14 to remove and
> 129 not upgraded. 1 not fully installed or removed. Need to get 16.1
> MB of archives. After this operation, 40.7 MB disk space will be
> freed. You are about to do something potentially harmful. To continue
> type in the phrase 'Yes, do as I say!'  ?] Yes, do as I say! Get:1
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libc6-dev amd64 2.13-20ubuntu5.3 [2590 kB] Get:2
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libc-dev-bin amd64 2.13-20ubuntu5.3 [83.4 kB] Get:3
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libc-bin i386 2.13-20ubuntu5.3 [938 kB] Get:4
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libc6 amd64 2.13-20ubuntu5.3 [4298 kB] Get:5
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libssl-dev amd64 1.0.0e-2ubuntu4.7 [1486 kB] Get:6
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libssl1.0.0 amd64 1.0.0e-2ubuntu4.7 [965 kB] Get:7
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric/main
> gcc-4.6-base i386 4.6.1-9ubuntu3 [16.1 kB] Get:8
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric/main libgcc1
> i386 1:4.6.1-9ubuntu3 [54.3 kB] Get:9
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libc6 i386 2.13-20ubuntu5.3 [3944 kB] Get:10
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric/main
> libstdc++6 i386 4.6.1-9ubuntu3 [340 kB] Get:11
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libtasn1-3 amd64 2.9-4ubuntu0.1 [43.7 kB] Get:12
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libgnutls26 amd64 2.10.5-1ubuntu3.3 [429 kB] Get:13
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libkrb5-dev amd64 1.9.1+dfsg-1ubuntu2.3 [12.4 kB] Get:14
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> krb5-multidev amd64 1.9.1+dfsg-1ubuntu2.3 [89.6 kB] Get:15
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libk5crypto3 amd64 1.9.1+dfsg-1ubuntu2.3 [84.2 kB] Get:16
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libgssapi-krb5-2 amd64 1.9.1+dfsg-1ubuntu2.3 [118 kB] Get:17
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libkrb5-3 amd64 1.9.1+dfsg-1ubuntu2.3 [351 kB] Get:18
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libkrb5support0 amd64 1.9.1+dfsg-1ubuntu2.3 [24.0 kB] Get:19
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libgssrpc4 amd64 1.9.1+dfsg-1ubuntu2.3 [61.1 kB] Get:20
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libkadm5srv-mit8 amd64 1.9.1+dfsg-1ubuntu2.3 [53.1 kB] Get:21
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libkadm5clnt-mit8 amd64 1.9.1+dfsg-1ubuntu2.3 [37.8 kB] Get:22
> http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric-updates/main
> libexpat1 amd64 2.0.1-7ubuntu3.11.10.1 [131 kB] Fetched 16.1 MB in 2s
> (6305 kB/s)   perl: warning: Setting locale failed. perl: warning:
> Please check that your locale settings:   LANGUAGE = (unset),     LC_ALL =
> (unset),  LC_CTYPE = "UTF-8",     LANG = "en_US.UTF-8"
>     are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_CTYPE to
> default locale: No such file or directory locale: Cannot set LC_ALL to
> default locale: No such file or directory Preconfiguring packages ...
> (Reading database ... 48629 files and directories currently
> installed.) Removing mod-pagespeed-stable:i386 ... Removing apache2
> ... Removing libapache2-mod-php5 ... Module php5 disabled. To activate
> the new configuration, you need to run:   service apache2 restart
> Removing bugzilla3 ... locale: Cannot set LC_CTYPE to default locale:
> No such file or directory locale: Cannot set LC_ALL to default locale:
> No such file or directory /usr/bin/locale: Cannot set LC_CTYPE to
> default locale: No such file or directory /usr/bin/locale: Cannot set
> LC_ALL to default locale: No such file or directory locale: Cannot set
> LC_CTYPE to default locale: No such file or directory locale: Cannot
> set LC_ALL to default locale: No such file or directory Removing
> apache2-mpm-prefork ...  * Stopping web server apache2                
> * The apache2 configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system
> is working as you'd expect now!  ... waiting                          
> [ OK ] Removing apache2.2-common ... Removing apache2-utils ...
> Removing apache2.2-bin ... Removing libaprutil1-ldap ... Removing
> libaprutil1-dbd-sqlite3 ... Removing libaprutil1 ... Removing libapr1
> ... Processing triggers for man-db ... locale: Cannot set LC_CTYPE to
> default locale: No such file or directory locale: Cannot set LC_ALL to
> default locale: No such file or directory Processing triggers for
> ureadahead ... Processing triggers for ufw ... WARN: /etc is group
> writable! Processing triggers for libc-bin ... ldconfig deferred
> processing now taking place (Reading database ... 45709 files and
> directories currently installed.) Preparing to replace libc6-dev
> 2.13-20ubuntu5.1 (using .../libc6-dev_2.13-20ubuntu5.3_amd64.deb) ... Unpacking replacement libc6-dev ... Preparing to replace libc-dev-bin
> 2.13-20ubuntu5.1 (using .../libc-dev-bin_2.13-20ubuntu5.3_amd64.deb) ... Unpacking replacement libc-dev-bin ... Processing triggers for
> man-db ... locale: Cannot set LC_CTYPE to default locale: No such file
> or directory locale: Cannot set LC_ALL to default locale: No such file
> or directory dpkg: warning: overriding problem because --force
> enabled:  This is an essential package - it should not be removed.
> dpkg: warning: overriding problem because --force enabled:  This is an
> essential package - it should not be removed. dpkg: warning:
> overriding problem because --force enabled:  This is an essential
> package - it should not be removed. dpkg: warning: overriding problem
> because --force enabled:  This is an essential package - it should not
> be removed. dpkg: warning: overriding problem because --force enabled:
> This is an essential package - it should not be removed. dpkg:
> warning: overriding problem because --force enabled:  This is an
> essential package - it should not be removed. dpkg: warning:
> overriding problem because --force enabled:  This is an essential
> package - it should not be removed. dpkg: warning: overriding problem
> because --force enabled:  This is an essential package - it should not
> be removed. dpkg: warning: overriding problem because --force enabled:
> This is an essential package - it should not be removed. dpkg:
> warning: overriding problem because --force enabled:  This is an
> essential package - it should not be removed. dpkg: warning:
> overriding problem because --force enabled:  This is an essential
> package - it should not be removed. dpkg: warning: overriding problem
> because --force enabled:  This is an essential package - it should not
> be removed. dpkg: warning: overriding problem because --force enabled:
> This is an essential package - it should not be removed. dpkg:
> warning: overriding problem because --force enabled:  This is an
> essential package - it should not be removed. dpkg: warning:
> overriding problem because --force enabled:  This is an essential
> package - it should not be removed. dpkg: warning: overriding problem
> because --force enabled:  This is an essential package - it should not
> be removed. dpkg: libc-bin: dependency problems, but removing anyway
> as you requested:  libc6 depends on libc-bin (= 2.13-20ubuntu5.1).
> (Reading database ... 45614 files and directories currently
> installed.) Removing libc-bin ... Processing triggers for man-db ...
> Can't exec "locale": No such file or directory at
> /usr/share/perl5/Debconf/Encoding.pm line 16. Use of uninitialized
> value $Debconf::Encoding::charmap in scalar chomp at
> /usr/share/perl5/Debconf/Encoding.pm line 17. dpkg: warning:
> 'ldconfig' not found in PATH or not executable. dpkg: error: 1
> expected program not found in PATH or not executable. Note: root's
> PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin. E:
> Sub-process /usr/bin/dpkg returned an error code (2)

执行我从评论中得到的内容后,我看到以下错误

sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libemail-send-io-perl libgd-text-perl libchart-perl libmime-types-perl libemail-mime-encodings-perl libalgorithm-c3-perl
  libgd-graph3d-perl libclass-load-perl libio-all-perl libgd-gd2-perl libxml-parser-perl libmime-tools-perl libmath-round-perl
  libemail-abstract-perl dbconfig-common libclass-c3-perl libfcgi-perl libdatetime-timezone-perl libgd-graph-perl cvs
  libparams-validate-perl libcgi-pm-perl libemail-mime-contenttype-perl libmro-compat-perl libdatetime-perl libdatetime-locale-perl
  libjs-yui libemail-messageid-perl libfilter-perl libtemplate-plugin-gd-perl libemail-date-format-perl libreturn-value-perl
  libspiffy-perl libperl5.12 libemail-mime-perl liblist-moreutils-perl libemail-send-perl libconvert-binhex-perl libmail-sendmail-perl
  perlmagick libappconfig-perl libsys-hostname-long-perl libemail-simple-perl libclass-singleton-perl libemail-address-perl
  libclass-c3-xs-perl libtemplate-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libc-bin libc6
Suggested packages:
  glibc-doc
The following NEW packages will be installed:
  libc-bin
The following packages will be upgraded:
  libc6
1 upgraded, 1 newly installed, 0 to remove and 148 not upgraded.
2 not fully installed or removed.
Need to get 0 B/5296 kB of archives.
After this operation, 3269 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
Preconfiguring packages ...
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: error: 1 expected program not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)

答案1

您删除了一个非常重要的软件包:libc-bin。如果没有它,各种应用程序(如 apt-get)将开始失败。

您可以尝试通过手动下载并安装该包来恢复:

wget http://archive.ubuntu.com/ubuntu/pool/main/e/eglibc/libc-bin_2.13-20ubuntu5_amd64.deb
sudo dpkg -i libc-bin*.deb

检查您的架构是否匹配(版本是否存在于 11.10 cd 上)。

还请注意,您已删除可能需要的其他软件包。如果您希望稍后获取它们,您可以检查/var/log/apt/history:您应该会找到已删除的软件包,然后使用 重新安装它们apt-get

相关内容