xxxxxxxxxx
## Step 1: Install MongoDB on Ubuntu 22.04
sudo apt install software-properties-common gnupg apt-transport-https ca-certificates -y
## Step 1: import the public key for MongoDB
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
## Step 3: Next, add MongoDB 7.0 APT repository to the /etc/apt/sources.list.d directory.
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
## Step 4: reload the local package index
sudo apt update
## Step 5: install
sudo apt install mongodb-org -y
## Step 6: confirm
mongod --version
xxxxxxxxxx
Install MongoDB on Ubuntu
- Ensuring the server is up to date:
$ sudo apt update
$ sudo apt upgrade -y
$ sudo apt dist-upgrade -y
- Install Required Packages:
$ sudo apt install gnupg
$ echo "deb http://security.ubuntu.com/ubuntu impish-security main" | sudo tee /etc/apt/sources.list.d/impish-security.list
sudo apt update
sudo apt install libssl1.1
- Install MongoDB
$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
$ sudo apt update
$ sudo apt install -y mongodb-org
Once installed, check the version of MongoDB:
$ mongod -version
Once the service has been installed, start and enabling MongoDB Service:
$ sudo systemctl start mongod
$ sudo systemctl status mongod
Our MongoDB service is up and running, then enable it to start
on boot using:
$ sudo systemctl enable mongod
xxxxxxxxxx
echo "deb http://security.ubuntu.com/ubuntu impish-security main" | sudo tee /etc/apt/sources.list.d/impish-security.list
sudo apt-get update
sudo apt-get install libssl1.1
xxxxxxxxxx
FOR WSL2
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo nano /etc/init.d/mongod
paste this content in the file 'https://raw.githubusercontent.com/mongodb/mongo/master/debian/init.d'
#give permissions
sudo chmod +x /etc/init.d/mongod
#start the service
sudo service mongod start
xxxxxxxxxx
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
sudo dpkg -i ./libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
sudo apt update
sudo apt install mongodb-org
xxxxxxxxxx
sudo add-apt-repository 'deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse'Copy
xxxxxxxxxx
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
xxxxxxxxxx
curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc|sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-6.gpg