Install MongoDB (GO) under Linux

Source: Internet
Author: User
Tags install mongodb

First go directly to MongoDB official website to download an installation package, I downloaded the mongodb-linux-2.2.0.tgz version of the, note that its suffix is. tgz is not the same as the general. Tar.gz, in fact, is the same, when the decompression or tar zxvf Mongodb-linux-2.2.0.tgz no difference, try it on your own to know. When the download is ready, we are officially installed below ...

  The first step, we have to download the good. Tgz source package moved to the folder we want to install, in my case, we pay attention to the path changes. My source package started in the/home/wcq folder, and now I want to move it to the/home/mongodb folder, in the terminal with the command to perform operations, enter the CP mongodb-linux-2.2.0.tgz/home/mongodb carriage return, This will be copied over the file, in the execution of it may prompt you the authority is not enough, you first enter the $ SU root Enter and then input your root password is good, in the execution of it will not be wrong. OK then we just enter $ tar zxvf mongodb-linux-2.2.0.tgz unzip it just fine. We will get a file named Mongodb-linux-2.2.0 folder   Second step, we are new to store after the Data folder and log folder, we are now in the/home/mongodb folder now we enter $ cd mongodb-linux-2.2.0 Enter, we now enter into the mongodb-linux-2.2.0 folder, we enter the $ mkdir data return, is created under the mongodb-linux-2.2.0 file on a data folder. Then enter $ CD data Enter, then enter $mkdir DB carriage return and enter the $ mkdir logs carriage return, so we are in the data folder created another called DB and a logs folder, and then we enter the $CD logs return, which entered into the logs file , then use the command to enter the $ touch mongodb.log carriage return and create a log file called Mongodb.log under logs.   Third Step, we enter $ cd http://www.cnblogs.com/Enter, we return to the mongodb-linux-2.2.0 folder, enter $ cd bin return, enter into the Bin folder, followed by the $ VI Mongodb.conf Enter, we create and open the Mongodb.conf file under the terminal, note that we are now editing this file under the VI command, we will dbpath =/data/db LogPath =/data/logs/ Mongodb.log Port = 28017 Fork = True Four line copy comes in, this time to note that if you create a second step in the Data folder in the DB and Logs folder name is different, the above four lines will also make corresponding changes, including the path also to modify(As I'm sure it won't be wrong), just take care of yourself at this point. OK at this time we completed the third step, the next will be compiled Yi and start ...   Fourth step, at this point we will enter some commands to start MongoDB, under the terminal command to look at their current path, we are now under the/home/mongodb/mongodb-linux-2.2.0/bin, right, you see. Then we enter the $ CD. Return to the Mongodb-linux-2.2.0 folder first, then we enter $./bin/mongod--dbpath=/data/db--logpath=/data/logs/mongodb.log--fork Enter, See what happens. Note At this point, if the terminal prompt is Error:not found/logs/mongodb.log or is the other error and not found that indicates that your path has a problem, then you have to carefully find the path of your file to No, look at the/bin/ There are no path errors in the four rows in the mongodb.conf. If the error is generally a path problem. If there are other tips ask the degree Niang ... Well, if the terminal prompt has started successfully appear, then congratulations on your installation success. We can now open the page input http://localhost:28017/will go to a page about MongoDB, which also proves that you installed successfully.   Fifth step, we'll start MongoDB next. Now it is under the mongodb-linux-2.2.0 file, we enter the $ CD bin to enter, go into the bin and we enter the $./mongo carriage return when it appears [[email protected] bin]#./mongo MongoDB S Hell version:2.2.0 connecting To:test >

1. Permissions Problem Resolution-bash:/home/mongodb/mongodb-linux-x86_64-2.6.3/bin/mongod: Insufficient permissions to fine-tune the set permissions to each specific file (clip) [[email protected] bin] # CD [[email protected] ~]# chmod 777/home/mongodb/mongodb-linux-x86_64-2.6.3/data [[email protected] ~]# chmod 777/hom e/mongodb/mongodb-linux-x86_64-2.6.3/data/db [[email protected] ~]# chmod 777/home/mongodb/mongodb-linux-x86_ 64-2.6.3/data/logs [[email protected] ~]# chmod 777/home/mongodb/mongodb-linux-x86_64-2.6.3/bin/mongod [email Protected] ~]#/home/mongodb/mongodb-linux-x86_64-2.6.3/bin/mongod--port=27017--fork--dbpath=/home/mongodb/ MONGODB-LINUX-X86_64-2.6.3/DATA/DB--

Logpath=/home/mongodb/mongodb-linux-x86_64-2.6.3/data/logs/mongodb.log--logappend about to fork child process, Waiting until server is a ready for connections. Forked process:6647 child process started successfully, parent exiting

2.windows connect to MongoDB in Linux

Open the configuration file Vi/etc/sysconfig/iptables, and add the following to the file: Firewall open port 27017

-A input-m state--state established,related-j accept-a input-p icmp-j accept-a input-i lo-j accept-a Input-m St ate --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT -A Input-j REJECT--reject-with icmp-host-prohibited-a forward-j REJECT--reject-with icmp-host-prohibited COMMIT

Then restart service iptables restart

Install MongoDB (GO) under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.