There are four steps involved in instaling and testing MongoDB in Linux Mint.
- Download the MongoDB Server.
- Configure Data Folder.
- Start MongoDB.
- Start Mongo Shell Client.
Download MongoDB Server.
Make sure that the MongoDB is not installed in your machine before you download MongoDB. Open a shell and type mongod.
1 2 3 |
thosan@thosan-hp ~ $ mongod The program 'mongod' is currently not installed. You can install it by typing: sudo apt-get install mongodb-server |
Shell will notify you with approprate message if the MongoDB is not installed in your machine.
Type sudo apt-get install mongodb-server and enter to download the mongodb server.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
thosan@thosan-hp ~ $ sudo apt-get install mongodb-server [sudo] password for thosan: Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libboost-filesystem1.49.0 libboost-program-options1.49.0 libboost-system1.49.0 libboost-thread1.49.0 libgoogle-perftools4 libpcrecpp0 libsnappy1 libtcmalloc-minimal4 libunwind8 mongodb-clients The following NEW packages will be installed: libboost-filesystem1.49.0 libboost-program-options1.49.0 libboost-system1.49.0 libboost-thread1.49.0 libgoogle-perftools4 libpcrecpp0 libsnappy1 libtcmalloc-minimal4 libunwind8 mongodb-clients mongodb-server 0 upgraded, 11 newly installed, 0 to remove and 290 not upgraded. Need to get 26.3 MB of archives. After this operation, 66.2 MB of additional disk space will be used. Do you want to continue [Y/n]? Y Get:1 http://archive.ubuntu.com/ubuntu/ raring/main libpcrecpp0 amd64 1:8.31-2 [16.5 kB] Get:2 http://archive.ubuntu.com/ubuntu/ raring/main libunwind8 amd64 1.0.1-4ubuntu2 [55.9 kB] Get:3 http://archive.ubuntu.com/ubuntu/ raring/main libboost-system1.49.0 amd64 1.49.0-3.2ubuntu1 [14.7 kB] Get:4 http://archive.ubuntu.com/ubuntu/ raring/main libboost-filesystem1.49.0 amd64 1.49.0-3.2ubuntu1 [52.9 kB] Get:5 http://archive.ubuntu.com/ubuntu/ raring/main libboost-program-options1.49.0 amd64 1.49.0-3.2ubuntu1 [135 kB] Get:6 http://archive.ubuntu.com/ubuntu/ raring/main libboost-thread1.49.0 amd64 1.49.0-3.2ubuntu1 [41.6 kB] Get:7 http://archive.ubuntu.com/ubuntu/ raring/main libtcmalloc-minimal4 amd64 2.0-4ubuntu1 [163 kB] Get:8 http://archive.ubuntu.com/ubuntu/ raring/main libgoogle-perftools4 amd64 2.0-4ubuntu1 [412 kB] Get:9 http://archive.ubuntu.com/ubuntu/ raring/main libsnappy1 amd64 1.0.5-2 [13.2 kB] Get:10 http://archive.ubuntu.com/ubuntu/ raring/universe mongodb-clients amd64 1:2.2.4-0ubuntu1 [20.2 MB] Get:11 http://archive.ubuntu.com/ubuntu/ raring/universe mongodb-server amd64 1:2.2.4-0ubuntu1 [5,196 kB] Fetched 26.3 MB in 33s (780 kB/s) Selecting previously unselected package libpcrecpp0:amd64. (Reading database ... 146201 files and directories currently installed.) Unpacking libpcrecpp0:amd64 (from .../libpcrecpp0_1%3a8.31-2_amd64.deb) ... Selecting previously unselected package libunwind8. Unpacking libunwind8 (from .../libunwind8_1.0.1-4ubuntu2_amd64.deb) ... Selecting previously unselected package libboost-system1.49.0. Unpacking libboost-system1.49.0 (from .../libboost-system1.49.0_1.49.0-3.2ubuntu1_amd64.deb) ... Selecting previously unselected package libboost-filesystem1.49.0. Unpacking libboost-filesystem1.49.0 (from .../libboost-filesystem1.49.0_1.49.0-3.2ubuntu1_amd64.deb) ... Selecting previously unselected package libboost-program-options1.49.0. Unpacking libboost-program-options1.49.0 (from .../libboost-program-options1.49.0_1.49.0-3.2ubuntu1_amd64.deb) ... Selecting previously unselected package libboost-thread1.49.0. Unpacking libboost-thread1.49.0 (from .../libboost-thread1.49.0_1.49.0-3.2ubuntu1_amd64.deb) ... Selecting previously unselected package libtcmalloc-minimal4. Unpacking libtcmalloc-minimal4 (from .../libtcmalloc-minimal4_2.0-4ubuntu1_amd64.deb) ... Selecting previously unselected package libgoogle-perftools4. Unpacking libgoogle-perftools4 (from .../libgoogle-perftools4_2.0-4ubuntu1_amd64.deb) ... Selecting previously unselected package libsnappy1. Unpacking libsnappy1 (from .../libsnappy1_1.0.5-2_amd64.deb) ... Selecting previously unselected package mongodb-clients. Unpacking mongodb-clients (from .../mongodb-clients_1%3a2.2.4-0ubuntu1_amd64.deb) ... Selecting previously unselected package mongodb-server. Unpacking mongodb-server (from .../mongodb-server_1%3a2.2.4-0ubuntu1_amd64.deb) ... Processing triggers for man-db ... Processing triggers for ureadahead ... ureadahead will be reprofiled on next reboot Setting up libpcrecpp0:amd64 (1:8.31-2) ... Setting up libunwind8 (1.0.1-4ubuntu2) ... Setting up libboost-system1.49.0 (1.49.0-3.2ubuntu1) ... Setting up libboost-filesystem1.49.0 (1.49.0-3.2ubuntu1) ... Setting up libboost-program-options1.49.0 (1.49.0-3.2ubuntu1) ... Setting up libboost-thread1.49.0 (1.49.0-3.2ubuntu1) ... Setting up libtcmalloc-minimal4 (2.0-4ubuntu1) ... Setting up libgoogle-perftools4 (2.0-4ubuntu1) ... Setting up libsnappy1 (1.0.5-2) ... Setting up mongodb-clients (1:2.2.4-0ubuntu1) ... Setting up mongodb-server (1:2.2.4-0ubuntu1) ... Adding system user `mongodb' (UID 110) … Adding new user `mongodb' (UID 110) with group `nogroup' … Not creating home directory `/home/mongodb'. Adding group `mongodb' (GID 116) … Done. Adding user `mongodb' to group `mongodb' ... Adding user mongodb to group mongodb Done. |
Configure Data Folder.
You need to create /data/db folder or pass –dbpath argument to mongod process to start mongod.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
thosan@thosan-hp ~ $ mongod mongod --help for help and startup options Mon Nov 4 18:56:19 [initandlisten] MongoDB starting : pid=16024 port=27017 dbpath=/data/db/ 64-bit host=thosan-hp Mon Nov 4 18:56:19 [initandlisten] db version v2.2.4, pdfile version 4.5 Mon Nov 4 18:56:19 [initandlisten] git version: nogitversion Mon Nov 4 18:56:19 [initandlisten] build info: Linux batsu 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 BOOST_LIB_VERSION=1_49 Mon Nov 4 18:56:19 [initandlisten] options: {} Mon Nov 4 18:56:19 [initandlisten] exception in initAndListen: 10296 ********************************************************************* ERROR: dbpath (/data/db/) does not exist. Create this directory or give existing directory in --dbpath. See http://dochub.mongodb.org/core/startingandstoppingmongo ********************************************************************* , terminating Mon Nov 4 18:56:19 dbexit: Mon Nov 4 18:56:19 [initandlisten] shutdown: going to close listening sockets... Mon Nov 4 18:56:19 [initandlisten] shutdown: going to flush diaglog... Mon Nov 4 18:56:19 [initandlisten] shutdown: going to close sockets... Mon Nov 4 18:56:19 [initandlisten] shutdown: waiting for fs preallocator... Mon Nov 4 18:56:19 [initandlisten] shutdown: lock for final commit... Mon Nov 4 18:56:19 [initandlisten] shutdown: final commit... Mon Nov 4 18:56:19 [initandlisten] shutdown: closing all files... Mon Nov 4 18:56:19 [initandlisten] closeAllFiles() finished Mon Nov 4 18:56:19 dbexit: really exiting now |
Create /data/db folder.
1 2 |
sudo mkdir -p /data/db [sudo] password for thosan: |
Change the owner of the /data/db folder
1 2 |
thosan@thosan-hp ~ $ sudo chown mongodb /data/db [sudo] password for thosan: |
Start MongoDB.
Open a shell and type ‘mongod’ and enter to start MongoDB.
1 2 3 4 5 6 7 8 9 10 |
thosan@thosan-hp ~ $ mongod mongod --help for help and startup options Tue Nov 5 23:59:56 [initandlisten] MongoDB starting : pid=24373 port=27017 dbpath=/data/db/ 64-bit host=thosan-hp Tue Nov 5 23:59:56 [initandlisten] db version v2.2.4, pdfile version 4.5 Tue Nov 5 23:59:56 [initandlisten] git version: nogitversion Tue Nov 5 23:59:56 [initandlisten] build info: Linux batsu 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 BOOST_LIB_VERSION=1_49 Tue Nov 5 23:59:56 [initandlisten] options: {} Tue Nov 5 23:59:56 [initandlisten] journal dir=/data/db/journal Tue Nov 5 23:59:56 [initandlisten] recover : no journal files present, no recovery needed Wed Nov 6 00:00:01 [initandlisten] preallocateIsFaster=true 58.46 |
Start Mongo Shell Client.
This is an optional step in the instalation. You can start the mongo client and test if the installation was correct or not.
1 2 3 4 5 6 7 8 9 10 11 |
thosan@thosan-hp ~/java/gitrepo/sr $ mongo MongoDB shell version: 2.2.4 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 > db.createCollection('student', {name:String, course:String}) { "ok" : 1 } |
https://nz.activeketocapsules.com active KETO Capsules pharmacy.