How to upgrade MongoDB from v4.4 to v7 on Linux System

Configuration Guide
Updated 08-28-2024 03:12:06 AM 4658
This Article Applies to: 

Contents

Objective

Requirements

Introduction

Upgrade MongoDB from v4.4 to v5

Upgrade MongoDB from v5 to v6

Upgrade MongoDB from v6 to v7

Verification

Conclusion

Objective

Here we introduce the commands our customers can use to upgrade MongoDB to the latest version on Linux system.

Requirements

  • Ubuntu 20.04, Ubuntu 22.04
  • Omada Software Controller
  • MongoDB

Introduction

On Linux system, the dependency MongoDB requires to be installed by the customer manually. MongoDB has strict requirements for inter-version data compatibility. If you need to upgrade your MongoDB in your Linux system, you should upgrade it version by version. In this article, we take Ubuntu 20.04 as an example to introduce the commands for upgrading MongoDB from v4.4 to v5, from v5 to v6, from v6 to v7. You can use the corresponding commands according to your need.

Upgrade MongoDB from v4.4 to v5

Step 1. Backup database and uninstall Controller.

You can use the following commands to uninstall Controller:

sudo dpkg -r omadac

A window will pop up. Choose Yes.

Choose Yes

Note: the backup db file will be restored in /opt/tplink/omada_db_backup

Backup the db.tar.gz file to another folder to restore once a failure happens, here we copy it to the folder /Document/dbbackupv4

Step 2. Uninstall MongoDB v4.4

Use the following commands to uninstall MongoDB v4.4:

sudo apt remove mongodb-*

Type y

Use the following command to delete file mongodb-org-4.4.list

sudo rm /etc/apt/sources.list.d/mongodb-org-4.4.list

Step 3. Install MongoDB v5

Use the following commands to install MongoDB v5:

curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | \

sudo gpg -o /usr/share/keyrings/mongodb-server-5.0.gpg \

--dearmor

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-5.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

sudo apt-get update

sudo apt-get install -y mongodb-org

Step 4. Reinstall Omada Software Controller

Go to where Omada Software Controller deb file stores, here we take omada_v5.14.26.1_linux_x64_20240621095737.deb as an example.

sudo dpkg -i omada_v5.14.26.1_linux_x64_20240621095737.deb

Choose yes, the controller will import the backup db file in /opt/tplink/omada_db_backup.

After installation, the Controller will start automatically.

Step 5. Change the FeatureCompatibilityVersion

When Controller starts up successfully. Use the following commands to startup Mongo Shell:

mongosh -port 27217

db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )

Upgrade MongoDB from v5 to v6

Step 1. Backup database and uninstall Controller.

Use the following commands to uninstall Controller:

sudo dpkg -r omadac

A window will pop up. Choose Yes

Choose Yes

Note: the backup db file will be restored in /opt/tplink/omada_db_backup

Backup the db.tar.gz file to another folder to restore once a failure happens, here we copy it to the folder /Document/dbbackupv5

Step 2. Uninstall MongoDB v5

Use the following commands to uninstall MongoDB v5:

sudo apt remove mongodb-*

Type y

sudo rm /etc/apt/sources.list.d/mongodb-org-5.0.list

Step3. Install MongoDB v6

Use the following commands to install MongoDB v6:

curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc | \

sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \

--dearmor

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] 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-get update

sudo apt-get install -y mongodb-org

Step 4. Reinstall Omada Software Controller

Go to where Omada Software Controller deb file stores, here we take omada_v5.14.26.1_linux_x64_20240621095737.deb as an example.

sudo dpkg -i omada_v5.14.26.1_linux_x64_20240621095737.deb

Choose yes, the controller will import the backup db file in /opt/tplink/omada_db_backup.

After installation, the Controller will start automatically.

Step 5. Change the FeatureCompatibilityVersion

When Controller starts up successfully. Use the following commands to start up Mongo Shell:

mongosh -port 27217

db.adminCommand( { setFeatureCompatibilityVersion: "6.0" } )

Upgrade MongoDB from v6 to v7

Step 1. Backup database and uninstall Controller

Use the following commands to uninstall Controller:

sudo dpkg -r omadac

A window will pop up. Choose yes

Choose yes

Note: the backup db file will be restored in /opt/tplink/omada_db_backup

Backup the db.tar.gz file to another folder to restore once a failure happens, here we copy it to the folder /Document/dbbackupv6

Step 2. Uninstall MongoDB v6

Use the following commands to uninstall MongoDB v6:

sudo apt remove mongodb-*

Type y

sudo rm /etc/apt/sources.list.d/mongodb-org-6.0.list

Step 3. Install MongoDB v7

Use the following commands to install MongoDB v7:

curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \

sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \

--dearmor

echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list

sudo apt-get update

sudo apt-get install -y mongodb-org

Step 4. Reinstall Omada Software Controller

Go to where Omada Software Controller deb file stores, here we take omada_v5.14.26.1_linux_x64_20240621095737.deb as an example.

sudo dpkg -i omada_v5.14.26.1_linux_x64_20240621095737.deb

Choose yes, the controller will import the backup db file in /opt/tplink/omada_db_backup.

After installation, the Controller will start automatically.

Step 5. Change the FeatureCompatibilityVersion

When Controller starts up successfully. Use the following commands to start up Mongo Shell:

mongosh -port 27217

db.adminCommand( { setFeatureCompatibilityVersion: "7.0", confirm: true } )

Verification

After Changing FeatureCompatibilityVersion, you can use the following command to check the result:

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

  • If you have changed FeatureCompatibilityVersion to 5.0, the result should be:

  • If you have changed FeatureCompatibilityVersion to 6.0, the result should be:

  • If you have changed FeatureCompatibilityVersion to 7.0, the result should be:

Conclusion

Now you have successfully upgrade your MongoDB from v4.4 to v7 on Linux System.

Get to know more details of each function and configuration please go to Download Center to download the manual of your product.

Looking for More

Is this faq useful?

Your feedback helps improve this site.

Recommend Products

Community

TP-Link Community

Still need help? Search for answers, ask questions, and get help from TP-Link experts and other users around the world.

Visit the Community >

From United States?

Get products, events and services for your region.