Ubuntu

在 Ubuntu 12.10 上從 PPA 將 nginx-full 1.2.1 升級到 nginx 1.2.6

  • January 23, 2013

我正在嘗試在 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’ 包含包中的所有模組。

從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

引用自:https://serverfault.com/questions/469884