Mongodb的安装

Linux平台安装MongoDB

MongoDB 提供了 linux 各发行版本 64 位的安装包,你可以在官网下载安装包。

下载地址:https://www.mongodb.com/download-center#community

下载完安装包,并解压 tgz(以下演示的是 64 位 Linux上的安装) 。

1、下载压缩包

curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz    # 下载



[root@xxxxx local]# sudo curl -O https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 78.2M  100 78.2M    0     0  6360k      0  0:00:12  0:00:12 --:--:-- 9841k

2、解压缩

tar -zxvf mongodb-linux-x86_64-3.0.6.tgz                                   # 解压


[root@xxxx local]# sudo tar -xvf mongodb-osx-x86_64-3.4.2.tgz 
    mongodb-osx-x86_64-3.4.2/README
    mongodb-osx-x86_64-3.4.2/THIRD-PARTY-NOTICES
    mongodb-osx-x86_64-3.4.2/MPL-2
    mongodb-osx-x86_64-3.4.2/GNU-AGPL-3.0
    mongodb-osx-x86_64-3.4.2/bin/mongodump
    mongodb-osx-x86_64-3.4.2/bin/mongorestore
    mongodb-osx-x86_64-3.4.2/bin/mongoexport
    mongodb-osx-x86_64-3.4.2/bin/mongoimport
    mongodb-osx-x86_64-3.4.2/bin/mongostat
    mongodb-osx-x86_64-3.4.2/bin/mongotop
    mongodb-osx-x86_64-3.4.2/bin/bsondump
    mongodb-osx-x86_64-3.4.2/bin/mongofiles
    mongodb-osx-x86_64-3.4.2/bin/mongooplog
    mongodb-osx-x86_64-3.4.2/bin/mongoreplay
    mongodb-osx-x86_64-3.4.2/bin/mongoperf
    mongodb-osx-x86_64-3.4.2/bin/mongod
    mongodb-osx-x86_64-3.4.2/bin/mongos
    mongodb-osx-x86_64-3.4.2/bin/mongo
    [root@iZ2ze6j9cwd5tl65vsk5wqZ local]# ls -l
    总用量 98752

3、 防止在某(可根据自己习惯)位置

mv  mongodb-linux-x86_64-3.0.6/ /usr/local/mongodb                         # 将解压包拷贝到指定目录


4、给大家看一下bin目录

[root@xxxx bin]# pwd   --显示路径
/usr/local/mongodb/bin
[root@xxxx bin]# ls -l
总用量 239908
-rwxr-xr-x 1 500 games  4739848 2月   2 2017 bsondump
-rwxr-xr-x 1 500 games 30467832 2月   2 2017 mongo
-rwxr-xr-x 1 500 games 57067116 2月   2 2017 mongod
-rwxr-xr-x 1 500 games  8471360 2月   2 2017 mongodump
-rwxr-xr-x 1 500 games  6445504 2月   2 2017 mongoexport
-rwxr-xr-x 1 500 games  6305520 2月   2 2017 mongofiles
-rwxr-xr-x 1 500 games  6599008 2月   2 2017 mongoimport
-rwxr-xr-x 1 500 games  6070704 2月   2 2017 mongooplog
-rwxr-xr-x 1 500 games 56494300 2月   2 2017 mongoperf
-rwxr-xr-x 1 500 games 10561576 2月   2 2017 mongoreplay
-rwxr-xr-x 1 500 games  9890224 2月   2 2017 mongorestore
-rwxr-xr-x 1 500 games 29589588 2月   2 2017 mongos
-rwxr-xr-x 1 500 games  6651056 2月   2 2017 mongostat
-rwxr-xr-x 1 500 games  6275488 2月   2 2017 mongotop

5、 此时可启动mongo了

在bin目录下 执行 mongo即可。


[root@xxxx bin]# mongo
MongoDB shell version v3.4.17
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.17
Server has startup warnings: 
2018-09-17T16:00:40.501+0800 I STORAGE  [initandlisten] 
2018-09-17T16:00:40.501+0800 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recostorage engine
2018-09-17T16:00:40.501+0800 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodno
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] 
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the dat
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] **          Read and write access to data and configu
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] 
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] 
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabl
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] 
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defra
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-09-17T16:00:40.563+0800 I CONTROL  [initandlisten] 
> 1+1
2


你可能感兴趣的:(Mongodb的安装)