Vim mongodb_install.sh
#!/bin/bashcd /opt/echo "Download mongdb software ..." wget https://fastdl.mongodb.org/ linux/mongodb-linux-x86_64-ubuntu1404-3.0.4.tgzecho " mongdb software ..." tar -zxf mongodb-linux*.tgzmkdir softwaremv mongodb-linux-*.tgz softwaremv mongodb-linux* mongodbcd mongodb/echo "Create log,data,conf dir and create mongodb.log , mongod.conf "MKDIR LOG DATA CONFCD LOG/TOUCH MONGODB.LOG CD  cd confecho "Port = 12345dbpath = datalogpath = log/mongod.logfork = true #在linux中fork为启动后台命令 " >> MONGOD.CONFCD  echo "Create mongod.conf and transfer to /usr/bin" echo "#!/bin/bashcd /opt/mongodb/./bin/mongod -f conf/mongod.conf cd - " >> MONGOD.SHMV mongod.sh /usr/bin/chmod a+x /usr/bin/mongod.shecho "MODIFY /ETC/BASH.BASHRC" echo "alias mongod="/usr/bin/ Mongod.sh ' " >> /etc/bash.bashrcsource /etc/bash.bashrccd -
chmod a+x mongodb_install.sh
The root user is running this step./mongodb_install.sh
After the script runs, enter Mongod to start the MONGO service.
Start the client
Cd/opt/mongodb
[Email protected]:/opt/mongodb#./bin/mongo 127.0.0.1:12345/test
Accessing http://192.168.56.163:12345/in the browser
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6F/73/wKioL1WdCVOgg7SXAACdNU19Et4924.jpg "title=" Qq20150708191935.png "alt=" Wkiol1wdcvogg7sxaacdnu19et4924.jpg "/>
For manual Installation Please refer to: http://adelazhu.blog.51cto.com/9455045/1625360
This article from "Adela" blog, declined reprint!
Automatic installation of MongoDB shell script under Ubuntu 14.04