Type 'echo' is not known on line 1 in source list /etc/apt/sources.list.d/mongodb-org-3.2.list

12,634

You are nearly there.

In order to install MongoDB and keep up with updates, you need to create a file in /etc/apt/sources.list.d (you did that) and add a single line to it. To make adding that line easier for you, the authors of the installation instructions provided a one-line command that would do that. You should have copied that command and executed it in a terminal. What you did instead was editing the file and pasting the whole command in it. The apt command will obviously not accept that. What you need to do is either:

  1. delete the file, recreate the empty file, and execute the command (with sudo in front of it, I should mention); or
  2. edit the file, strip away everything around deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse, and save the file.
Share:
12,634

Related videos on Youtube

Atul Makwana
Author by

Atul Makwana

Updated on September 18, 2022

Comments

  • Atul Makwana
    Atul Makwana over 1 year

    I am trying to install mongodb on the ubuntu server 16.04 LTS.

    for that I have created file /etc/apt/sources.list.d/mongodb-org-3.2.list and added a line as per the doc.

    echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
    

    Now when I try to download the package list using sudo apt-get update it is giving me below error.

    nodev@ubuntu:/etc/apt/sources.list.d$ sudo apt-get update
    E: Type 'echo' is not known on line 1 in source list /etc/apt/sources.list.d/mongodb-org-3.2.list
    E: The list of sources could not be read.