linux下安装mongodb
时间:2014-12-21 19:40 来源:www.it.net.cn 作者:IT网
安装环境为centos6.3 64bit
mongodb版本:mongodb2.2
配置文件:/etc/mongod.conf
服务启动脚本:/etc/init.d/mongod
总体步骤:
1.配置yum源
2.yum install....
3.测试是否安装成功
若是32位的系统,yum如下配置
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
enabled=1
过程如下:
[plain] view plaincopy
-
[chen@localhost ~]$ su - root
-
Password:
-
[root@localhost ~]# cd /etc/yum.repos.d/
-
[root@localhost yum.repos.d]# touch 10gen.repo #名字随便,以.repo结尾
-
[root@localhost yum.repos.d]# ls
-
10gen.repo CentOS-Base.repo CentOS-Media.repo
-
adobe-linux-x86_64.repo CentOS-Debuginfo.repo CentOS-Vault.repo
-
[root@localhost yum.repos.d]# vim 10gen.repo
-
[root@localhost yum.repos.d]# cat 10gen.repo
-
[mongodb-10gen]
-
name=10gen Repository
-
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
-
gpgcheck=0
-
enabled=1
-
-
[root@localhost yum.repos.d]# yum list|grep mongo
-
mongo-10gen.x86_64 2.2.0-mongodb_1 @mongodb-10gen
-
mongo-10gen-server.x86_64 2.2.0-mongodb_1 @mongodb-10gen
-
mongo18-10gen.x86_64 1.8.5-mongodb_1 mongodb-10gen
-
mongo18-10gen-server.x86_64 1.8.5-mongodb_1 mongodb-10gen
-
mongo20-10gen.x86_64 2.0.7-mongodb_1 mongodb-10gen
-
mongo20-10gen-server.x86_64 2.0.7-mongodb_1 mongodb-10gen
-
[root@localhost yum.repos.d]# cd
-
[root@localhost ~]# yum install mongo-10gen mongo-10gen-server
-
Loaded plugins: fastestmirror, refresh-packagekit, security
-
Loading mirror speeds from cached hostfile
-
* 163-source: mirror.neu.edu.cn
-
* extras: mirror.neu.edu.cn
-
* updates: mirror.neu.edu.cn
-
Setting up Install Process
-
Resolving Dependencies
-
--> Running transaction check
-
---> Package mongo-10gen.x86_64 0:2.2.0-mongodb_1 will be installed
-
---> Package mongo-10gen-server.x86_64 0:2.2.0-mongodb_1 will be installed
-
--> Finished Dependency Resolution
-
-
Dependencies Resolved
-
-
================================================================================
-
Package Arch Version Repository Size
-
================================================================================
-
Installing:
-
mongo-10gen x86_64 2.2.0-mongodb_1 mongodb-10gen 43 M
-
mongo-10gen-server x86_64 2.2.0-mongodb_1 mongodb-10gen 6.7 M
-
-
Transaction Summary
-
================================================================================
-
Install 2 Package(s)
-
-
Total download size: 50 M
-
Installed size: 120 M
-
Is this ok [y/N]: y
-
Downloading Packages:
-
(1/2): mongo-10gen-2.2.0-mongodb_1.x86_64.rpm | 43 MB 02:57
-
(2/2): mongo-10gen-server-2.2.0-mongodb_1.x86_64.rpm | 6.7 MB 00:29
-
--------------------------------------------------------------------------------
-
Total 244 kB/s | 50 MB 03:28
-
Running rpm_check_debug
-
Running Transaction Test
-
Transaction Test Succeeded
-
Running Transaction
-
Warning: RPMDB altered outside of yum.
-
Installing : mongo-10gen-2.2.0-mongodb_1.x86_64 1/2
-
Installing : mongo-10gen-server-2.2.0-mongodb_1.x86_64 2/2
-
Verifying : mongo-10gen-server-2.2.0-mongodb_1.x86_64 1/2
-
Verifying : mongo-10gen-2.2.0-mongodb_1.x86_64 2/2
-
-
Installed:
-
mongo-10gen.x86_64 0:2.2.0-mongodb_1
-
mongo-10gen-server.x86_64 0:2.2.0-mongodb_1
-
-
Complete!
-
[root@localhost ~]# chkconfig --list|grep mongo #查看一下mongo服务
-
mongod 0:off 1:off 2:off 3:on 4:off 5:on 6:off
-
[root@localhost ~]# chkconfig mongod on #开机启动
-
[root@localhost ~]# chkconfig --list|grep mongo
-
mongod 0:off 1:off 2:on 3:on 4:on 5:on 6:off
-
[root@localhost ~]# service mongod start #启动mongodb
-
Starting mongod: forked process: 3205
-
all output going to: /var/log/mongo/mongod.log
-
child process started successfully, parent exiting
-
[ OK ]
-
[root@localhost ~]# service mongod status
-
mongod (pid 3205) is running...
-
[root@localhost ~]# mongo #连接测试,安装成功。
-
MongoDB shell version: 2.2.0
-
connecting to: test
-
Welcome to the MongoDB shell.
-
For interactive help, type "help".
-
For more comprehensive documentation, see
-
http://docs.mongodb.org/
-
Questions? Try the support group
-
http://groups.google.com/group/mongodb-user
-
>
(责任编辑:IT)
安装环境为centos6.3 64bit mongodb版本:mongodb2.2 配置文件:/etc/mongod.conf 服务启动脚本:/etc/init.d/mongod 总体步骤: 1.配置yum源 2.yum install.... 3.测试是否安装成功 若是32位的系统,yum如下配置
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0 enabled=1
过程如下:
[plain] view plaincopy
(责任编辑:IT) |