安裝方式:mongodb
RPM包安裝shell
安裝步驟:dom
一.下載RPM包ide
下圖是須要注意的事項。其一選擇MongoDB的社區版本,默認是企業版本。其二,選中版本後,在下方會出現下載地址,直接複製下載便可code
二.安裝並查看是否安裝成功server
[root@localhost ~]# rpm -ivh https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/RPMS/mongodb-org-server-4.2.1-1.el7.x86_64.rpm Retrieving https://repo.mongodb.org/yum/redhat/7/mongodb-org/4.2/x86_64/RPMS/mongodb-org-server-4.2.1-1.el7.x86_64.rpm #正常來講,會出現兩個百分號纔是正常的 warning: /var/tmp/rpm-tmp.dkH44i: Header V3 RSA/SHA1 Signature, key ID 058f8b6b: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mongodb-org-server-4.2.1-1.el7 ################################# [100%] Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service. [root@localhost ~]# systemctl status mongod #可以在systemctl中識別到這個服務,即安裝成功 ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: inactive (dead) Docs: https://docs.mongodb.org/manual Nov 10 21:15:19 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/mongod.service:31] Unknown lvalue 'TasksMax' in section 'Service' Nov 10 21:15:19 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/mongod.service:32] Unknown lvalue 'TasksAccounting' in s...ervice' Nov 10 21:15:19 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/mongod.service:31] Unknown lvalue 'TasksMax' in section 'Service' Nov 10 21:15:19 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/mongod.service:32] Unknown lvalue 'TasksAccounting' in s...ervice' Hint: Some lines were ellipsized, use -l to show in full. [root@localhost ~]#
三.啓動MongoDBblog
[root@localhost ~]# systemctl start mongod [root@localhost ~]# systemctl status mongod ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2019-11-10 21:17:24 EST; 24s ago Docs: https://docs.mongodb.org/manual Process: 21989 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) Process: 21986 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 21983 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 21981 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) Main PID: 21992 (mongod) CGroup: /system.slice/mongod.service └─21992 /usr/bin/mongod -f /etc/mongod.conf Nov 10 21:17:22 localhost.localdomain systemd[1]: Starting MongoDB Database Server... Nov 10 21:17:22 localhost.localdomain mongod[21989]: about to fork child process, waiting until server is ready for connections. Nov 10 21:17:22 localhost.localdomain mongod[21989]: forked process: 21992 Nov 10 21:17:24 localhost.localdomain systemd[1]: Started MongoDB Database Server.
建議shell和tools也一塊安裝教程