Article Title: Install MongoDB in SentOSLinux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Step 1: Download MongoDB from the website to the local machine, prepare for installation curl-O linux/mongodb-linux-i686-1.8.1.tgz "> SLAVE ~] $ Mkdir-p/Apps when running this command, the following error may be reported: mkdir: the directory "/Apps" cannot be created ": the preceding problem is that the Linux user does not have the permission to create a directory. You can switch to the root user and execute this command.
2. Switch to the MongoDB running directory/Apps under [root @ localhost chhbloud] # cd/Apps 3. decompress the mongodb-linux-i686-1.8.1.tgz to the running directory [root @ localhost Apps] # tar-zxvf/home /chhbloud/mongodb-linux-i686-2.0.0.tgz tar is the decompression command, parameter description:-z: If the gzip attribute is available at the same time, use gzip to compress-x: To uncompress a file, run the command-v: shows the file-f: use the file name. Note that the file name should be followed immediately after f. Do not add any parameters! For example, if "tar-zcvfP tfile sfile" is used as an error, you must write it as "tar-zcvPf tfile sfile 」
4. Set the data file storage directory [root @ localhost Apps] # mkdir-p mogodb/db Step 3: start the MongoDB service [root @ localhost bin] #/Apps/mongodb-linux-i686-2.0.0/bin/mongod -- dbpath =/Apps/mongodb/db after the service is started listening to port 27017 Step 4: start MongoDB as a Linux service at random. 1. Create/Apps/mongodb/logs/mongodb. log File, used to store MongoDB log files 2. Configure MongoDB to start at random.
Vi/etc/rc. local: Use the vi editor to open the configuration file, add the following line of code/Apps/mongodb/bin/mongod -- dbpath =/data/db -- logpath =/Apps/mongodb/logs/mongodb. log and then run the command [root @ localhost bin] #/sbin/reboot NOW! Restart the system for testing.
Step 5: view MongoDB log records [root @ localhost logs] # pwd/Apps/mongodb/logs [root @ localhost logs] # ll total 8-rw-r -- 1 root 1483 09-25 mongodb. log to this step. Congratulations! You have installed the MongoDB database server.