Install mongodb on Ali Cloud server
Connect ali cloud server
The operation process
1. Update your bag first, more is more harmless.
sudo yum -y update
2, create a mongodb-org.repo file in /etc/yum.repos
sudo touch /etc/yum.repos.d/mongodb-org.repo
3. Edit the mongodb-org.repo file
sudo vi /etc/yum.repos.d/mongodb-org.repo
4. Enter the following information to save the Settings and exit
[mongo – org] name = mongo Repository baseurl=mirrors.aliyun.com/mongodb/yum… gpgcheck=0 enabled=1
5. Install MongoDB
sudo yum install -y mongodb-org
6. Start MongoDB
sudo service mongod start
7. Set boot
sudo chkconfig mongod on
8. Open MongoDB
sudo /bin/mongo
9. Configure remote access
Edit/etc/mongod. Conf
Annotation bindIp: 127.0.0.1
Restart sudo service mongod restart
Mongo. conf file will not be created by mongodb. After installing the mongo.conf file, you need to configure global environment variables.
/ usr/local/mongo/mongo. Conf writes: dbpath=/usr/local/mongodb/data logpath=/usr/local/mongodb/mongod.log logappend = true port = 27017 fork = true auth = True finally implement mongod -- config/usr/local/mongo/mongo. ConfCopy the code
Execute mongo command
With respect to OK.