My mongodb installation isn't working very well. I added a place in /etc/apt/sources.list, but I get an error message that there is a duplicate in an entry between the i386 packages and amd64 packages? I tried an update, but it doesn't work.
问题:
回答1:
In this how-to-install-mongodb-on-ubuntu, each step was well explained. I tried and it went well as expected. Good luck! :)
回答2:
Its easy to install mongodb in ubuntu.
Step 1: Search for the mongodb package avaliable but initially it may not be present
sudo apt-cache search mongodb
Step 2: Add the package to /etc/apt/sources.list.d
because its the the latest stable MongoDB version
vim /etc/apt/sources.list.d/mongodb.list
Add the following link into the mongodb.list file
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
Step 3: Import the GPG key
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
Step 4 : Update the debian package using the command:
apt-get update
Step 5: Now perform search to view the package
apt-cache search mongodb
Step 6: Now the package will be present so install it using the below command:
apt-get install mongodb-10gen
Step 7: Check mongodb has started using
ps -ef | grep mongo ls -ls /usr/bin | grep mongo
Step 8: The mongodb control script is generated at /etc/init.d/mongodb,the MongoDB config file is at /etc/mongodb.conf add the below details:
verbose = true dbpath = /data/db logpath = /var/log/mongodb.log logappend = true port = 27017
Step 9: Start the mongodb as a service
service mongodb start
Step 10 :Check mongodb service has started using
ps -ef | grep mongodb
Step 11 : To stop/restart perform the below commands:
service mongodb stop service mongodb restart
For more idea check out this link
回答3:
Download and Unzip the .tar .zip and invoke in terminal $.\mongod (after unzip, it runs server instance on default port), Use another terminal and try $.\mongo (show dbs, use dbname, show collections,...)
Depending on the 32bit/64bit version depending on your system capability use 32/64 bit.
回答4:
first you have to configure Ubuntu Package Management System (APT) to be able to get the public GPG key sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 or type sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 another issue you may face it's when you want to connect to the internet through proxy, export proxy settings to you bash configuration - add this line with your proxy address (at the end of file /etc/bash.bashrc): export http_proxy=http://username:password@proxyserver:port/ now Create a /etc/apt/sources.list.d/10gen.list file and include the following line in the 10gen.list for the 10gen repository: deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen if you get that went right you have to update the packages sudo apt-get update now install mongodb package: sudo apt-get install mongodb-10gen and you good !!!