Mongodb安装Ubuntu 12.04 LTS

时间:2013-10-19 03:33:11

标签: mongodb ubuntu

我的mongodb安装效果不佳。我在/etc/apt/sources.list中添加了一个位置,但是我收到一条错误消息,表明i386软件包和amd64软件包之间的条目有重复内容?我尝试了更新,但它不起作用。

4 个答案:

答案 0 :(得分:3)

在这个how-to-install-mongodb-on-ubuntu中,每个步骤都得到了很好的解释。我试过,它按预期顺利进行。祝好运! :)

答案 1 :(得分:2)

在ubuntu中很容易安装mongodb。

第1步:搜索可用的mongodb软件包,但最初可能不存在

sudo apt-cache search mongodb

第2步:将软件包添加到/etc/apt/sources.list.d,因为它是最新的稳定MongoDB版本

vim /etc/apt/sources.list.d/mongodb.list

将以下链接添加到mongodb.list文件

deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

第3步:导入GPG密钥

apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

第4步:使用以下命令更新debian软件包:

apt-get update

第5步:现在执行搜索以查看包

apt-cache search mongodb

第6步:现在包已存在,请使用以下命令安装:

apt-get install mongodb-10gen

第7步:检查mongodb是否已开始使用

ps -ef | grep mongo
ls -ls /usr/bin | grep mongo

步骤8 :mongodb控制脚本在/etc/init.d/mongodb生成,MongoDB配置文件位于/etc/mongodb.conf,添加以下详细信息:

verbose = true
dbpath = /data/db
logpath = /var/log/mongodb.log
logappend = true
port = 27017

第9步:启动mongodb作为服务

service mongodb start

第10步:使用

检查mongodb服务是否已开始
ps -ef | grep mongodb

步骤11 :要停止/重新启动,请执行以下命令:

service mongodb stop
service mongodb restart

这取自我blog post,我已进一步详细解释过。

答案 2 :(得分:0)

下载并解压缩.tar .zip并在终端$。\ mongod中调用(在解压缩后,它在默认端口上运行服务器实例),使用另一个终端并尝试$。\ mongo(显示dbs,使用dbname,show collections ,...)

取决于您的系统功能,取决于32位/ 64位版本,使用32/64位。

答案 3 :(得分:-1)

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 !!!
相关问题