在 Ubuntu 12.10 上将 nginx-full 1.2.1 从 PPA 升级到 nginx 1.2.6

在 Ubuntu 12.10 上将 nginx-full 1.2.1 从 PPA 升级到 nginx 1.2.6

我正在尝试在 ubuntu 12.10 上将 nginx 1.2.1 升级到 1.2.6 版本,但没有成功。我之前使用 安装了 nginx,apt-get install nginx-full因为我需要模块,而不是从源代码构建。但现在我无法使用下面的 apt-get“覆盖”旧包

$ apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  nginx
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 415 kB of archives.
After this operation, 930 kB of additional disk space will be used.
Get:1 http://nginx.org/packages/ubuntu/ quantal/nginx nginx amd64 1.2.6-1~quantal [415 kB]
Fetched 415 kB in 2s (186 kB/s)
Selecting previously unselected package nginx.
(Reading database ... 77029 files and directories currently installed.)
Unpacking nginx (from .../nginx_1.2.6-1~quantal_amd64.deb) ...
----------------------------------------------------------------------

Thanks for using NGINX!

Check out our community web site:
* http://nginx.org/en/support.html

If you have questions about commercial support for NGINX please visit:
* http://www.nginx.com/support.html

----------------------------------------------------------------------
dpkg: error processing /var/cache/apt/archives/nginx_1.2.6-1~quantal_amd64.deb (--unpack):
trying to overwrite '/usr/sbin/nginx', which is also in package nginx-full 1.2.1-2.2
No apport report written because MaxReports is reached already
                                                          dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nginx_1.2.6-1~quantal_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我不想弄乱我在 nginx 中配置的所有网站,在这种情况下有没有安全的升级方法?我需要 realip_module、upstream_module、rewrite_module、memcached_module、headers_module、fastcgi_module,但我不知道 PPA 中的“nginx”包是否包含包内的所有模块。

答案1

找到答案http://www.webupd8.org/2011/02/fix-dpkg-error-trying-to-overwrite-x.html

修复此问题(在大多数情况下但可能不是全部)非常简单:查找导致错误的文件的路径 - 在我的第一个例子中,该路径是“/var/cache/apt/archives/smplayer_0.6.9+svn3595-1ppa1~maverick1_i386.deb”,运行以下命令:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/smplayer_0.6.9+svn3595-1ppa1~maverick1_i386.deb

如果“--force-overwrite”不起作用,您可以尝试“--force-all”。

在上面的命令中,将“/var...”替换为导致计算机上出现错误的 .deb 的确切路径。如果您是从存储库安装的,则 .deb 位于 /var/cache/apt/archives,但如果不是,则位于您下载它的位置(无论哪种方式,错误都应显示其确切路径,因此您不必手动查找它)。

上述命令的作用是强制覆盖 2 个包中存在并导致错误的文件。然后,为了确保所有包都已成功安装,还请运行以下命令:

sudo apt-get install -f

相关内容