Buy Percona ServicesBuy Now!

Installing Percona Server for MongoDB on Debian and Ubuntu

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

  • Debian 8 (“jessie”)
  • Ubuntu 14.04 LTS (Trusty Tahr)
  • Ubuntu 16.04 LTS (Xenial Xerus)
  • Ubuntu 16.10 (Yakkety Yak)

Note

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

The packages are available in the official Percona software repositories and on the download page. It is recommended to intall Percona Server for MongoDB from repositories using apt.

Package Contents

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

Installing from Repositories

  1. Fetch the repository packages from Percona web:

    $ wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
    
  2. Install the downloaded package with dpkg by running the following command as root or with sudo:

    $ sudo dpkg -i percona-release_0.1-4.$(lsb_release -sc)_all.deb
    

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

  3. Update the local cache:

    $ sudo apt-get update
    
  4. Install the server package:

    $ sudo apt-get install percona-server-mongodb-34
    

Testing and Experimental Repositories

Percona offers pre-release builds from the testing repo, and early-stage development builds from the experimental repo. To enable them, add either testing or experimental at the end of the Percona repository definition in your repository file (by default, /etc/apt/sources.list.d/percona-release.list).

For example, if you are running Debian 8 (“jessie”) and want to install the latest testing builds, the definitions should look like this:

deb http://repo.percona.com/apt jessie main testing
deb-src http://repo.percona.com/apt jessie main testing

If you are running Ubuntu 14.04 LTS (Trusty Tahr) and want to install the latest experimental builds, the definitions should look like this:

deb http://repo.percona.com/apt trusty main experimental
deb-src http://repo.percona.com/apt trusty main experimental

Pinning the Packages

If you want to pin your packages to avoid upgrades, create a new file /etc/apt/preferences.d/00percona.pref and add the following lines to it:

Package: *
Pin: release o=Percona Development Team
Pin-Priority: 1001

For more information about pinning, refer to the official Debian Wiki.

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.

  • 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 folowing command:

    $ sudo service mongod start
    
  • Confirming that service is running

    Check the service status using the following command:

    $ sudo service mongod status
    
  • Stopping the service

    Stop the service using the following command:

    $ sudo service mongod stop
    
  • Restarting the service

    Restart the service using the following command:

    $ sudo service mongod restart
    

Note

Debian 8 (“jessie”) and Ubuntu 16.04 (Xenial Xerus) come with systemd as the default system and service manager. You can invoke all the above commands with sytemctl instead of service. Currently both are supported.

Uninstalling Percona Server for MongoDB

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

  1. Stop the server:

    $ sudo service mongod stop
    
  2. Remove the packages.

    • If you want to leave configuration and data files:

      $ sudo apt-get remove percona-server-mongodb*
      
    • If you want to delete configuration and data files as well as the packages:

      $ sudo apt-get purge percona-server-mongodb*
      
Visit Percona Store


General Inquiries

For general inquiries, please send us your question and someone will contact you.