Updating Nginx server to 1.10 on Debian 8.4

8,494

The basic error is this (emphasis mine):

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

This means that the new package you are installing is trying to overwrite a file provided by another package (your installed nginx-common ) and dpkg is afraid that will break stuff and refuses to do it.

The simple solution is to completely remove nginx-common packages and then install the new version again:

sudo apt-get purge nginx-common
sudo apt-get install nginx
Share:
8,494

Related videos on Youtube

Julo0sS
Author by

Julo0sS

Updated on September 18, 2022

Comments

  • Julo0sS
    Julo0sS over 1 year

    I just installed the latest Debian version (8.4) on a virtual machine, and everything went fine.

    I then installed nginx server from the Debian repos and I got version 1.6.2, while the latest version available is 1.10, so I'd like to update it.

    The way I tried to do it is maybe wrong but it's all I've found so far.

    I first updated my repositories by adding the nginx repo to the sources.list file this way :

    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
    

    Then, I tried to install latest nginx version with this command:

    sudo apt-get install nginx
    

    And I get this issue :

    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)
    

    How can I solve this?