0

I want to install MongoDB in ubantu 12.04, but I don't have any idea to add
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
code in
/etc/apt/sources.list
file. I used
sudo vim /etc/apt/sources.list
for this propose. But I am unable to edit the file. Does anybody know how I can resolve this issue?

Ganesh Kunwar
  • 129
  • 1
  • 6
  • What error are you getting? What "is not a success"? As indicated by parvin, the tutorial page contains everything that you need on a step-by-step basis. Apend the line "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" to the end of the /etc/apt/sources.list file. – Mark Hillick Jul 16 '12 at 08:37
  • @MarkHillick, I can't add the deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen line of code in /etc/apt/sources.list file –  Jul 16 '12 at 08:40
  • This may be due to permission problem. –  Jul 16 '12 at 08:42
  • 1
    What error do you receive? Are you not in the sudoers group? – Mark Hillick Jul 16 '12 at 08:49
  • Im installing this according to http://yoodey.com/install-mongodb-ubuntu-1204-precise-pangolin tutorials. When I follow step 2, this give me problem i.e. the line can't save in /etc/apt/sources.list file –  Jul 16 '12 at 08:57
  • 1
    Can you post a screenshot of your error? Or the text? It's too vague so far? What's the output of "ls -la /etc/apt/sources.list"? – Mark Hillick Jul 16 '12 at 09:02
  • The file "/ect/apt/sources.list" can't be edited. –  Jul 16 '12 at 09:03
  • @Ganeshkunwar did you use `sudo` when editing sources.list? – Sean Reilly Jul 16 '12 at 09:13
  • I use sudo vim /etc/apt/sources.list for this purpose. –  Jul 16 '12 at 09:15
  • @Ganesh...can you post a screenshot of your error to gist/pastie/pastebin and provide the link? Are there any sudo errors in the logs? – Mark Hillick Jul 18 '12 at 13:53
  • 1
    Please do what people ask you instead of repeating yourself. – Lucas Kauffman Jul 20 '12 at 18:36

3 Answers3

1

You can follow the instructions in the MongoDB tutorial page.

  • Those are the instructions he followed. That's where the addition of 10gen repo comes from. – Mark Hillick Jul 16 '12 at 10:39
  • Since I don't know which instructions he followed, i suggest him to use the step by step instructions on the MongoDB page. –  Jul 16 '12 at 10:44
  • He said what instructions he followed. Your answer is essentially a copy of what he did. – Mark Hillick Jul 18 '12 at 13:40
0

here is my solution, copy following in your install_mongo.bash file

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
    echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | sudo tee -a /etc/apt/sources.list.d/10gen.list
    sudo apt-get update
    sudo apt-get install mongodb-10gen

and then execute bash install_mongo.bash

Richie Min
  • 101
  • 1
-1

I believe it's a file permission issue. Execute the following commands:

sudo su - 
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list 

That will make sure that you really executed the commands as root.

This should work, but a more clean way how to do it in Ubuntu 12.04 is to add the new repository in /etc/apt/sources.list.d/10gen.list.

Now the only think left is to install it.

apt-get update
apt-get install mongodb-10gen
golja
  • 1,621
  • 10
  • 14
  • Ganesh used sudo, how is this solution different? – Mark Hillick Jul 18 '12 at 13:54
  • Double checking if he used all the commands right. I guess because he is a novice there is a chance that he missed some steps. So with my approach he will make sure that he is logged as root. If even after that he is not able to write the file we can exclude user permission problem and look for other causes. Also I added the ending step how to actually install the program and changed the location of the repo file, which is a much more widely used approach. – golja Jul 18 '12 at 23:39