downloadmongodb.tgz

Be careful to select your platform, otherwise a mismatch may not work

Unzip. TGZ

Tar - XVF mongo - Linux - aarch64 - ubuntu1804-4.4.5. TGZCopy the code

Move to the installation directory

Mv mongo - Linux - aarch64 - ubuntu1804 4.4.5 / usr/local/mongoCopy the code

Go to the mongdb directory and create data/db and data/logs folders in this directory

cd mongodb && mkdir -p data/db && mkdir -p data/logs
Copy the code

Go to the bin directory to create a new configuration file mongod. Conf and configure the corresponding contents

cd bin && touch mongod.conf && vim mongod.conf
Copy the code
#Directory for storing database data
dbpath = /usr/local/mongodb/data/db
#Directory for storing database logs
logpath = /usr/local/mongodb/data/logs
#Log in an appending manner
logappend = true
#The port number
port = 27017
#Start in background mode
fork = true
#External access is allowed, 127.0.0.1 is only locally accessibleBind_ip = 0.0.0.0Copy the code

Configure environment variables and apply them

vim /etc/profile
Copy the code

Add after the last line

export PATH=$PATH:/usr/local/mongodb/bin

Save the configuration and run the command

source /etc/profile
Copy the code

Start with the configuration file

./mongod -f ./mongod.conf
Copy the code

Configure the user name and password

Mongo use admin db.createuser ({user:”admin”, PWD :”123456″,roles: [{role: “root”, db: “Admin”}]}) after exit modify mongod. Conf, add auth = true, restart to create a super administrator authentication

Next: mongoDB add delete change check