將 NGINX 從 debian-buster 儲存庫更新到 nginx-repo

將 NGINX 從 debian-buster 儲存庫更新到 nginx-repo

當我嘗試將我的 nginx 版本(從 debian 存儲庫安裝)更新到 nginx 存儲庫中的最新版本時,它將失敗,因為它無法覆蓋舊 nginx 包之一中的文件(該包即將獲取)自動刪除)。這是運行命令時的 bash 輸出apt install nginx -V

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   geoip-database (20190724-1~bpo10+1)
   libgd3 (2.2.5-5.2)
   libgeoip1 (1.6.12-3~bpo10+1)
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
   libnginx-mod-http-auth-pam (1.14.2-2)
   libnginx-mod-http-dav-ext (1.14.2-2)
   libnginx-mod-http-echo (1.14.2-2)
   libnginx-mod-http-geoip (1.14.2-2)
   libnginx-mod-http-image-filter (1.14.2-2)
   libnginx-mod-http-subs-filter (1.14.2-2)
   libnginx-mod-http-upstream-fair (1.14.2-2)
   libnginx-mod-http-xslt-filter (1.14.2-2)
   libnginx-mod-mail (1.14.2-2)
   libnginx-mod-stream (1.14.2-2)
   nginx-common (1.14.2-2)
   nginx-full (1.14.2-2)
The following packages will be upgraded:
   nginx (1.14.2-2 => 1.16.1-1~buster)
1 upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
Need to get 0 B/850 kB of archives.
After this operation, 291 kB disk space will be freed.
Do you want to continue? [Y/n]
dpkg: libnginx-mod-http-auth-pam: dependency problems, but removing anyway as you requested:
 nginx-full depends on libnginx-mod-http-auth-pam (= 1.14.2-2).

(Reading database ... 152770 files and directories currently installed.)
Removing libnginx-mod-http-auth-pam (1.14.2-2) ...
dpkg: nginx-common: dependency problems, but removing anyway as you requested:
 nginx-full depends on nginx-common (= 1.14.2-2); however:
  Package nginx-common is to be removed.
 libnginx-mod-stream depends on nginx-common (= 1.14.2-2).
 libnginx-mod-mail depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-xslt-filter depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-upstream-fair depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-subs-filter depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-image-filter depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-geoip depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-echo depends on nginx-common (= 1.14.2-2).
 libnginx-mod-http-dav-ext depends on nginx-common (= 1.14.2-2).

Removing nginx-common (1.14.2-2) ...
(Reading database ... 152743 files and directories currently installed.)
Preparing to unpack .../nginx_1.16.1-1~buster_amd64.deb ...
Unpacking nginx (1.16.1-1~buster) over (1.14.2-2) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.16.1-1~buster_amd64.deb (--unpack):
 trying to overwrite '/usr/sbin/nginx', which is also in package nginx-full 1.14.2-2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nginx_1.16.1-1~buster_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

似乎不是先卸載舊軟體包,然後再安裝新軟體包。相反,它會卸載兩個軟體包,然後嘗試安裝更新的軟體包。因為在我嘗試此更新後,我需要重新安裝nginx-commonlibnginx-mod-http-auth-pam

我的問題是:有誰知道強制新安裝的方法(dist-upgrade並且--with-new-pkgs不起作用)或我需要手動卸載這些軟體包嗎?還是我只是錯過了升級之前需要執行的步驟?

答案1

不知道這是否仍然相關,但我遇到了類似的問題。對我有用的是我卸載了舊的 nginx:apt remove nginx nginx-common

然後安裝新版本:apt install nginx

如果您目前的版本有問題,您可以使用以下命令修復它apt --fix-broken install

答案2

使用這個指令。這對我有用。

sudo dpkg --purge --force-depends apache2

相關內容