Jul*_*0sS 3 dpkg apt software-installation package-management nginx
我刚刚在虚拟机上安装了最新的 Debian 版本 (8.4),一切正常。
然后我从 Debian repos 安装了 nginx 服务器,我得到了 1.6.2 版,而可用的最新版本是 1.10,所以我想更新它。
我尝试这样做的方式可能是错误的,但这就是我迄今为止所发现的。
我首先通过以sources.list
这种方式将 nginx 存储库添加到文件中来更新我的存储库:
sudo sh -c "echo 'deb http://nginx.org/packages/debian/ `lsb_release -cs` nginx' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb-src http://nginx.org/packages/debian/ `lsb_release -cs` nginx' >> /etc/apt/sources.list"
curl http://nginx.org/keys/nginx_signing.key | apt-key add -
sudo apt-get update
Run Code Online (Sandbox Code Playgroud)
然后,我尝试使用以下命令安装最新的 nginx 版本:
sudo apt-get install nginx
Run Code Online (Sandbox Code Playgroud)
我得到这个问题:
root@Debian:/#LANG=C apt-get install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
nginx-common nginx-full
Use 'apt-get autoremove' to remove them.
The following packages will be upgraded:
nginx
1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/739 kB of archives.
After this operation, 2421 kB of additional disk space will be used.
Reading changelogs... Done
(Reading database ... 140333 files and directories currently installed.)
Preparing to unpack .../nginx_1.10.0-1~jessie_i386.deb ...
Unpacking nginx (1.10.0-1~jessie) over (1.6.2-5+deb8u1) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.10.0-1~jessie_i386.deb (--unpack): trying to overwrite '/etc/default/nginx', which is also in package nginx-common 1.6.2-5+deb8u1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nginx_1.10.0-1~jessie_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
基本错误是这样的(强调我的):
dpkg: error processing archive /var/cache/apt/archives/nginx_1.10.0-1~jessie_i386.deb (--unpack):试图覆盖'/etc/default/nginx',它也在 nginx-common 1.6 包中.2-5+deb8u1
这意味着您正在安装的新软件包试图覆盖另一个软件包(您安装的nginx-common
)提供的文件,并且dpkg
担心会破坏东西并拒绝这样做。
简单的解决方案是完全删除nginx-common
软件包,然后再次安装新版本:
sudo apt-get purge nginx-common
sudo apt-get install nginx
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8482 次 |
最近记录: |