Error installing NGINX package on ubuntu 18.04

5,630

You already have nginx installed so you have to remove that version to be able to build and install from source.

  1. Check for the new install of nginx and remove it

    dpkg -l nginx*
    
    • You should see the version 1.14.2, remove it with sudo dpkg remove nginx-1.14.2, and be sure you use the right version number.
  2. Now do sudo apt update and sudo apt upgrade to make sure they are no issues.

  3. Now remove the old version sudo apt purge <nginx-1.14.0>

  4. Now build that new version and install and if any issues run sudo apt install -f
Share:
5,630

Related videos on Youtube

sachin makwana
Author by

sachin makwana

Updated on September 18, 2022

Comments

  • sachin makwana
    sachin makwana over 1 year

    I am new to Ubuntu. I need to enable brotli compression on nginx server.

    I am trying to install NGINX with BROTLI from the below link. https://www.howtoforge.com/tutorial/how-to-install-nginx-with-brotli-compression-on-ubuntu-1804/

    when I am trying to install build package as per the link I am getting error.

    root@sachin-virtual-machine:/usr/local/src# ls
    nginx-1.14.2                           nginx_1.14.2-1~bionic.dsc
    nginx_1.14.2-1~bionic_amd64.buildinfo  nginx_1.14.2.orig.tar.gz
    nginx_1.14.2-1~bionic_amd64.changes    nginx-dbg_1.14.2-1~bionic_amd64.deb
    nginx_1.14.2-1~bionic_amd64.deb        ngx_brotli
    nginx_1.14.2-1~bionic.debian.tar.xz
    root@sachin-virtual-machine:/usr/local/src# sudo dpkg -i *.deb
    dpkg: regarding nginx_1.14.2-1~bionic_amd64.deb containing nginx:
    nginx conflicts with nginx-common
    nginx-common (version 1.14.0-0ubuntu1.2) is present and installed.
    
    dpkg: error processing archive nginx_1.14.2-1~bionic_amd64.deb (--install):
    conflicting packages - not installing nginx
    (Reading database ... 175249 files and directories currently installed.)
    Preparing to unpack nginx-dbg_1.14.2-1~bionic_amd64.deb ...
    Unpacking nginx-dbg (1.14.2-1~bionic) over (1.14.2-1~bionic) ...
    dpkg: dependency problems prevent configuration of nginx-dbg:
    nginx-dbg depends on nginx (= 1.14.2-1~bionic); however:
    Version of nginx on system is 1.14.0-0ubuntu1.2.
    Version of nginx on system, provided by nginx-core:amd64, is <none>.
    
    dpkg: error processing package nginx-dbg (--install):
    dependency problems - leaving unconfigured
    Errors were encountered while processing:
    nginx_1.14.2-1~bionic_amd64.deb
    nginx-dbg
    root@sachin-virtual-machine:/usr/local/src#
    

    Please guide me with this.

    • George Udosen
      George Udosen over 5 years
      You are trying to install a different version of nginx from the one installed on your system!
    • George Udosen
      George Udosen over 5 years
      Are you not aware that you have nginx already installed? Remove that other installed version and then build and install from source!
    • user535733
      user535733 over 5 years
      Why are you using 'sudo' when you already seem to be root?
    • sachin makwana
      sachin makwana over 5 years
      @user535733 its just copy paste so forgot to remove sudo
  • sachin makwana
    sachin makwana over 5 years
    this worked and I was able to install the package. but now I am getting following error. root@sachin-virtual-machine:/etc/nginx# nginx -t nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/nginx.hakase-labs.io/ful‌​lchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/nginx.hakase-labs.io/‌​fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file) nginx: configuration file /etc/nginx/nginx.conf test failed
  • George Udosen
    George Udosen over 5 years
    This is a different question but do you have letsencrypt installed on nginx?
  • sachin makwana
    sachin makwana over 5 years
    No it wasnt'. For the localhost I needed to generate and configure own-signed privatekey and certificate. I did it and website is working fine in local environment.