mongodb下载地址:
https://docs.mongodb.com/manual/installation/
其中server仅包含mongodb server,shell仅包含mongo客户端命令mongo
rpm可以用yum或者rpm安装,tgz直接解压并配置path就可以使用
最后那个tgz包包含了所有组件(mongos,shell和server),直接解压就可以使用
我这次是server和shell分开安装的
1.安装server
[root@lzl soft]# rpm -ivh mongodb-server-4.4.2-el6x86.rpm
warning: EasyConnectPlugin.dmg: Header V3 RSA/SHA1 Signature, key ID 90cfb1f5: NOKEY
Preparing... ########################################### [100%]
1:mongodb-org-server ########################################### [100%]
[root@lzl mongo]# ls -lrt /usr/bin/mongo*
-rwxr-xr-x 1 root root 82214928 Nov 17 00:12 /usr/bin/mongod
2.启动server
[root@lzl ~]# mongod -f /etc/mongod.conf &
[1] 4901
about to fork child process, waiting until server is ready for connections.
forked process: 4903
[root@lzl ~]# child process started successfully, parent exiting
[1]+ Done mongod -f /etc/mongod.conf
[root@lzl ~]# ps -ef|grep mongo
root 4903 1 17 11:54 ? 00:00:01 mongod -f /etc/mongod.conf
root 4938 4808 0 11:54 pts/9 00:00:00 grep mongo
3.安装mongo shell
[root@lzl soft]# rpm -ivh mongodb-org-shell-4.4.2-1.el6.x86_64.rpm
warning: mongodb-org-shell-4.4.2-1.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 90cfb1f5: NOKEY
Preparing... ########################################### [100%]
1:mongodb-org-shell ########################################### [100%]
[root@lzl soft]# which mongo
/usr/bin/mongo
[root@lzl soft]# which mongod
/usr/bin/mongod
[root@lzl soft]#
[root@lzl soft]# mongo
MongoDB shell version v4.4.2
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("8840dd6e-4c7b-4369-a2f7-7ecc9028b571") }
MongoDB server version: 4.4.2
---
The server generated these startup warnings when booting:
2020-12-02T11:56:39.219+08:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
2020-12-02T11:56:41.256+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2020-12-02T11:56:41.256+08:00: You are running this process as the root user, which is not recommended
2020-12-02T11:56:41.265+08:00: Soft rlimits too low
2020-12-02T11:56:41.265+08:00: currentValue: 1024
2020-12-02T11:56:41.265+08:00: recommendedMinimum: 64000
---
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB