Skip to content

Build from source code

Prerequisites

Building the project requires:

  • Go 1.19 or above
  • make
  • git
  • krb5-devel for Red Hat Enterprise Linux / CentOS or libkrb5-dev for Debian / Ubuntu. This package is required for Kerberos authentication in Percona Server for MongoDB.

Procedure

1. Clone the repository

$ git clone https://github.com/percona/percona-backup-mongodb

2. Go to the project directory and build it

$ cd percona-backup-mongodb
$ make build

After make completes, you can find pbm and pbm-agent binaries in the ./bin directory:

$ cd bin
$ ./pbm version

To verify if Percona Backup for MongoDB has been built correctly and is ready for use, run

$ pbm version

Output

Version:   [pbm version number]
Platform:  linux/amd64
GitCommit: [commit hash]
GitBranch: main
BuildTime: [time when this version was produced in UTC format]
GoVersion: [Go version number]

Tip

Instead of specifying the path to pbm binaries, you can add it to the PATH environment variable:

$ export PATH=/percona-backup-mongodb/bin:$PATH

Post-install steps

  1. Create the environment file:

    $ touch /etc/default/pbm-agent
    
  2. Create the pbm-agent.service systemd unit file.

    $ sudo vim /lib/systemd/system/pbm-agent.service
    
  3. In the pbm-agent.service file, specify the following:

    [Unit]
    Description=pbm-agent
    After=time-sync.target network.target
    
    [Service]
    EnvironmentFile=-/etc/default/pbm-agent
    Type=simple
    User=mongod
    Group=mongod
    PermissionsStartOnly=true
    ExecStart=/usr/bin/pbm-agent
    
    [Install]
    WantedBy=multi-user.target
    

    Note

    Make sure that the ExecStart directory includes the Percona Backup for MongoDB binaries. Otherwise, copy them from the ./bin directory of you installation path.

  4. Make systemd aware of the new service:

    $ sudo systemctl daemon-reload
    
  1. Create the environment file:

    $ touch /etc/sysconfig/pbm-agent
    
  2. Create the pbm-agent.service systemd unit file.

    $ sudo vim /usr/lib/systemd/system/pbm-agent.service
    
  3. In the pbm-agent.service file, specify the following:

    [Unit]
    Description=pbm-agent
    After=time-sync.target network.target
    
    [Service]
    EnvironmentFile=-/etc/default/pbm-agent
    Type=simple
    User=mongod
    Group=mongod
    PermissionsStartOnly=true
    ExecStart=/usr/bin/pbm-agent
    
    [Install]
    WantedBy=multi-user.target
    

    Note

    Make sure that the ExecStart directory includes the Percona Backup for MongoDB binaries. Otherwise, copy them from the ./bin directory of you installation path.

  4. Make systemd aware of the new service:

    $ sudo systemctl daemon-reload
    

Next steps

Set up PBM

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services.


Last update: December 4, 2023
Created: December 4, 2023