MongoDB is cross-platform and can be installed on both Windows and Linux. Here we focus on the installation of MongoDB under Linux. ** 1.MongoDB provides 64-bit installation packages for various Linux distributions. You can download the installation package from the official website. curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.12.tgz It took me 27 minutes to download. . . . 2. The default download path is to the Downloads directory under the user directory, unzip it tar -zxvf mongodb-linux-x86_64-3.2.12.tgz 3. Move the unzipped folder to the mongodb directory in /usr/local/ mv mongodb-linux-x86_64-3.2.12 /usr/local/mongodb 4. Configure system profile sudo vi /etc/profile Insert the following: export MONGODB_HOME=/usr/local/mongodb export PATH=$PATH:$MONGODB_HOME/bin Note: vi is the input command. When you see the page below, press the "i" arrow on the keyboard to enter the input mode, and then copy the above command. Then press esc to switch to command mode and enter: wq to save and exit Note that you need to restart the system configuration after saving: 5. Create a folder for storing data and log files, and modify its permissions to add read and write permissions cd /usr/local/mongodbsudo mkdir -p data/dbsudo chmod -r 777 data/dbsudo mkdir logscd logstouch mongodb.log 6. Mongodb startup configuration Go to the bin directory and add a configuration file: cd /usr/local/mongodb/bin sudo vi mongodb.conf As mentioned above, the vi command is to write content. Enter i to enter the write mode. After writing, press esc to enter the command mode and enter :wq to save and exit. dbpath = /usr/local/mongodb/data/db #Data file storage directory logpath = /usr/local/mongodb/logs/mongodb.log #Log file storage directory port = 27017 #Port fork = true #Enable as a daemon, i.e. run in the background nohttpinterface = true 7. Start the mongod database service and start it with the configuration file cd /usr/local/mongodb/bin./mongod -f mongodb.conf 8. Connect to mongodb database Summarize The above is the tutorial on installing mongodb under Linux introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: An article to quickly understand Angular and Ionic life cycle and hook functions
>>: MySQL 5.7.19 winx64 free installation version configuration tutorial
1. If MySQL is not started successfully, check th...
Demand scenario: The boss asked me to use the cra...
Table of contents Preface: Step 1: Find the free ...
Table of contents redo log Why do we need to upda...
In cells, dark border colors can be defined indiv...
Table of contents 1. Click on the menu to jump 1....
Have you ever encountered a situation where we hav...
I will be learning MySQL next semester. I didn...
Table of contents Migration Tools Application tra...
Introduction: When using MySQL to create a table,...
Below is the code that Shiji Tiancheng uses to ca...
Pop-up windows are often used in actual developme...
Since its release in 2013, Docker has been widely...
I believe everyone has had this feeling: watching ...
Recently, Oracle announced the public availabilit...