Installing Percona Server for MongoDB on Debian and Ubuntu

Percona provides .deb packages for 64-bit versions of the following distributions:

  • Debian 9 (stretch)
  • Debian 10 (buster)
  • Ubuntu 16.04 LTS (Xenial Xerus)
  • Ubuntu 18.04 LTS (Bionic Beaver)

Note

Percona Server for MongoDB should work on other DEB-based distributions, but it is tested only on platforms listed above.

Package Contents

Package Contains
percona-server-mongodb The mongo shell, import/export tools, other client utilities, server software, default configuration, and init.d scripts.
percona-server-mongodb-server The mongod server, default configuration files, and init.d scripts
percona-server-mongodb-shell The mongo shell
percona-server-mongodb-mongos The mongos sharded cluster query router
percona-server-mongodb-tools Mongo tools for high-performance MongoDB fork from Percona
percona-server-mongodb-dbg Debug symbols for the server

Installing from Percona Repositories

It is recommended to install Percona Server for MongoDB from official Percona repositories using the percona-release utility:

Important

If percona-release is already installed on the target system, make sure you are using the latest version of percona-release:

Run the following commands as root or by using the sudo command

  1. Fetch the repository packages from Percona web:

    $ wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
    
  2. Install the downloaded package with dpkg:

    $ dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
    

    Once you install this package the Percona repositories should be added. You can check the repository setup in the /etc/apt/sources.list.d/percona-release.list file.

  3. Enable the repository: percona-release enable psmdb-42 release

  4. Remember to update the local cache: apt update

  5. Install the Percona Server for MongoDB package: apt install percona-server-mongodb

Using Percona Server for MongoDB

By default, Percona Server for MongoDB stores data files in /var/lib/mongodb/ and configuration parameters in /etc/mongod.conf.

Run the following commands as root or by using the sudo command

Starting the service
Percona Server for MongoDB is started automatically after installation unless it encounters errors during the installation process. You can also manually start it using the following command: service mongod start
Confirming that service is running**
Check the service status using the following command: service mongod status
Stopping the service
Stop the service using the following command: service mongod stop
Restarting the service
Restart the service using the following command: service mongod restart

Note

On Debian 8, Ubuntu 16.04 and later versions you can also invoke all the above commands with sytemctl instead of service.

Uninstalling Percona Server for MongoDB

To uninstall Percona Server for MongoDB, remove all the installed packages. Removing packages with apt remove will leave the configuration and data files. Removing the packages with apt purge will remove all the packages with configuration files and data. Depending on your needs you can choose which command better suits you.

Run the following commands as root or by using the sudo command

  1. Stop the mongod server: service mongod stop
  2. Remove the packages. There are two options. To keep the configuration and data files, run apt remove percona-server-mongodb*. If you want to delete the configuration and data files as well as the packages, use apt purge: apt purge percona-server-mongodb*