Skip to main content
Version: 7.0

Debian

danger
  • If a replica set is used — please contact Passwork technical support for proper updating and data preservation.
  • If Passwork is installed on a virtual server, it is recommended to create a virtual snapshot of the OS before updating.
info

The instructions use switchable code blocks to separate commands according to operating system versions.

Preparation and removal of the outdated version

Creating a backup

Create a directory:

mkdir /backup

Create a backup:

mongodump --out /backup/mongo-$(date +\%Y-\%m-\%d_\%H-\%M-\%S)

Removal

Stop the service:

systemctl stop mongod.service

Move the configuration file:

mv /etc/mongod.conf ./

Remove the database along with configuration files:

apt purge mongodb-org* -y

Remove the directory with log files:

rm -r /var/log/mongodb

Remove MongoDB data files:

rm -r /var/lib/mongodb

Remove the outdated repository for MongoDB 4.x:

rm -f /etc/apt/sources.list.d/mongodb-org-4.x.list

Update the list of available packages:

apt-get update

Installation and backup restoration

Installation

Download and add the MongoDB GPG key:

wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -

Add the MongoDB repository to the file:

echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

Update the list of available packages:

apt-get update

Install MongoDB using the apt package manager:

apt-get install -y mongodb-org

Start the mongod.service:

systemctl start mongod.service

Enable the service to start automatically:

systemctl enable mongod.service

Perform a connection check to the shell:

mongosh mongodb://localhost:27017

Backup restoration

If the connection to the shell is successful, restore the databases from the backup:

mongorestore --drop /backup/mongo-xxxx-xx-xx_xx-xx-xx
danger

If you made changes to the MongoDB configuration file (mongod.conf), you need to replace the new file with the old one:

cp ./mongod.conf /etc/

Restart the mongod.service:

systemctl restart mongod.service

Open Passwork to verify correct operation.