Downloading MongoDB binaries with Linux

in #mongodb7 years ago (edited)

How to get hold of the MongoDB binaries with different Linux-Distributions

MongoDB_Gray_Logo_FullColor_RGB-01-small.jpg

This guide will provide some ways to obtain the MongoDB software from

Your operating system's repository (Debian, Alpine)

If you are under Debian or Alpine Linux you might want to use the packets of your operating system's repo.
Be aware that these repos don't always hold the newest version of MongoDB.

If you encounter any error messages regarding https in the apt source list try: apt-get install apt-transport-https

Debian

apt-get install mongodb-server
| OR |
aptitude install mongodb-server

Alpine (see "Community" repo)

apk add mongodb

MongoDB's repositories (RHEL, CentOS, Debian, Ubuntu)

MongoDB provide their own repository. Each repo holds only the updates for major MongoDB versions (e.g 3.4 and 3.6) and are signed with different keys.
When you like to upgrade from 3.4 to 3.6 you'll have to install a new repo.

In order to install the respective repository for version 3.6 you'll have to execute:

Debian

sudo -s

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

echo "deb http://repo.mongodb.org/apt/debian [INSERT DEB VERSION]/mongodb-org/3.6 main" | tee /etc/apt/sources.list.d/mongodb-org-3.6.list

apt-get update

apt-get install mongodb-org-server

Currently as of January 2018 there is no repo for Debian Stretch (Debian 9).
Don't forget to insert your Debian's version in the url (jessie, stretch) - leave out the brackets.

Ubuntu

sudo -s

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

echo "deb https://repo.mongodb.org/apt/ubuntu [INSERT UBUNTU VERSION]/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

apt-get update

apt-get install mongodb-org-server

Don't forget to insert your Ubuntu's version in the url (trusty for 14.04, xenial for 16.04) - leave out the brackets.

RHEL, CentOS

For RHEL and CentOS see MongoDB Documentation (not tested by the author)

Direct download

If you need custom locations for your MongoDB daemon or multiple versions, you might download the tarball and extract it on the desired location.
After that you'll have to create a config file for MongoDB and a SystemD description file or an upstart / SysV start script.
You'll find the tarballs in the (MongoDB Download Center)[https://www.mongodb.com/download-center#community] under Community Server and your respective operating system.

Keep in mind that the Linux 64bit generic version wasn't compiled against any TLS-library and thus don't support TLS encrypted connections.