Apt-get fails on 16.04 or 18.04 installing mongodb











up vote
14
down vote

favorite
8












When I attempt to install mongodb using the instructions on https://docs.mongodb.com/getting-started/shell/tutorial/install-mongodb-on-ubuntu/ on 16.04 I get the following result on the install step:



jonathan@poseidon:~$ sudo apt-get install mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mongodb-org is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mongodb-org' has no installation candidate


I checked the HTTP traffic with Wireshark and found that the only traffic was a HTTP GET for the list and a HTTP 304 response which suggests that the problem lies in my local configuration files. My sources.list.d file contains the following entry:



mongodb-org-3.4.list


What do I need to do to continue to troubleshoot this problem?



EDIT:
I tried to do this again on a new install of 16.04 under VirtualBox. I retrieved the key, created the list file, and did sudo apt update with the following results:



jonathan@Ubuntu-16:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
[sudo] password for jonathan:
Executing: /tmp/tmp.uWYpRUWfjK/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
gpg: key A15703C6: public key "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
jonathan@Ubuntu-16:~$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse
jonathan@Ubuntu-16:~$ sudo apt update
Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 InRelease
Get:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release [3 462 B]
Hit:3 http://mx.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg [801 B]
Get:6 http://mx.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Ign:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg
Get:7 http://mx.archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]
Reading package lists... Done
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D68FA50FEA312927
E: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
jonathan@Ubuntu-16:~$


As you can see, the key retrieved was for Mongodb 3.4, not Mongodb 3.2 and this explains the GPG failure in apt update. Any one know where to get the correct key?










share|improve this question
























  • My answer below is for MongoDB 3.2. The steps install the key for 3.2.
    – Terrance
    Oct 28 '16 at 23:19















up vote
14
down vote

favorite
8












When I attempt to install mongodb using the instructions on https://docs.mongodb.com/getting-started/shell/tutorial/install-mongodb-on-ubuntu/ on 16.04 I get the following result on the install step:



jonathan@poseidon:~$ sudo apt-get install mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mongodb-org is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mongodb-org' has no installation candidate


I checked the HTTP traffic with Wireshark and found that the only traffic was a HTTP GET for the list and a HTTP 304 response which suggests that the problem lies in my local configuration files. My sources.list.d file contains the following entry:



mongodb-org-3.4.list


What do I need to do to continue to troubleshoot this problem?



EDIT:
I tried to do this again on a new install of 16.04 under VirtualBox. I retrieved the key, created the list file, and did sudo apt update with the following results:



jonathan@Ubuntu-16:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
[sudo] password for jonathan:
Executing: /tmp/tmp.uWYpRUWfjK/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
gpg: key A15703C6: public key "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
jonathan@Ubuntu-16:~$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse
jonathan@Ubuntu-16:~$ sudo apt update
Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 InRelease
Get:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release [3 462 B]
Hit:3 http://mx.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg [801 B]
Get:6 http://mx.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Ign:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg
Get:7 http://mx.archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]
Reading package lists... Done
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D68FA50FEA312927
E: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
jonathan@Ubuntu-16:~$


As you can see, the key retrieved was for Mongodb 3.4, not Mongodb 3.2 and this explains the GPG failure in apt update. Any one know where to get the correct key?










share|improve this question
























  • My answer below is for MongoDB 3.2. The steps install the key for 3.2.
    – Terrance
    Oct 28 '16 at 23:19













up vote
14
down vote

favorite
8









up vote
14
down vote

favorite
8






8





When I attempt to install mongodb using the instructions on https://docs.mongodb.com/getting-started/shell/tutorial/install-mongodb-on-ubuntu/ on 16.04 I get the following result on the install step:



jonathan@poseidon:~$ sudo apt-get install mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mongodb-org is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mongodb-org' has no installation candidate


I checked the HTTP traffic with Wireshark and found that the only traffic was a HTTP GET for the list and a HTTP 304 response which suggests that the problem lies in my local configuration files. My sources.list.d file contains the following entry:



mongodb-org-3.4.list


What do I need to do to continue to troubleshoot this problem?



EDIT:
I tried to do this again on a new install of 16.04 under VirtualBox. I retrieved the key, created the list file, and did sudo apt update with the following results:



jonathan@Ubuntu-16:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
[sudo] password for jonathan:
Executing: /tmp/tmp.uWYpRUWfjK/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
gpg: key A15703C6: public key "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
jonathan@Ubuntu-16:~$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse
jonathan@Ubuntu-16:~$ sudo apt update
Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 InRelease
Get:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release [3 462 B]
Hit:3 http://mx.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg [801 B]
Get:6 http://mx.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Ign:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg
Get:7 http://mx.archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]
Reading package lists... Done
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D68FA50FEA312927
E: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
jonathan@Ubuntu-16:~$


As you can see, the key retrieved was for Mongodb 3.4, not Mongodb 3.2 and this explains the GPG failure in apt update. Any one know where to get the correct key?










share|improve this question















When I attempt to install mongodb using the instructions on https://docs.mongodb.com/getting-started/shell/tutorial/install-mongodb-on-ubuntu/ on 16.04 I get the following result on the install step:



jonathan@poseidon:~$ sudo apt-get install mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mongodb-org is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mongodb-org' has no installation candidate


I checked the HTTP traffic with Wireshark and found that the only traffic was a HTTP GET for the list and a HTTP 304 response which suggests that the problem lies in my local configuration files. My sources.list.d file contains the following entry:



mongodb-org-3.4.list


What do I need to do to continue to troubleshoot this problem?



EDIT:
I tried to do this again on a new install of 16.04 under VirtualBox. I retrieved the key, created the list file, and did sudo apt update with the following results:



jonathan@Ubuntu-16:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
[sudo] password for jonathan:
Executing: /tmp/tmp.uWYpRUWfjK/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
0C49F3730359A14518585931BC711F9BA15703C6
gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
gpg: key A15703C6: public key "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
jonathan@Ubuntu-16:~$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse
jonathan@Ubuntu-16:~$ sudo apt update
Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 InRelease
Get:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release [3 462 B]
Hit:3 http://mx.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg [801 B]
Get:6 http://mx.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Ign:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release.gpg
Get:7 http://mx.archive.ubuntu.com/ubuntu xenial-backports InRelease [92.2 kB]
Reading package lists... Done
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D68FA50FEA312927
E: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
jonathan@Ubuntu-16:~$


As you can see, the key retrieved was for Mongodb 3.4, not Mongodb 3.2 and this explains the GPG failure in apt update. Any one know where to get the correct key?







apt 16.04 package-management mongodb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 at 10:13









amin arghavani

1035




1035










asked Oct 27 '16 at 21:35









Jonathan

5332619




5332619












  • My answer below is for MongoDB 3.2. The steps install the key for 3.2.
    – Terrance
    Oct 28 '16 at 23:19


















  • My answer below is for MongoDB 3.2. The steps install the key for 3.2.
    – Terrance
    Oct 28 '16 at 23:19
















My answer below is for MongoDB 3.2. The steps install the key for 3.2.
– Terrance
Oct 28 '16 at 23:19




My answer below is for MongoDB 3.2. The steps install the key for 3.2.
– Terrance
Oct 28 '16 at 23:19










3 Answers
3






active

oldest

votes

















up vote
35
down vote



accepted










NOTE: These instructions are for MongoDB 3.2.





Let's redo the installation steps for MongoDB.



First, remove any existing repository file for MongoDB.



sudo rm /etc/apt/sources.list.d/mongodb*.list


Next, add the key: (without the key, the repository will not load)



sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927


Now, create a new MongoDB repository list file:



sudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list'


Complete the installation with update of repositories then install:



sudo apt update
sudo apt install mongodb-org




Ubuntu 18.04 and MongoDB 4.0



MongoDB 4.0 is shown as stable where 4.1 is as unstable at the moment.



First, remove MongoDB from previous if installed:



sudo apt remove --autoremove mongodb-org


Remove any mongodb repo list files:



sudo rm /etc/apt/sources.list.d/mongodb*.list
sudo apt update


Now, add the new key:



sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4


Add the new repository:



sudo bash -c 'echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'


Install MongoDB



sudo apt update
sudo apt install mongodb-org


Enable and start the mongod server service:



systemctl enable mongod.service
systemctl start mongod.service


Check your installation:



~$ mongo --version
MongoDB shell version v4.0.3
git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1804
distarch: x86_64
target_arch: x86_64


You can also check your service has started:



~$ systemctl status mongod.service
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
Active: active (running) since Sun 2018-10-07 12:33:46 MDT; 2min 34s ago
Docs: https://docs.mongodb.org/manual
Main PID: 5573 (mongod)
CGroup: /system.slice/mongod.service
└─5573 /usr/bin/mongod --config /etc/mongod.conf


Hope this helps!






share|improve this answer























  • Thanks for this. Getting the right key was the critical part.
    – Jonathan
    Oct 29 '16 at 0:14










  • gpg: keyserver receive failed: Server indicated a failure
    – Máxima Alekz
    Oct 13 '17 at 14:31










  • @MáximaAlekz Check my answer.
    – Tpojka
    Feb 14 at 12:52










  • Thanks a lot, @Terrance. You saved me a lot of time.
    – Anirudh Thatipelli
    Oct 7 at 13:26


















up vote
6
down vote













In addition to @Terrance 's answer, here is how you can find appropriate sig key. Example is applicable to mongodb in this case but can be used for any other package similarly. Before you execute lines from @Terrance 's answer:




  1. Go to ubuntu key server to find actual key


  2. Search for string of interest (mongodb in case) and submit that first form (you don't need second form for this) - click Search! button



enter image description here




  1. On provided search list seek for your version (it was 3.4 in my case here in example)


enter image description here




  1. You can see two rows with keys there. Focus on most actual by date. First string is date created while second one is date valid due.


  2. Use sig from row mentioned in point 5 - in case from picture it would be A15703C6


  3. Continue with Terrance 's answer wether you need to install package or upgrade like myself







share|improve this answer




























    up vote
    0
    down vote













    Nothing worked for me either, so I went to the mogodb website and followed these instructions to install from tarball:



    Install dependencies:



    sudo apt-get install libcurl3 openssl


    Download the tarball from this page



    cd to the Downloads directory or wherever the file went, and extract it:



    tar -zxvf mongodb-linux-*-4.0.1.tgz


    The binaries are in the bin directory of the extracted structure. You can add this directory to PATH or copy the files to /usr/local/bin or another PATH location.






    share|improve this answer























    • You installed a different version then what was listed above at the time so the answers will not have worked for you. I have updated my answer since. For each version the key changes and the repository changes. I will try to keep my answer updated for new stable versions as they come out.
      – Terrance
      Sep 14 at 14:02











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f842592%2fapt-get-fails-on-16-04-or-18-04-installing-mongodb%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    35
    down vote



    accepted










    NOTE: These instructions are for MongoDB 3.2.





    Let's redo the installation steps for MongoDB.



    First, remove any existing repository file for MongoDB.



    sudo rm /etc/apt/sources.list.d/mongodb*.list


    Next, add the key: (without the key, the repository will not load)



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927


    Now, create a new MongoDB repository list file:



    sudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list'


    Complete the installation with update of repositories then install:



    sudo apt update
    sudo apt install mongodb-org




    Ubuntu 18.04 and MongoDB 4.0



    MongoDB 4.0 is shown as stable where 4.1 is as unstable at the moment.



    First, remove MongoDB from previous if installed:



    sudo apt remove --autoremove mongodb-org


    Remove any mongodb repo list files:



    sudo rm /etc/apt/sources.list.d/mongodb*.list
    sudo apt update


    Now, add the new key:



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4


    Add the new repository:



    sudo bash -c 'echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'


    Install MongoDB



    sudo apt update
    sudo apt install mongodb-org


    Enable and start the mongod server service:



    systemctl enable mongod.service
    systemctl start mongod.service


    Check your installation:



    ~$ mongo --version
    MongoDB shell version v4.0.3
    git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
    OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
    allocator: tcmalloc
    modules: none
    build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64


    You can also check your service has started:



    ~$ systemctl status mongod.service
    ● mongod.service - MongoDB Database Server
    Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
    Active: active (running) since Sun 2018-10-07 12:33:46 MDT; 2min 34s ago
    Docs: https://docs.mongodb.org/manual
    Main PID: 5573 (mongod)
    CGroup: /system.slice/mongod.service
    └─5573 /usr/bin/mongod --config /etc/mongod.conf


    Hope this helps!






    share|improve this answer























    • Thanks for this. Getting the right key was the critical part.
      – Jonathan
      Oct 29 '16 at 0:14










    • gpg: keyserver receive failed: Server indicated a failure
      – Máxima Alekz
      Oct 13 '17 at 14:31










    • @MáximaAlekz Check my answer.
      – Tpojka
      Feb 14 at 12:52










    • Thanks a lot, @Terrance. You saved me a lot of time.
      – Anirudh Thatipelli
      Oct 7 at 13:26















    up vote
    35
    down vote



    accepted










    NOTE: These instructions are for MongoDB 3.2.





    Let's redo the installation steps for MongoDB.



    First, remove any existing repository file for MongoDB.



    sudo rm /etc/apt/sources.list.d/mongodb*.list


    Next, add the key: (without the key, the repository will not load)



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927


    Now, create a new MongoDB repository list file:



    sudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list'


    Complete the installation with update of repositories then install:



    sudo apt update
    sudo apt install mongodb-org




    Ubuntu 18.04 and MongoDB 4.0



    MongoDB 4.0 is shown as stable where 4.1 is as unstable at the moment.



    First, remove MongoDB from previous if installed:



    sudo apt remove --autoremove mongodb-org


    Remove any mongodb repo list files:



    sudo rm /etc/apt/sources.list.d/mongodb*.list
    sudo apt update


    Now, add the new key:



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4


    Add the new repository:



    sudo bash -c 'echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'


    Install MongoDB



    sudo apt update
    sudo apt install mongodb-org


    Enable and start the mongod server service:



    systemctl enable mongod.service
    systemctl start mongod.service


    Check your installation:



    ~$ mongo --version
    MongoDB shell version v4.0.3
    git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
    OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
    allocator: tcmalloc
    modules: none
    build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64


    You can also check your service has started:



    ~$ systemctl status mongod.service
    ● mongod.service - MongoDB Database Server
    Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
    Active: active (running) since Sun 2018-10-07 12:33:46 MDT; 2min 34s ago
    Docs: https://docs.mongodb.org/manual
    Main PID: 5573 (mongod)
    CGroup: /system.slice/mongod.service
    └─5573 /usr/bin/mongod --config /etc/mongod.conf


    Hope this helps!






    share|improve this answer























    • Thanks for this. Getting the right key was the critical part.
      – Jonathan
      Oct 29 '16 at 0:14










    • gpg: keyserver receive failed: Server indicated a failure
      – Máxima Alekz
      Oct 13 '17 at 14:31










    • @MáximaAlekz Check my answer.
      – Tpojka
      Feb 14 at 12:52










    • Thanks a lot, @Terrance. You saved me a lot of time.
      – Anirudh Thatipelli
      Oct 7 at 13:26













    up vote
    35
    down vote



    accepted







    up vote
    35
    down vote



    accepted






    NOTE: These instructions are for MongoDB 3.2.





    Let's redo the installation steps for MongoDB.



    First, remove any existing repository file for MongoDB.



    sudo rm /etc/apt/sources.list.d/mongodb*.list


    Next, add the key: (without the key, the repository will not load)



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927


    Now, create a new MongoDB repository list file:



    sudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list'


    Complete the installation with update of repositories then install:



    sudo apt update
    sudo apt install mongodb-org




    Ubuntu 18.04 and MongoDB 4.0



    MongoDB 4.0 is shown as stable where 4.1 is as unstable at the moment.



    First, remove MongoDB from previous if installed:



    sudo apt remove --autoremove mongodb-org


    Remove any mongodb repo list files:



    sudo rm /etc/apt/sources.list.d/mongodb*.list
    sudo apt update


    Now, add the new key:



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4


    Add the new repository:



    sudo bash -c 'echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'


    Install MongoDB



    sudo apt update
    sudo apt install mongodb-org


    Enable and start the mongod server service:



    systemctl enable mongod.service
    systemctl start mongod.service


    Check your installation:



    ~$ mongo --version
    MongoDB shell version v4.0.3
    git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
    OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
    allocator: tcmalloc
    modules: none
    build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64


    You can also check your service has started:



    ~$ systemctl status mongod.service
    ● mongod.service - MongoDB Database Server
    Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
    Active: active (running) since Sun 2018-10-07 12:33:46 MDT; 2min 34s ago
    Docs: https://docs.mongodb.org/manual
    Main PID: 5573 (mongod)
    CGroup: /system.slice/mongod.service
    └─5573 /usr/bin/mongod --config /etc/mongod.conf


    Hope this helps!






    share|improve this answer














    NOTE: These instructions are for MongoDB 3.2.





    Let's redo the installation steps for MongoDB.



    First, remove any existing repository file for MongoDB.



    sudo rm /etc/apt/sources.list.d/mongodb*.list


    Next, add the key: (without the key, the repository will not load)



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927


    Now, create a new MongoDB repository list file:



    sudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list'


    Complete the installation with update of repositories then install:



    sudo apt update
    sudo apt install mongodb-org




    Ubuntu 18.04 and MongoDB 4.0



    MongoDB 4.0 is shown as stable where 4.1 is as unstable at the moment.



    First, remove MongoDB from previous if installed:



    sudo apt remove --autoremove mongodb-org


    Remove any mongodb repo list files:



    sudo rm /etc/apt/sources.list.d/mongodb*.list
    sudo apt update


    Now, add the new key:



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4


    Add the new repository:



    sudo bash -c 'echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'


    Install MongoDB



    sudo apt update
    sudo apt install mongodb-org


    Enable and start the mongod server service:



    systemctl enable mongod.service
    systemctl start mongod.service


    Check your installation:



    ~$ mongo --version
    MongoDB shell version v4.0.3
    git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
    OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017
    allocator: tcmalloc
    modules: none
    build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64


    You can also check your service has started:



    ~$ systemctl status mongod.service
    ● mongod.service - MongoDB Database Server
    Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
    Active: active (running) since Sun 2018-10-07 12:33:46 MDT; 2min 34s ago
    Docs: https://docs.mongodb.org/manual
    Main PID: 5573 (mongod)
    CGroup: /system.slice/mongod.service
    └─5573 /usr/bin/mongod --config /etc/mongod.conf


    Hope this helps!







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 19 at 19:04

























    answered Oct 27 '16 at 22:04









    Terrance

    18.3k24091




    18.3k24091












    • Thanks for this. Getting the right key was the critical part.
      – Jonathan
      Oct 29 '16 at 0:14










    • gpg: keyserver receive failed: Server indicated a failure
      – Máxima Alekz
      Oct 13 '17 at 14:31










    • @MáximaAlekz Check my answer.
      – Tpojka
      Feb 14 at 12:52










    • Thanks a lot, @Terrance. You saved me a lot of time.
      – Anirudh Thatipelli
      Oct 7 at 13:26


















    • Thanks for this. Getting the right key was the critical part.
      – Jonathan
      Oct 29 '16 at 0:14










    • gpg: keyserver receive failed: Server indicated a failure
      – Máxima Alekz
      Oct 13 '17 at 14:31










    • @MáximaAlekz Check my answer.
      – Tpojka
      Feb 14 at 12:52










    • Thanks a lot, @Terrance. You saved me a lot of time.
      – Anirudh Thatipelli
      Oct 7 at 13:26
















    Thanks for this. Getting the right key was the critical part.
    – Jonathan
    Oct 29 '16 at 0:14




    Thanks for this. Getting the right key was the critical part.
    – Jonathan
    Oct 29 '16 at 0:14












    gpg: keyserver receive failed: Server indicated a failure
    – Máxima Alekz
    Oct 13 '17 at 14:31




    gpg: keyserver receive failed: Server indicated a failure
    – Máxima Alekz
    Oct 13 '17 at 14:31












    @MáximaAlekz Check my answer.
    – Tpojka
    Feb 14 at 12:52




    @MáximaAlekz Check my answer.
    – Tpojka
    Feb 14 at 12:52












    Thanks a lot, @Terrance. You saved me a lot of time.
    – Anirudh Thatipelli
    Oct 7 at 13:26




    Thanks a lot, @Terrance. You saved me a lot of time.
    – Anirudh Thatipelli
    Oct 7 at 13:26












    up vote
    6
    down vote













    In addition to @Terrance 's answer, here is how you can find appropriate sig key. Example is applicable to mongodb in this case but can be used for any other package similarly. Before you execute lines from @Terrance 's answer:




    1. Go to ubuntu key server to find actual key


    2. Search for string of interest (mongodb in case) and submit that first form (you don't need second form for this) - click Search! button



    enter image description here




    1. On provided search list seek for your version (it was 3.4 in my case here in example)


    enter image description here




    1. You can see two rows with keys there. Focus on most actual by date. First string is date created while second one is date valid due.


    2. Use sig from row mentioned in point 5 - in case from picture it would be A15703C6


    3. Continue with Terrance 's answer wether you need to install package or upgrade like myself







    share|improve this answer

























      up vote
      6
      down vote













      In addition to @Terrance 's answer, here is how you can find appropriate sig key. Example is applicable to mongodb in this case but can be used for any other package similarly. Before you execute lines from @Terrance 's answer:




      1. Go to ubuntu key server to find actual key


      2. Search for string of interest (mongodb in case) and submit that first form (you don't need second form for this) - click Search! button



      enter image description here




      1. On provided search list seek for your version (it was 3.4 in my case here in example)


      enter image description here




      1. You can see two rows with keys there. Focus on most actual by date. First string is date created while second one is date valid due.


      2. Use sig from row mentioned in point 5 - in case from picture it would be A15703C6


      3. Continue with Terrance 's answer wether you need to install package or upgrade like myself







      share|improve this answer























        up vote
        6
        down vote










        up vote
        6
        down vote









        In addition to @Terrance 's answer, here is how you can find appropriate sig key. Example is applicable to mongodb in this case but can be used for any other package similarly. Before you execute lines from @Terrance 's answer:




        1. Go to ubuntu key server to find actual key


        2. Search for string of interest (mongodb in case) and submit that first form (you don't need second form for this) - click Search! button



        enter image description here




        1. On provided search list seek for your version (it was 3.4 in my case here in example)


        enter image description here




        1. You can see two rows with keys there. Focus on most actual by date. First string is date created while second one is date valid due.


        2. Use sig from row mentioned in point 5 - in case from picture it would be A15703C6


        3. Continue with Terrance 's answer wether you need to install package or upgrade like myself







        share|improve this answer












        In addition to @Terrance 's answer, here is how you can find appropriate sig key. Example is applicable to mongodb in this case but can be used for any other package similarly. Before you execute lines from @Terrance 's answer:




        1. Go to ubuntu key server to find actual key


        2. Search for string of interest (mongodb in case) and submit that first form (you don't need second form for this) - click Search! button



        enter image description here




        1. On provided search list seek for your version (it was 3.4 in my case here in example)


        enter image description here




        1. You can see two rows with keys there. Focus on most actual by date. First string is date created while second one is date valid due.


        2. Use sig from row mentioned in point 5 - in case from picture it would be A15703C6


        3. Continue with Terrance 's answer wether you need to install package or upgrade like myself








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 14 at 12:52









        Tpojka

        16113




        16113






















            up vote
            0
            down vote













            Nothing worked for me either, so I went to the mogodb website and followed these instructions to install from tarball:



            Install dependencies:



            sudo apt-get install libcurl3 openssl


            Download the tarball from this page



            cd to the Downloads directory or wherever the file went, and extract it:



            tar -zxvf mongodb-linux-*-4.0.1.tgz


            The binaries are in the bin directory of the extracted structure. You can add this directory to PATH or copy the files to /usr/local/bin or another PATH location.






            share|improve this answer























            • You installed a different version then what was listed above at the time so the answers will not have worked for you. I have updated my answer since. For each version the key changes and the repository changes. I will try to keep my answer updated for new stable versions as they come out.
              – Terrance
              Sep 14 at 14:02















            up vote
            0
            down vote













            Nothing worked for me either, so I went to the mogodb website and followed these instructions to install from tarball:



            Install dependencies:



            sudo apt-get install libcurl3 openssl


            Download the tarball from this page



            cd to the Downloads directory or wherever the file went, and extract it:



            tar -zxvf mongodb-linux-*-4.0.1.tgz


            The binaries are in the bin directory of the extracted structure. You can add this directory to PATH or copy the files to /usr/local/bin or another PATH location.






            share|improve this answer























            • You installed a different version then what was listed above at the time so the answers will not have worked for you. I have updated my answer since. For each version the key changes and the repository changes. I will try to keep my answer updated for new stable versions as they come out.
              – Terrance
              Sep 14 at 14:02













            up vote
            0
            down vote










            up vote
            0
            down vote









            Nothing worked for me either, so I went to the mogodb website and followed these instructions to install from tarball:



            Install dependencies:



            sudo apt-get install libcurl3 openssl


            Download the tarball from this page



            cd to the Downloads directory or wherever the file went, and extract it:



            tar -zxvf mongodb-linux-*-4.0.1.tgz


            The binaries are in the bin directory of the extracted structure. You can add this directory to PATH or copy the files to /usr/local/bin or another PATH location.






            share|improve this answer














            Nothing worked for me either, so I went to the mogodb website and followed these instructions to install from tarball:



            Install dependencies:



            sudo apt-get install libcurl3 openssl


            Download the tarball from this page



            cd to the Downloads directory or wherever the file went, and extract it:



            tar -zxvf mongodb-linux-*-4.0.1.tgz


            The binaries are in the bin directory of the extracted structure. You can add this directory to PATH or copy the files to /usr/local/bin or another PATH location.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Aug 21 at 7:21









            Zanna

            49.1k13123234




            49.1k13123234










            answered Aug 19 at 21:58









            VishalTheBeast

            1




            1












            • You installed a different version then what was listed above at the time so the answers will not have worked for you. I have updated my answer since. For each version the key changes and the repository changes. I will try to keep my answer updated for new stable versions as they come out.
              – Terrance
              Sep 14 at 14:02


















            • You installed a different version then what was listed above at the time so the answers will not have worked for you. I have updated my answer since. For each version the key changes and the repository changes. I will try to keep my answer updated for new stable versions as they come out.
              – Terrance
              Sep 14 at 14:02
















            You installed a different version then what was listed above at the time so the answers will not have worked for you. I have updated my answer since. For each version the key changes and the repository changes. I will try to keep my answer updated for new stable versions as they come out.
            – Terrance
            Sep 14 at 14:02




            You installed a different version then what was listed above at the time so the answers will not have worked for you. I have updated my answer since. For each version the key changes and the repository changes. I will try to keep my answer updated for new stable versions as they come out.
            – Terrance
            Sep 14 at 14:02


















             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f842592%2fapt-get-fails-on-16-04-or-18-04-installing-mongodb%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents