MongoDB 3.2 on Ubuntu 15.10
This brief tutorial is going to show you how to easily install MongoDB database server on Ubuntu 15.10 without any troubles.
A stable version of MongoDB packages are already in the default Ubuntu repository. However, the version in Ubuntu’s repository isn’t the latest. If you want to install the latest version you must add a third-party repository to your system and install it from there.
You can find more information about MongoDB and its installation here:
To do that, run the commands to add the repository’s key to your system. Without this key, you won’t be able to install packages from the repository.
user@HOST:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Next, run the commands below to add the repository to your machine
user@HOST:~$ echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
Update your system and refresh existing repositories by running the commands below.
user@HOST:~$ sudo apt-get update
Now you can install the latest MongoDB version through the following command.
user@HOST:~$ sudo apt-get install -y mongodb-org
If you are on Ubuntu 14.04 or 14.02 this was the final step but for the 15.10 version we have to set up some extra configuration so let’s start to check if the actual installation is good as it is now. To do that launch the command reported below.
user@HOST:~$ sudo systemctl status mongod
If the result of this command tell us that there’s no one mongod active process on the system try to restart the system and rerun the predecing test and if we obtain the same result we need to use the following script to fix the things.
So after downloaded the script execute it as follow:
user@HOST:~$ sudo chmod 755 enable_mongo.sh
user@HOST:~$ sudo ./enable_mongo.sh
Now all is ok and you can try to connect to your MongoDB server by mongo client
In response to this command we should receive something like the picture reported below.
Finally we finished to install and can have fun with our MongoDB server.