1. Download the installation package
Wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz
Decompress the package after the download is complete.
Tar zxf mongodb-linux-i686-1.8.2.tgz
2. Installation preparation
Move MongoDB to the/usr/local/mongdb folder
Music mongodb-linux-i686-1.8.2/usr/local/MongoDB
Create Database folders and log files
Mkdir/usr/local/MongoDB/Data
Touch/usr/local/MongoDB/logs
Add the MongoDB startup project to RC. Local to ensure that MongoDB is started when the server is started.
Echo "/usr/local/MongoDB/bin/mongod -- dbpath =/usr/local/MongoDB/data-logpath =/usr/local/MongoDB/logs-logappend -- auth-Port = 27017 ">/etc/rc. local
CD to the bin folder in the MongoDB directory to start MongoDB
/Usr/local/MongoDB/bin/mongod -- dbpath =/usr/local/MongoDB/data -- logpath =/usr/local/MongoDB/logs -- logappend -- auth -- Port = 27017 -- fork
(The fork parameter specifies how the mango process runs)
The output indicates that MongoDB is started.
3. Go to the CLI management interface of the database.
CD to the bin folder in the MongoDB directory and execute the command./Mongo
Run as follows:
If the database cannot be connected, it is a problem with the mongod. Lock file under the Data Directory. You can use the following repair command,
Mongod -- repair
The following is the experience of colleagues in the Development Department.
Note the following for data migration: place the data file in the specified location and run the repair command before starting the mongod service. The command is as follows:
Mongod -- repair
Then start the mongod service.
Check that ports 27017 and 28017 are unblocked.
Pay attention to user permissions.
The above is an individual original. For details, please indicate the original position.