如何将 nginx 从稳定版本升级到主线版本?

如何将 nginx 从稳定版本升级到主线版本?

我在我的 ubuntu 12.04 服务器上安装了 nginx 1.1.19。

现在我想将其升级到 1.7.6,我添加了nginx_signing.keynginx 的 apt 源,然后运行sudo apt-get install --only-upgrade nginx。但是我得到了这个错误:

The following packages were automatically installed and are no longer required:
  libjpeg8 libgd2-noxpm nginx-full libjpeg-turbo8 nginx-common
Use 'apt-get autoremove' to remove them.
The following packages will be upgraded:
  nginx
1 upgraded, 0 newly installed, 0 to remove and 168 not upgraded.
Need to get 0 B/466 kB of archives.
After this operation, 904 kB of additional disk space will be used.
(Reading database ... 47117 files and directories currently installed.)
Preparing to replace nginx 1.1.19-1ubuntu0.6 (using .../nginx_1.7.6-1~precise_i386.deb) ...
Unpacking replacement nginx ...
dpkg: error processing /var/cache/apt/archives/nginx_1.7.6-1~precise_i386.deb (--unpack):
 trying to overwrite '/usr/sbin/nginx', which is also in package nginx-full 1.1.19-1ubuntu0.6
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.7.6-1~precise_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

存在什么问题?如何解决?

答案1

您可能正在尝试使用 nginx 上游源代码存储库。不幸的是,如果您只是尝试升级软件包并获得与 Ubuntu/Debian 相同的功能,这些软件包将无法工作。

NGINX 团队(或者说是我本人)维护 nginx 主线分支的 PPA,并使用 Debian 软件包作为打包的基础。该 PPA 位于这里。您可以使用 添加它sudo add-apt-repository ppa:nginx/development,然后只需执行此操作即可sudo apt-get update; sudo apt-get upgrade将其升级到 Mainline PPA 中的 Mainline 版本。

您遇到的安装错误是因为 Ubuntu 中的软件包与上游软件包不一致,因为它们的打包方式不同,并且过去彼此发生过冲突。通过坚持使用 PPA 而不是上游 nginx.org 存储库,您将不会遇到此升级失败。

相关内容