Install MongoDB 4.4

Exported on 23-Aug-2021 15:13:34

Parameters

Name Type Script Reference Default Value Comment
Linux - Debian 10 Linux / Unix Server linuxDebian10
Linux User Linux OS Credential linuxUser

1 - Mongo: Prepare system packages

The connection details have changed from the last step.

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
if command -v yum &> /dev/null
then
    echo "You are using yum package manager"
    sudo yum update -y
    sudo yum install -y \
        curl \
        redhat-lsb-core \
        chkconfig
elif command -v apt &> /dev/null
then
    echo "You are using apt package manager"
    sudo apt update
    sudo apt install -y \
        gnupg-agent \
        curl \
        apt-transport-https \
        lsb-release \
        ca-certificates \
        software-properties-common
else
    echo "Did not know witch package manager OS its using"
    exit
fi

2 - Mongo conf files

Login as user on node

Connect via SSH
ssh user@hostname
Deploy archive mongo4.4.zip to remote path files/
  1. Locate Files archive "mongo4.4.zip", This can be downloaded from Attune
  2. Copy the Files archive to the server
  3. Extract the root of the Files archive to files/, relative to the home directory
  4. Check that the files are in the correct location

3 - Install MongoDB 4.4 CE

Login as user on node

Connect via SSH
ssh user@hostname
This is a Bash Script make sure you run it with bash -l from a terminal session
dist=$(lsb_release -is)

if [ "$dist" == "CentOS" ]; then
sudo cp files/centos-mongodb-org-4.4.repo /etc/yum.repos.d/mongodb-org-4.4.repo
sudo yum update -y
sudo yum install -y mongodb-org

elif [ "$dist" == "Fedora" ]; then
sudo cp files/fedora-mongodb.repo /etc/yum.repos.d/mongodb.repo
sudo yum update -y
sudo yum install -y mongodb-org mongodb-org-server 

sudo systemctl enable mongod.service
sudo systemctl start mongod.service

elif [ "$dist" == "Debian" ] || [ "$dist" == "Ubuntu" ]; then
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
fi