In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to install mongodb in linux? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
1.MongoDB provides 64-bit installation packages for all linux distributions, which you can download from the official website.
Curl-O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.12.tgz
I downloaded it for 27 minutes.
2. The default download path is to go to the Downloads directory under the user's directory and extract it.
Tar-zxvf mongodb-linux-x86_64-3.2.12.tgz
3. Move the extracted folder to the mongodb directory of / usr/local/
Mv mongodb-linux-x86_64-3.2.12 / usr/local/mongodb
4. Configure the system file profile
Sudo vi / etc/profile
Insert the following:
Export MONGODB_HOME=/usr/local/mongodb export PATH=$PATH:$MONGODB_HOME/bin
Note: vi is an input command, when you see the following page, press the keyboard "I" arrow to enter input mode, and then copy the above command. Then press esc to switch to command mode enter: wq save and exit
Be sure to restart the system configuration after saving:
Source / etc/profile
5. Create a folder for storing data and log files, and modify its permissions to increase 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. Enter I to enter the write mode, then press esc to enter the command mode. Enter: wq save and exit.
Insert the following:
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 # enabled as a daemon, that is, running nohttpinterface = true in the background
7. Start the mongod database service and start it as a configuration file
Cd / usr/local/mongodb/bin./mongod-f mongodb.conf
8. Connect to mongodb database
. / mongo
This is the answer to the question about how to install mongodb in linux. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.