I tried following command to install module but did not work.
$ sudo apt-get install nginx-module-njs
Here is some background:
VirtualMachine: Yes
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
$ uname -a
Linux teomanship-VirtualBox 4.15.0-42-generic #45-Ubuntu SMP
Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
I added following lines in /etc/apt/sources.list
deb http://nginx.org/packages/mainline/ubuntu/ bionic nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ bionic nginx
Full command log:
root@teomanship-VirtualBox:/home/teomanship/Downloads# sudo apt-get install nginx-module-njs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
nginx
The following packages will be REMOVED:
libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream nginx-common nginx-core
The following NEW packages will be installed:
nginx-module-njs
The following packages will be upgraded:
nginx
1 upgraded, 1 newly installed, 7 to remove and 1 not upgraded.
Need to get 0 B/1,051 kB of archives.
After this operation, 2,717 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: libnginx-mod-http-geoip: dependency problems, but removing anyway as you requested:
nginx-core depends on libnginx-mod-http-geoip (= 1.14.0-0ubuntu1.2).
(Reading database ... 163180 files and directories currently installed.)
Removing libnginx-mod-http-geoip (1.14.0-0ubuntu1.2) ...
dpkg: nginx-common: dependency problems, but removing anyway as you requested:
libnginx-mod-http-xslt-filter depends on nginx-common (= 1.14.0-0ubuntu1.2).
nginx-core depends on nginx-common (= 1.14.0-0ubuntu1.2); however:
Package nginx-common is to be removed.
libnginx-mod-mail depends on nginx-common (= 1.14.0-0ubuntu1.2).
libnginx-mod-http-image-filter depends on nginx-common (= 1.14.0-0ubuntu1.2).
libnginx-mod-stream depends on nginx-common (= 1.14.0-0ubuntu1.2).
Removing nginx-common (1.14.0-0ubuntu1.2) ...
(Reading database ... 163156 files and directories currently installed.)
Preparing to unpack .../nginx_1.15.7-1~bionic_amd64.deb ...
Unpacking nginx (1.15.7-1~bionic) over (1.14.0-0ubuntu1.2) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.15.7-1~bionic_amd64.deb (--unpack):
trying to overwrite '/usr/sbin/nginx', which is also in package nginx-core 1.14.0-0ubuntu1.2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nginx_1.15.7-1~bionic_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Any idea to fix this issue?
Thanks!
Hello @reyou. This happens because mixing distribution-provided packages (such as Ubuntu) and nginx.org repos is not something truly supported in a sense of migration from and to. To make sure you will have no issues, I'd suggest to remove all nginx-related packages firrst (note - it will remove all your prior nginx configuration as well, so make sure to backup it if it's needed):
$ sudo cp -r /etc/nginx /etc/nginx.backup'
$ sudo apt-get remove --purge 'nginx*'
and then install the njs module:
sudo apt-get install nginx-module-njs nginx
This worked, thanks!
I'm also having problems (on Ubuntu 18.04.1). I followed @thresheek's suggestions, but got
E: Unable to locate package nginx-module-njs
I had previously done sudo add-apt-repository ppa:nginx/stable ... is there some other repository I need?
@jonpincus
I had previously done
sudo add-apt-repository ppa:nginx/stable... is there some other repository I need?
Hi, please follow the official guide.
Thanks much, that works!
The instructions on the njs download and install page could be a little clearer about this. The link to the guide that's currently there is to the dynamic modules section, so I thought it was just a description of what dynamic modules are and didn't realize that I had to follow the instructions elsewhere on the page.
Most helpful comment
Thanks much, that works!
The instructions on the njs download and install page could be a little clearer about this. The link to the guide that's currently there is to the dynamic modules section, so I thought it was just a description of what dynamic modules are and didn't realize that I had to follow the instructions elsewhere on the page.