Home / Articles / Database / mongodb / 5.0 / install

MongoDB Install

  • Download RPM from Official Website
  • If Linux server don't have internet connectivity, then these RPMs can be downloaded from browser and then copied to Linux server.

    # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-org-5.0.2-1.el7.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-org-database-5.0.2-1.el7.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.2-1.el7.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-org-shell-5.0.2-1.el7.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-org-mongos-5.0.2-1.el7.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-org-tools-5.0.2-1.el7.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-database-tools-100.5.0.x86_64.rpm # wget https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/5.0/x86_64/RPMS/mongodb-mongosh-1.0.5.el7.x86_64.rpm
  • Install MongoDB RPMs
  • # yum install -y mongo-* Loaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Examining mongodb-database-tools-100.5.0.x86_64.rpm: mongodb-database-tools-100.5.0-1.x86_64 Marking mongodb-database-tools-100.5.0.x86_64.rpm to be installed Examining mongodb-mongosh-1.0.5.el7.x86_64.rpm: mongodb-mongosh-1.0.5-1.el7.x86_64 Marking mongodb-mongosh-1.0.5.el7.x86_64.rpm to be installed Examining mongodb-org-5.0.2-1.el7.x86_64.rpm: mongodb-org-5.0.2-1.el7.x86_64 Marking mongodb-org-5.0.2-1.el7.x86_64.rpm to be installed Examining mongodb-org-database-5.0.2-1.el7.x86_64.rpm: mongodb-org-database-5.0.2-1.el7.x86_64 Marking mongodb-org-database-5.0.2-1.el7.x86_64.rpm to be installed Examining mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64.rpm: mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64 Marking mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64.rpm to be installed Examining mongodb-org-mongos-5.0.2-1.el7.x86_64.rpm: mongodb-org-mongos-5.0.2-1.el7.x86_64 Marking mongodb-org-mongos-5.0.2-1.el7.x86_64.rpm to be installed Examining mongodb-org-server-5.0.2-1.el7.x86_64.rpm: mongodb-org-server-5.0.2-1.el7.x86_64 Marking mongodb-org-server-5.0.2-1.el7.x86_64.rpm to be installed Examining mongodb-org-shell-5.0.2-1.el7.x86_64.rpm: mongodb-org-shell-5.0.2-1.el7.x86_64 Marking mongodb-org-shell-5.0.2-1.el7.x86_64.rpm to be installed Examining mongodb-org-tools-5.0.2-1.el7.x86_64.rpm: mongodb-org-tools-5.0.2-1.el7.x86_64 Marking mongodb-org-tools-5.0.2-1.el7.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mongodb-database-tools.x86_64 0:100.5.0-1 will be installed --> Processing Dependency: cyrus-sasl for package: mongodb-database-tools-100.5.0-1.x86_64 --> Processing Dependency: cyrus-sasl-gssapi for package: mongodb-database-tools-100.5.0-1.x86_64 --> Processing Dependency: cyrus-sasl-plain for package: mongodb-database-tools-100.5.0-1.x86_64 ---> Package mongodb-mongosh.x86_64 0:1.0.5-1.el7 will be installed ---> Package mongodb-org.x86_64 0:5.0.2-1.el7 will be installed ---> Package mongodb-org-database.x86_64 0:5.0.2-1.el7 will be installed ---> Package mongodb-org-database-tools-extra.x86_64 0:5.0.2-1.el7 will be installed ---> Package mongodb-org-mongos.x86_64 0:5.0.2-1.el7 will be installed ---> Package mongodb-org-server.x86_64 0:5.0.2-1.el7 will be installed ---> Package mongodb-org-shell.x86_64 0:5.0.2-1.el7 will be installed ---> Package mongodb-org-tools.x86_64 0:5.0.2-1.el7 will be installed --> Running transaction check ---> Package cyrus-sasl.x86_64 0:2.1.26-23.el7 will be installed ---> Package cyrus-sasl-gssapi.x86_64 0:2.1.26-23.el7 will be installed ---> Package cyrus-sasl-plain.x86_64 0:2.1.26-23.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================== Installing: mongodb-database-tools x86_64 100.5.0-1 /mongodb-database-tools-100.5.0.x86_64 125 M mongodb-mongosh x86_64 1.0.5-1.el7 /mongodb-mongosh-1.0.5.el7.x86_64 188 M mongodb-org x86_64 5.0.2-1.el7 /mongodb-org-5.0.2-1.el7.x86_64 0.0 mongodb-org-database x86_64 5.0.2-1.el7 /mongodb-org-database-5.0.2-1.el7.x86_64 0.0 mongodb-org-database-tools-extra x86_64 5.0.2-1.el7 /mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64 15 k mongodb-org-mongos x86_64 5.0.2-1.el7 /mongodb-org-mongos-5.0.2-1.el7.x86_64 71 M mongodb-org-server x86_64 5.0.2-1.el7 /mongodb-org-server-5.0.2-1.el7.x86_64 103 M mongodb-org-shell x86_64 5.0.2-1.el7 /mongodb-org-shell-5.0.2-1.el7.x86_64 55 M mongodb-org-tools x86_64 5.0.2-1.el7 /mongodb-org-tools-5.0.2-1.el7.x86_64 0.0 Installing for dependencies: cyrus-sasl x86_64 2.1.26-23.el7 localrepo 88 k cyrus-sasl-gssapi x86_64 2.1.26-23.el7 localrepo 41 k cyrus-sasl-plain x86_64 2.1.26-23.el7 localrepo 39 k Transaction Summary ============================================================================================================================================================== Install 9 Packages (+3 Dependent packages) Total size: 542 M Total download size: 169 k Installed size: 542 M Is this ok [y/d/N]: y Downloading packages: (1/3): cyrus-sasl-gssapi-2.1.26-23.el7.x86_64.rpm | 41 kB 00:00:00 (2/3): cyrus-sasl-2.1.26-23.el7.x86_64.rpm | 88 kB 00:00:00 (3/3): cyrus-sasl-plain-2.1.26-23.el7.x86_64.rpm | 39 kB 00:00:00 -------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 623 kB/s | 169 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64 1/12 Installing : mongodb-org-server-5.0.2-1.el7.x86_64 2/12 Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service. Installing : cyrus-sasl-2.1.26-23.el7.x86_64 3/12 Installing : cyrus-sasl-plain-2.1.26-23.el7.x86_64 4/12 Installing : mongodb-org-shell-5.0.2-1.el7.x86_64 5/12 Installing : mongodb-org-mongos-5.0.2-1.el7.x86_64 6/12 Installing : mongodb-org-database-5.0.2-1.el7.x86_64 7/12 Installing : cyrus-sasl-gssapi-2.1.26-23.el7.x86_64 8/12 Installing : mongodb-database-tools-100.5.0-1.x86_64 9/12 Installing : mongodb-org-tools-5.0.2-1.el7.x86_64 10/12 Installing : mongodb-mongosh-1.0.5-1.el7.x86_64 11/12 Installing : mongodb-org-5.0.2-1.el7.x86_64 12/12 Verifying : mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64 1/12 Verifying : mongodb-org-database-5.0.2-1.el7.x86_64 2/12 Verifying : mongodb-database-tools-100.5.0-1.x86_64 3/12 Verifying : mongodb-mongosh-1.0.5-1.el7.x86_64 4/12 Verifying : cyrus-sasl-gssapi-2.1.26-23.el7.x86_64 5/12 Verifying : mongodb-org-mongos-5.0.2-1.el7.x86_64 6/12 Verifying : mongodb-org-tools-5.0.2-1.el7.x86_64 7/12 Verifying : mongodb-org-5.0.2-1.el7.x86_64 8/12 Verifying : mongodb-org-shell-5.0.2-1.el7.x86_64 9/12 Verifying : cyrus-sasl-plain-2.1.26-23.el7.x86_64 10/12 Verifying : cyrus-sasl-2.1.26-23.el7.x86_64 11/12 Verifying : mongodb-org-server-5.0.2-1.el7.x86_64 12/12 Installed: mongodb-database-tools.x86_64 0:100.5.0-1 mongodb-mongosh.x86_64 0:1.0.5-1.el7 mongodb-org.x86_64 0:5.0.2-1.el7 mongodb-org-database.x86_64 0:5.0.2-1.el7 mongodb-org-database-tools-extra.x86_64 0:5.0.2-1.el7 mongodb-org-mongos.x86_64 0:5.0.2-1.el7 mongodb-org-server.x86_64 0:5.0.2-1.el7 mongodb-org-shell.x86_64 0:5.0.2-1.el7 mongodb-org-tools.x86_64 0:5.0.2-1.el7 Dependency Installed: cyrus-sasl.x86_64 0:2.1.26-23.el7 cyrus-sasl-gssapi.x86_64 0:2.1.26-23.el7 cyrus-sasl-plain.x86_64 0:2.1.26-23.el7 Complete!
  • Check RPMs are installed
  • # rpm -qa | grep -i mongo mongodb-org-server-5.0.2-1.el7.x86_64 mongodb-org-mongos-5.0.2-1.el7.x86_64 mongodb-org-tools-5.0.2-1.el7.x86_64 mongodb-org-database-tools-extra-5.0.2-1.el7.x86_64 mongodb-org-shell-5.0.2-1.el7.x86_64 mongodb-org-database-5.0.2-1.el7.x86_64 mongodb-database-tools-100.5.0-1.x86_64 mongodb-mongosh-1.0.5-1.el7.x86_64 mongodb-org-5.0.2-1.el7.x86_64
  • Start MongoDB Service
  • # systemctl start mongod
  • Check Status of MongoDB Service
  • # systemctl status mongod mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2021-08-13 21:25:01 EDT; 5s ago Docs: https://docs.mongodb.org/manual Process: 3546 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) Process: 3544 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 3542 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 3541 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) Main PID: 3549 (mongod) CGroup: /system.slice/mongod.service 3549 /usr/bin/mongod -f /etc/mongod.conf Aug 13 21:24:54 grafana-36.linuxtechspace.com systemd[1]: Starting MongoDB Database Server... Aug 13 21:24:58 grafana-36.linuxtechspace.com mongod[3546]: about to fork child process, waiting until server is ready for connections. Aug 13 21:24:58 grafana-36.linuxtechspace.com mongod[3546]: forked process: 3549 Aug 13 21:25:01 grafana-36.linuxtechspace.com mongod[3546]: child process started successfully, parent exiting Aug 13 21:25:01 grafana-36.linuxtechspace.com systemd[1]: Started MongoDB Database Server.
  • Enable MongoDB service to auto start on server reboot
  • # systemctl enable mongod
  • Check MongoDB process is running
  • # ps -ef | grep -i mongo mongod 3549 1 1 21:25 ? 00:00:09 /usr/bin/mongod -f /etc/mongod.conf
  • MongoDB Install is complete.