- Linux:Powerful Server Administration
- Uday R. Sawant Oliver Pelz Jonathan Hobson William Leemans
- 263字
- 2021-07-09 18:16:56
Installing MongoDB
Until now, we have worked with the relational database server, MySQL. In this recipe, we will learn how to install and configure MongoDB, which is a not only SQL (NoSQL) document storage server.
Getting ready
You will need access to a root account or an account with sudo
privileges.
How to do it…
To get the latest version of MongoDB, we need to add the MongoDB source to Ubuntu installation sources:
- First, import the MongoDB GPG public key:
$ sudo apt-key adv \ --keyserver hkp://keyserver.ubuntu.com:80 \ --recv 7F0CEB10
- Create a
list
file and add an install source to it:$ 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
- Update the
apt
repository sources and install the MongoDB server:$ sudo apt-get update $ sudo apt-get install -y mongodb-org
- After installation completes, check the status of the MongoDB server:
$ sudo service mongod status
- Now you can start using the MongoDB server. To access the Mongo shell, use the following command:
$ mongo
How it works…
We have installed the MongoDB server from the MongoDB official repository. The Ubuntu package repository includes the MongoDB package in it, but it is not up to date with the latest release of MongoDB. With GPG keys, Ubuntu ensures the authenticity of the packages being installed. After importing the GPG key, we have created a list
file that contains the installation source of the MongoDB server.
After installation, the MongoDB service should start automatically. You can check logs at /var/log/mongodb/mongod.log
.
See also
- MongoDB installation guide at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
- Splunk 7 Essentials(Third Edition)
- 返璞歸真:UNIX技術內幕
- 數據產品經理:解決方案與案例分析
- 21天學通Visual Basic
- AWS Administration Cookbook
- Windows 7寶典
- Mastering Game Development with Unreal Engine 4(Second Edition)
- Godot Engine Game Development Projects
- Word 2007,Excel 2007辦公應用融會貫通
- Visual C++項目開發案例精粹
- 基于ARM9的小型機器人制作
- 數字多媒體技術基礎
- 計算機硬件技術基礎(第2版)
- DynamoDB Applied Design Patterns
- Generative Adversarial Networks Projects