$ sudo gedit /etc/mongod.conf
and comment out the line bind_ip = 127.0.0.1
and sudo service mongod restart
.
Last active
August 29, 2015 14:17
-
-
Save ozooxo/eaf22a284dbfe8d116df to your computer and use it in GitHub Desktop.
Install MongoDB etc for "MongoDB University M101J" course in Ubuntu 14.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beta@landlubber:~$ uname -a | |
Linux landlubber 3.13.0-46-generic #79-Ubuntu SMP Tue Mar 10 20:06:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux | |
beta@landlubber:~$ java -version | |
java version "1.7.0_76" | |
Java(TM) SE Runtime Environment (build 1.7.0_76-b13) | |
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode) | |
beta@landlubber:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
[sudo] password for beta: | |
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.OFXWl1OKUd --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/minecraft-installer-peeps-minecraft-installer.gpg --keyring /etc/apt/trusted.gpg.d/webupd8team-java.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
gpg: requesting key 7F0CEB10 from hkp server keyserver.ubuntu.com | |
gpg: key 7F0CEB10: public key "Richard Kreuter <richard@10gen.com>" imported | |
gpg: Total number processed: 1 | |
gpg: imported: 1 (RSA: 1) | |
beta@landlubber:~$ echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list | |
deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse | |
beta@landlubber:~$ sudo apt-get update | |
beta@landlubber:~$ sudo apt-get install -y mongodb-org | |
beta@landlubber:~$ echo "mongodb-org hold" | sudo dpkg --set-selections | |
beta@landlubber:~$ echo "mongodb-org-server hold" | sudo dpkg --set-selections | |
beta@landlubber:~$ echo "mongodb-org-shell hold" | sudo dpkg --set-selections | |
beta@landlubber:~$ echo "mongodb-org-mongos hold" | sudo dpkg --set-selections | |
beta@landlubber:~$ echo "mongodb-org-tools hold" | sudo dpkg --set-selections | |
beta@landlubber:/$ sudo mkdir -p /data/db | |
beta@landlubber:~$ sudo chmod 777 /data | |
beta@landlubber:~$ sudo chmod 777 /data/db | |
beta@landlubber:~$ ls -ld /data/db | |
drwxrwxrwx 2 root root 4096 Mar 22 10:59 /data/db | |
beta@landlubber:~$ sudo gedit /etc/mongodb.conf # and change to this line: dbpath=/data/db | |
beta@landlubber:~$ whoami | |
beta | |
beta@landlubber:~$ which mongod | |
/usr/bin/mongod | |
beta@landlubber:~$ sudo service mongod restart # It should already been started, but I just want to make sure that that's the case. | |
mongod stop/waiting | |
mongod start/running, process 2755 | |
beta@landlubber:~$ grep "waiting for connections on port" /var/log/mongodb/mongod.log # make sure that mongod is started successfully | |
2015-03-22T11:15:40.659+0800 I NETWORK [initandlisten] waiting for connections on port 27017 | |
beta@landlubber:~$ mongod # One of the differences is that mongod will automatically exit itself, rather than (as the Mac OS tutorial gives in lectures) that we need to manually exists it by Ctrl-C | |
... | |
2015-03-22T11:16:05.786+0800 I CONTROL [initandlisten] MongoDB starting : pid=2774 port=27017 dbpath=/data/db 64-bit host=landlubber | |
... | |
2015-03-22T11:16:06.187+0800 I CONTROL [initandlisten] dbexit: rc: 48 | |
beta@landlubber:~$ mongo # I tried to modify "/sys/kernel/mm/transparent_hugepage/enabled" etc, but it seems that files in "/sys/kernel" cannot be sodu modified?? | |
MongoDB shell version: 3.0.1 | |
connecting to: test | |
Welcome to the MongoDB shell. | |
For interactive help, type "help". | |
For more comprehensive documentation, see | |
http://docs.mongodb.org/ | |
Questions? Try the support group | |
http://groups.google.com/group/mongodb-user | |
Server has startup warnings: | |
2015-03-22T11:15:40.630+0800 I CONTROL [initandlisten] | |
2015-03-22T11:15:40.630+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. | |
2015-03-22T11:15:40.630+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never' | |
2015-03-22T11:15:40.630+0800 I CONTROL [initandlisten] | |
2015-03-22T11:15:40.630+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. | |
2015-03-22T11:15:40.630+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never' | |
2015-03-22T11:15:40.630+0800 I CONTROL [initandlisten] | |
> db.names.insert({'name':'beta'}) | |
WriteResult({ "nInserted" : 1 }) | |
> db.names.find() | |
{ "_id" : ObjectId("550e355f4fdf3bab3972b951"), "name" : "beta" } | |
> quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment