Error "cannot connect to server" installing MongoDB on Ubuntu I'm trying to install MongoDB on Ubuntu 10.04.  

I followed these installation instructions. I got the following error: 

Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91


What do I need to do to fix this?

Here is the log output:

**** SERVER RESTARTED *****

&gt; Sun Sep 23 22:36:20 
Sun Sep 23 22:36:20 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Sun Sep 23 22:36:20 
Sun Sep 23 22:36:20 [initandlisten] MongoDB starting : pid=1916 port=27017 dbpath=/var/lib/mongodb 32-bit host=bruce-ubuntu1004
Sun Sep 23 22:36:20 [initandlisten] 
Sun Sep 23 22:36:20 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Sun Sep 23 22:36:20 [initandlisten] **       see (http://)blog.mongodb.org/post/137788967/32-bit-limitations
Sun Sep 23 22:36:20 [initandlisten] **       with --journal, the limit is lower
Sun Sep 23 22:36:20 [initandlisten] 
Sun Sep 23 22:36:20 [initandlisten] db version v2.2.0, pdfile version 4.5
Sun Sep 23 22:36:20 [initandlisten] git version: f5e83eae9cfbec7fb7a071321928f00d1b0c5207
Sun Sep 23 22:36:20 [initandlisten] build info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_49
Sun Sep 23 22:36:20 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Sun Sep 23 22:36:20 [initandlisten] Unable to check for journal files due to: boost::filesystem::basic_directory_iterator constructor: No such file or directory: "/var/lib/mongodb/journal"
************** 
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Sun Sep 23 22:36:20 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Sun Sep 23 22:36:20 dbexit: 
Sun Sep 23 22:36:20 [initandlisten] shutdown: going to close listening sockets...
Sun Sep 23 22:36:20 [initandlisten] shutdown: going to flush diaglog...
Sun Sep 23 22:36:20 [initandlisten] shutdown: going to close sockets...
Sun Sep 23 22:36:20 [initandlisten] shutdown: waiting for fs preallocator...
Sun Sep 23 22:36:20 [initandlisten] shutdown: closing all files...
Sun Sep 23 22:36:20 [initandlisten] closeAllFiles() finished
Sun Sep 23 22:36:20 dbexit: really exiting now
You probably just need to delete the lock file in /var/lib/mongodb, and then restart the service.

If you still have problems, you should run mongod --repair (along with the other options, at least the dbpath).