在Ubuntu上安装apache2

时间:2016-01-16 06:51:31

标签: ubuntu apache2

我想将apache2 v2.2升级到v2.4,然后使用命令行按照on this site说明进行操作:

# apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils
Reading package lists... Done
Building dependency tree       
Reading state information... Done
**apache2 is already the newest version.**
apache2-utils is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
apache2-mpm-prefork : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.10) but it is not going to be installed
apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.10) but it is not going to be installed
**E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).**

它说已安装,然后我运行:

# service apache2 status
apache2: unrecognized service

然后我运行命令行:

#apt-get -f install
The following extra packages will be installed:
apache2-mpm-worker apache2.2-bin apache2.2-common
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed
apache2-mpm-worker apache2.2-bin apache2.2-common
0 to upgrade, 3 to newly install, 0 to remove and 3 not to upgrade.
1 not fully installed or removed.
Need to get 0 B/1,572 kB of archives.
After this operation, 4,568 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
(Reading database ... 185590 files and directories currently installed.)
Unpacking apache2.2-bin (from .../apache2.2-bin_2.2.22-1ubuntu1.10_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2.2-bin_2.2.22-1ubuntu1.10_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/apache2/modules/mod_dir.so', which is also in package apache2-bin 2.4.16-4+deb.sury.org~precise+4
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Unpacking apache2.2-common (from .../apache2.2-common_2.2.22-1ubuntu1.10_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2.2-common_2.2.22-1ubuntu1.10_amd64.deb (--unpack):
trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2-bin 2.4.16-4+deb.sury.org~precise+4
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.22-1ubuntu1.10_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2-mpm-worker_2.2.22-1ubuntu1.10_amd64.deb (--unpack):
trying to overwrite '/usr/sbin/apache2', which is also in package apache2-bin 2.4.16-4+deb.sury.org~precise+4
Processing triggers for man-db ...
Errors were encountered while processing:
/var/cache/apt/archives/apache2.2-bin_2.2.22-1ubuntu1.10_amd64.deb
/var/cache/apt/archives/apache2.2-common_2.2.22-1ubuntu1.10_amd64.deb
/var/cache/apt/archives/apache2-mpm-worker_2.2.22-1ubuntu1.10_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)    

我有很多错误,任何人都对此有所了解

非常感谢

1 个答案:

答案 0 :(得分:1)

执行以下操作:

sudo apt-get purge apache2

sudo apt-get autoremove

sudo apt-get install apache2

sudo service apache2 status