2

I added theses lines to the "/etc/apt/sources.list":

deb http://nginx.org/packages/mainline/debian/ jessie nginx
deb-src http://nginx.org/packages/mainline/debian/ jessie nginx

After that I've tried to update nginx with:

sudo apt-get clean && sudo apt-get install nginx

But I get the following error:

Unpacking nginx (1.9.15-1~jessie) over (1.6.2-5+deb8u1) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.9.15-1~jessie_amd64.deb (--unpack):
 trying to overwrite '/usr/share/nginx/html/index.html', 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.9.15-1~jessie_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

What am I doing wrong? Thank you.

belyid
  • 331
  • 1
  • 4
  • 14

2 Answers2

3

Run the below commands on your terminal:

sudo dpkg -P nginx-common
sudo apt-get install -f

If it shows any dependency problem when uninstalling the above nginx-common package, then purge nginx-common package along with its dependencies:

sudo apt-get purge nginx*

Before running the above command, don't forget to check the dependency packages which are going to be purged along with nginx.

sudo apt-get purge -s nginx*

Then you will be able to install NGinX.

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
Yvan
  • 153
  • 6
0

After what you do as you said, before running apt-get update command, you need to get nginx’s public key: wget http://nginx.org/packages/keys/nginx_signing.key cat nginx_signing.key | apt-key add - Then update and install.

  • 1
    Could you please elaborate as to why he would have to do that? The error is pointing to something totally different. – John K. N. Jan 05 '17 at 15:45
  • I brought you back to 0-- because it is missing from his install instructions and adding the key to avoid a warning message-- and it might not even install period. I don't know, I always add the key... However, it is correct that removing the existing packages before installing the packages from the 3rd party nginx PPA. Also, note, the nginx packages do not install nginx quite the same way that the packages in the debian repos do-- a specific example is that sites-available and sites-enabled do not exist nor the include for sites-enabled/*... – BradChesney79 May 27 '17 at 03:57