Linux systems install MongoDB

1. Use scp command to upload the files to the Linux server
command:
upload the file on the remote host username @ remote ip: Save the file path
scp mongodb-linux-x86_64-4.0.10.tar.gz [email protected]: / home / qadmsom

2. Unzip the file
tar -zxvf mongodb-linux-x86_64-4.0.10.tar.gz

3. Unzip the file to the / usr / local / directory under mongodb
mv mongodb-linux-x86_64-4.0.10 / usr / local / mongodb

4. The system configuration file
vi / etc / profile
is inserted at the contents:
Export MONGODB_HOME = / usr / local / MongoDB / bin
Export the PATH = $ the PATH: $ MONGODB_HOME
after save and reboot the system configuration
source / etc / profile

5. Create and store data log file folder
CD / usr / local / MongoDB
mkdir -p Data / DB
mkdir logs
CD logs
Touch mongodb.log

6.MongoDB startup configuration
into the bin directory, the new conf file
cd / usr / local / MongoDB / bin
vi mongodb.conf
insert the following:
dbpath = / usr / local / MongoDB / the Data / db # data files and directories
logpath = / usr / local / mongodb / logs / mongodb.log # log file storage directory
fork = true # daemon way to start, that started in the background

7. Start the MongoDB database service, in the manner of the configuration file to start
cd / usr / local / MongoDB / bin
the mongod -f mongodb.conf

8. The database is connected
mongo

 

Guess you like

Origin www.cnblogs.com/tonylaoshi/p/11075466.html