我试图升级nginx 1.2.1到版本1.2.6在Ubuntu 12.10,但没有运气。 我以前安装nginx使用apt-get install nginx-full
因为我需要模块而不是从源代码构build。 但是现在我不能用下面的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中configuration好的网站搞乱,在这种情况下是否有安全的升级方法? 我需要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.htmlfind答案
解决这个问题(在大多数情况下,但可能不是全部)很简单:寻找导致错误的文件的path – 在我的第一个例子中,将是“/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 …”replace为导致计算机上出现错误的.deb的确切path。 如果你已经从版本库安装了.deb文件,它位于/ var / cache / apt / archives中,但是如果没有的话,它就是你下载的地方(不pipe怎样,错误应该显示它的确切path,不得不手动查找它)。
上述命令的作用是强制覆盖2个包中存在的文件并导致错误。 然后,为了确保所有的软件包都已经安装成功,运行以下命令:
sudo apt-get install -f