Oracle's purchase of MySQL has made many database projects significantly prosper in order to be a powerful and free alternative to MySQL. In the web field, MySQL is being replaced by MariaDB, a powerful database and very similar to MySQL, but there are more alternatives and stable databases that we can use for the web world, for our applications or simply to use in our Ubuntu.
In this case we are going to tell you how to install MongoDB, a powerful, very powerful database that is also open source. However, the latest version of this database is not available for Ubuntu. That is why we are going to tell you how to install it in our Ubuntu.
The installation that we are going to tell you belongs to Ubuntu 16.04 but we can do it with other more current systems such as Ubuntu 16.10 or Ubuntu 17.04. To install MongoDB in Ubuntu we only have to open a terminal and perform the installation with an external repository:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list sudo apt-get update sudo apt-get install -y mongodb-org
After this, the installation of the latest version of MongoDB in our Ubuntu will begin. But this is not the only thing we have to do. So that MongoDB works correctly when we start the system we have to edit the service file. To do this we open a terminal and write the following:
sudo nano /etc/systemd/system/mongodb.service
And in the file that appears, we paste the following text at the end:
[Unit] Description=High-performance, schema-free document-oriented database After=network.target Documentation=https://docs.mongodb.org/manual [Service] User=mongodb Group=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf [Install] WantedBy=multi-user.target
We save the text by pressing Ctrl + O and close by pressing Ctrl + X. Now we restart the services related to MongoDB for the changes to take effect:
sudo systemctl daemon-reload sudo systemctl enable mongod sudo systemctl start mongod
And with this we already have MongoDB in our Ubuntu. As you can see, it is a simple installation system but somewhat longer than doing two clicks with the Ubuntu software manager.
I get this error:
Failed to enable unit: Unit file mongod.service does not exist.
Failed to start mongod.service: Unit mongod.service not found.
How can I solve that?
Did you find a solution? the same thing appears to me ..