Skip to main content
Version: 7.0

Alma/Rocky/CentOS

danger
  • If a replica set is used — 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 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 with configuration files:

yum erase mongodb-org* -y

Remove the directory with log files:

rm -r /var/log/mongodb

Remove MongoDB data files:

rm -r /var/lib/mongo

Remove the outdated repository for MongoDB 4.x:

rm -f /etc/yum.repos.d/mongodb-org-4.x.repo

Installation and backup restoration

Installation

Create a file to add the MongoDB repository to the yum package manager:

nano /etc/yum.repos.d/mongodb-org-6.0.repo

Place the following content in the file:

[mongodb-org-6.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/6.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://pgp.mongodb.com/server-6.0.asc

Install the database and administration utilities:

yum install mongodb-org -y

Start the mongod.service:

systemctl start mongod.service

Enable service autostart:

systemctl enable mongod.service

Check connection 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.