Install mongodb using yum


Mongodb series:

Install mongodb using Yum in CentOS 7. The installation package may not be the latest, but it must be the most stable. The advantages of Yum installation are simple, time-saving, labor-saving and efficient. If you want to install the latest version of mongodb, you can refer to the installation guide on the official website of mongodb.

The installation steps are as follows:

#Switch to root account

#Step 1: in / etc / repos. D / directory to create mongodb Repo Yum source profile
cd /etc/yum.repos.d
vi mongodb.repo

#The configuration file contains the configuration information of mongodb installation package. The contents of the file are as follows:
name=MongoDB Repository

#Step 2: execute the yum install command
yum install -y mongodb-org

#Step 3: start mongodb service
systemctl start mongod

#Step 4: verify that mongodb works normally
Mongo # enters the shell environment of mongodb
>Help # view the help information of mongodb
> db. Help() # view help information for the database
> db. Version() # view the version number of mongodb
>Show DBS # view how many databases there are
>Exit # exit mongodb system

To explain, step 4: when you hit the Mongo command on the command line, you have actually entered the mongodb shell environment. At this time, the command line prompt has become a greater than sign. Moreover, it will connect to a test database by default.

Some other mongodb commands.

> show collections
> db.dropDatabase()
> db.createCollection(name)
> db. coll-name. Drop() # delete collection
> exit

If this article is useful to you, please like it and collect it!

Recommended Today

Android video player plug-in – mxvideo

MXVideo introduce Android open source player based on dumpling player and kotlin, out of the box. Welcome to issue and pull requestProject address:MXVideo Small screen Full screen live broadcast Functional characteristics Any player kernel (including open source ijk, Google exo, Alibaba cloud, etc.) For single case playback, only one program can be played at the […]