MongoDB 4 Quick Start Guide
上QQ阅读APP看书,第一时间看更新

Installing on Debian or Ubuntu Linux

Debian Linux (https://www.debian.org/), self-described as the universal operating system, is a free open-source project that uses a fork of the Linux kernel, and draws heavily upon GNU (http://www.gnu.org/software/software.html, for example, GNU Not Unix) software. Ubuntu Linux (https://www.ubuntu.com/) is produced by the Canonical Group Ltd based in South Africa, and is based upon Debian. For the purposes of this book, we will focus on Ubuntu version 18.04, code-named Bionic Beaver, released in April 2018, a designated LTS (Long Term Support) version.

The preferred way to install any given software on Ubuntu is to use a Debian package. Such packages have the extension *.deb and include a script that tells the package management program where to place the pre-compiled binary files as they are extracted. Popular package management programs include synaptic (http://www.nongnu.org/synaptic/, graphical interface, resolves dependencies, and does a lot of "housekeeping"), aptitude (https://help.ubuntu.com/lts/serverguide/aptitude.html, like synaptic but has a textual, command-line menu), and apt-* (that is apt-get (https://linux.die.net/man/8/apt-get), apt-key so on: very fast, command-line only). For the purposes of this section we will use apt-get.

Ubuntu provides its own MongoDB package, which is what gets installed if you simply run sudo apt-get install mongodb. To get the latest "official" version directly from MongoDB, you should follow the procedure outlined as follows. If you already have installed the Ubuntu mongodb package, you will need to first uninstall it before proceeding.

The MongoDB packages available for Ubuntu/Debian include the following:

 

In addition, a composite package, mongodb-org, which contains all four of these packages, is provided.