CentOS 6.8 under linux install mongodb

1. Get mongodb-3.4.6

[ root@xxxx local]# curl -o mongodb-linux-x86_64-3.4.6.tgz https://fas tdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.6.tgz

Here is the installation process

Use the command: curl

In Linux, curl is a file transfer tool that uses URL rules to work on the command line. It can be said to be a very powerful http command line tool. It supports file uploading and downloading and is a comprehensive transmission tool, but according to tradition, it is customary to call url a download tool.

Common parameters

- A/--user-agent <string>Set the user agent to send to the server
- b/--cookie <name=string/file>Cookie string or file reading position
- c/--cookie-jar <file>Write the cookie to this file after the operation is over
- C/--continue-at <offset>Breakpoint resume
- D/--dump-header <file>Write the header information to the file
- e/--referer source URL
- f/--fail do not display http error when connection fails
- o/--output write the output to the file
- O/--remote-name write the output to the file, keep the file name of the remote file
- r/--range <range>Retrieved from HTTP/1.1 or FTP server byte range
- s/--silent Silent mode. Output nothing
- T/--upload-file <file>upload files
- u/--user <user[:password]>Set the user and password of the server
- w/--write-out [format]What output is complete
- x/--proxy <host[:port]>Use HTTP proxy on the given port
- # /--progress-bar The progress bar shows the current transfer status

2. Unzip the compressed package to the installation directory (/usr/local/mongodb)

The following is the installed interface

Next, we decompress.

Since I have reached the current path, I just need to perform decompression

 # tar zxvf mongodb-linux-x86_64-3.4.6.tgz

If you do not enter the path, just specify it

# tar zxvf mongodb-linux-x86_64-3.4.6.tgz -C /usr/local

The attention referred to here is a permission issue.
Below is a screenshot of the operation.

Next from the named file: mv mongodb-linux-x86_64-3.4.6 mongodb

3. Create log and data directories##

[ root@localhost local]# cd mongodb
[ root@localhost mongodb]# mkdir data/log && mkdir data/db

4. Configure environment variables##

vi /etc/profile

export MONGODB_HOME=/usr/local/mongodb 

 export PATH=$PATH:$MONGODB_HOME/bin

After saving, restart the system configuration

source /etc/profile

5. Configure mongodb.conf

Create a file mongodb.conf under /usr/local/mongodb/bin with the following content:

systemLog:
 destination: file
 path:"/usr/local/mongodb/data/log/mongodb.log"                                  
 logAppend:true

storage:
 journal:                                                              
  enabled:true
 dbPath:"/usr/local/mongodb/data/db"                                                  
 directoryPerDB:false                                               
 engine: wiredTiger                                                           
 wiredTiger:                                                              
  engineConfig:
   cacheSizeGB:4                                                        
   directoryForIndexes:false                                         
   journalCompressor: zlib
  collectionConfig:                                                       
   blockCompressor: zlib
  indexConfig:                                                                 
   prefixCompression:true

net:                                                                     
 port:27017

processManagement:                                                           
 fork:true

security:
 authorization: disabled

Set up background operation

fork = true

Log output method

logappend = true

6. Start the mongodb server##

Under /usr/local/mongodb/bin
mongod -f /usr/local/mongodb/bin/mongodb.conf

7. Check mongodb start port 27017

[ root@localhost mongodb]# lsof -i :27017

8. Check http service port 28017

(In the mongodb 27017, the first 7 plus 1, that is 28017 is the HTTP service port)

http://IP:28017

9. Start the client of mongodb##

[ root@localhost mongodb]# bin/mongo
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version:3.4.6

10. Encountered pit##

1 ,Address already in use linux

Reason: Port occupied

Solution: ps command, check the occupied program, kill it

2 ,LoaderExceptions

Reason: In the configuration file, a space is missing after the colon

Solution: Go to the configuration file, modify it, and restart the service.

3 , Unable to lock the lock file: /var/lib/mongo/mongod.lock

Reason: The file is locked and cannot be copied

Solution: Just delete it directly
4. Under centos, the command lsof cannot be used, and the following message appears:
Solution
We can install it through yum:

# yum install lsof

Recommended Posts

CentOS 6.8 under linux install mongodb
Install MySQL under Linux (CentOS 7)
Install MongoDB database under CentOS7
Install mysql5.7 under CentOS7
Install ActiveMQ under Centos7
Install PostgreSQL12 under CentOS7
Install mysql8.0.13 version under Linux CentOS7 system
Linux Centos7 install jdk1.8
CentOS (linux) install PostgreSQL
Install MongoDB on CentOS 7
Centos7 install mongodb 4.x
Install mysql under Centos 7
Install Jenkins under Centos 7
Install MariaDB under MariaDB Centos7
Install mysql5.1 under CentOS6.5
Centos 7 install JDK (Linux install jdk)
Know Linux and install CentOS
Linux Centos7 install redis tutorial
Install MySQL 8.0.16 on Linux Centos
Install Oracle11gR2 database under CentOS6.9
3 partitioning tools under CentOS Linux
Centos6.5 install and configure mongodb
Install Mesos tutorial under CentOS7
1.5 Install Centos7
Install and configure keepalived under CentOS 5.9
Compile and install LAMP under Centos 5.2
[Introduction to redis] Install redis under Centos
Linux CentOS 7 install JDK detailed steps
Install MySQL on Linux CentOS7 (Windows)
​Install Oracle database on CentOS Linux
Install Python3 and ansible under CentOS8
Install the latest OpenCV4.3 under Centos8
Install and use docker under CentOS 6.8
How to install MongoDB on CentOS 7
Install Python3 and Py under CentOS7
Linux CentOS6 compile and install Pyt
Use VMware15 to install Linux (CentOS6.5)
How to install MongoDB on CentOS 8
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Install Jenkins on linux centos (non-docker way)
Centos6 install Python2.7.13
Compile and install libmodbus library under CentOS7
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Install linux (ubuntu) dual system under windows system
Centos7 install Python2.7
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3