Skip to content
logo
Percona XtraBackup
Compile and install Percona XtraBackup from source code
Initializing search
    percona/pxb-docs
    percona/pxb-docs
    • Home
      • About Percona XtraBackup
      • How Percona XtraBackup works
      • Understand version numbers
      • Install Percona XtraBackup 8.0
      • Use an APT repo to install Percona XtraBackup
      • Use a YUM repo to install Percona XtraBackup
      • Use DEB or RPM downloaded packages to install Percona XtraBackup
      • Install Percona XtraBackup from a Binary Tarball
      • Compile and install Percona XtraBackup from source code
        • 1. Installing prerequisites
        • 2. Generate the build pipeline
          • Parameter Information
        • 3. Compile the source code
        • 4. Install on the target system
          • Install to a non-default location
        • 5. Run Percona XtraBackup
      • What’s in the packages
      • Uninstall Percona XtraBackup
      • Run Percona XtraBackup in a Docker container
      • Implementation details
      • Connection and privileges needed
      • Configure xtrabackup
      • Server version and backup version comparison
      • xtrabackup exit codes
      • The backup cycle - full backups
      • Incremental backup
      • Compressed backup
      • Partial backups
      • Percona XtraBackup user manual
      • Throttling backups
      • Encrypted InnoDB tablespace backups
      • Encrypt backups
      • LRU dump backup
      • Point-in-time recovery
      • Restore individual tables
      • Smart memory estimation
      • Work with binary logs
      • Improved log statements
      • Work with SELinux
      • Work with AppArmor
      • Enable the server to communicate via TCP/IP
      • Install and configure an SSH server
      • Analyze table statistics
      • FLUSH TABLES WITH READ LOCK option
      • lock-ddl-per-table option improvements
      • Take an incremental backup using page tracking
      • The xbcloud binary
      • Use the xbcloud binary with Swift
      • Use xbcloud Binary with Amazon S3
      • Xbcloud with an IAM instance profile
      • Use the xbcloud binary with MinIO
      • Use the xbcloud with Google Cloud Storage
      • Exponential backoff
      • Use the xbcloud binary with Microsoft Azure Cloud Storage
      • How-tos and recipes
      • Release notes index
      • Percona XtraBackup 8.0.32-25 (2023-02-27)
      • Percona XtraBackup 8.0.31-24 (2023-02-07)
      • Percona XtraBackup 8.0.30-23 (2022-11-14)
      • Percona XtraBackup 8.0.29-22 (2022-07-19)
      • Percona XtraBackup 8.0.28-21 (2022-05-25)
      • Percona XtraBackup 8.0.28-20
      • Percona XtraBackup 8.0.27-19
      • Percona XtraBackup 8.0.26-18.0
      • Percona XtraBackup 8.0.25-17.0
      • Percona XtraBackup 8.0.23-16.0
      • Percona XtraBackup 8.0.22-15.0
      • Percona XtraBackup 8.0.14
      • Percona XtraBackup 8.0.13
      • Percona XtraBackup 8.0.12
      • Percona XtraBackup 8.0.11
      • Percona XtraBackup 8.0.10
      • Percona XtraBackup 8.0.9
      • Percona XtraBackup 8.0.8
      • Percona XtraBackup 8.0.7
      • Percona XtraBackup 8.0.6
      • Percona XtraBackup 8.0.5
      • Percona XtraBackup 8.0.4
      • Percona XtraBackup 8.0-3-rc1
      • Error Message: Found tables with row versions due to INSTANT ADD/DROP columns
      • The xtrabackup option reference
      • The xbcrypt binary
      • The xbstream binary
      • Frequently asked questions
      • Glossary
      • Index of files created by Percona XtraBackup
      • Trademark policy
      • Copyright and licensing information
      • Version checking

    • 1. Installing prerequisites
    • 2. Generate the build pipeline
      • Parameter Information
    • 3. Compile the source code
    • 4. Install on the target system
      • Install to a non-default location
    • 5. Run Percona XtraBackup

    Compile and install Percona XtraBackup from source code¶

    The source code is available from the Percona XtraBackup GitHub project. The easiest way to get the code is by using the git clone command. Then, switch to the release branch that you want to install, such as 8.0.

    $ git clone https://github.com/percona/percona-xtrabackup.git
    $ cd percona-xtrabackup
    $ git checkout 8.0
    $ git submodule update --init --recursive
    

    1. Installing prerequisites¶

    The following packages and tools must be installed to compile Percona XtraBackup from source. These might vary from system to system.

    Important

    To build **Percona XtraBackup 8.0 from source, you must use cmake version 3. To check which version is currently installed, run cmake --version at a command prompt. If the version is not 3, install cmake3.

    This cmake version may be available in your distribution as a separate package cmake3. For more information, see cmake.org

    sudo apt install bison pkg-config cmake devscripts debconf \
    debhelper automake bison ca-certificates libprocps-dev \
    libcurl4-openssl-dev cmake debhelper libaio-dev \
    libncurses-dev libssl-dev libtool libz-dev libgcrypt-dev libev-dev libprocps-dev \
    lsb-release build-essential rsync libdbd-mysql-perl \
    libnuma1 socat librtmp-dev libtinfo5 vim-common \
    liblz4-tool liblz4-1 liblz4-dev zstd python-docutils qpress
    

    To install the man pages, install the python3-sphinx package first:

    $ sudo apt install python3-sphinx
    

    Percona Xtrabackup requires GCC version 5.3 or higher. If the version of GCC installed on your system is lower then you may need to install and enable the Developer Toolset on RPM-based distributions to make sure that you use the latest GCC compiler and development tools. Then, install cmake and other dependencies:

    $ sudo yum install cmake openssl-devel libaio libaio-devel automake autoconf \
    bison libtool ncurses-devel libgcrypt-devel libev-devel libcurl-devel zlib-devel \
    zstd vim-common procps-ng-devel
    

    To install the man pages, install the python3-sphinx package first:

    $ sudo yum install python3-sphinx
    

    2. Generate the build pipeline¶

    At this step, you have cmake run the commands in the CMakeList.txt file to generate the build pipeline, i.e. a native build environment that will be used to compile the source code).

    1. Change to the directory where you cloned the Percona XtraBackup repository

      $ cd percona-xtrabackup
      
    2. Create a directory to store the compiled files and then change to that directory:

      $ mkdir build
      $ cd build
      
    3. Run cmake or cmake3. In either case, the options you need to use are the same.

    Note

    You can build Percona XtraBackup with man pages but this requires python-sphinx package which isn’t available from that main repositories for every distribution. If you installed the python-sphinx package you need to remove the -DWITH_MAN_PAGES=OFF from previous command.

    $ cmake -DWITH_BOOST=PATH-TO-BOOST-LIBRARY -DDOWNLOAD_BOOST=ON \
    -DBUILD_CONFIG=xtrabackup_release -DWITH_MAN_PAGES=OFF -B ..
    

    Parameter Information¶

    Parameter Description
    -DWITH_BOOST For the -DWITH_BOOST parameter, specify the name of a directory to download the boost library to. This directory is created automatically in your current directory.
    -DWITH_MAN_PAGES To build Percona XtraBackup man pages, use ON or remove this parameter from the command line (it is ON by default). To install the man pages, install the python3-sphinx package first. See also ## Step 2: Compiling the source code
    -B (--build) Percona XtraBackup is configured to forbid generating the build pipeline for make in the same directory where you store your sources. The -B parameter refers to the directory that contains the source code. In this example, we use the relative path to the parent directory (..).

    Important

    CMake Error at CMakeLists.txt:367 (MESSAGE): Please do not build in-source. Out-of source builds are highly recommended: you can have multiple builds for the same source, and there is an easy way to do cleanup, simply remove the build directory (note that ‘make clean’ or ‘make distclean’ does not work)

    You can force in-source build by invoking cmake with -DFORCE_INSOURCE_BUILD=1.

    3. Compile the source code¶

    To compile the source code in your build directory, use the make command.

    1. Change to the build directory (created at Step 2: Generating the build pipeline).

    2. Run the make command. This command may take a long time to complete.

      $ make
      
      To use all CPU threads and make compilation faster please use:

      $ make -j$(nproc --all)
      

    4. Install on the target system¶

    The following command installs all Percona XtraBackup binaries xtrabackup and tests to default location on the target system: /usr/local/xtrabackup.

    Run make install to install Percona XtraBackup to the default location.

    $ sudo make install
    

    Install to a non-default location¶

    You may use the DESTDIR parameter with make install to install Percona XtraBackup to another location. Make sure that the effective user is able to write to the destination you choose.

    $ sudo make DESTDIR=<DIR_NAME> install
    

    In fact, the destination directory is determined by the installation layout (-DINSTALL_LAYOUT) that cmake applies (see Step 2: Generating the build pipeline). In addition to the installation directory, this parameter controls a number of other destinations that you can adjust for your system.

    By default, this parameter is set to STANDALONE, which implies the installation directory to be /usr/local/xtrabackup.

    See also

    MySQL Documentation: -DINSTALL_LAYOUT

    5. Run Percona XtraBackup¶

    After Percona XtraBackup is installed on your system, you may run it by using the full path to the xtrabackup command:

    $ /usr/local/xtrabackup/bin/xtrabackup
    

    Update your PATH environment variable if you would like to use the command on the command line directly.

    $# Setting $PATH on the command line
    $ PATH=$PATH:/usr/local/xtrabackup/bin/xtrabackup
    
    $# Run xtrabackup directly
    $ xtrabackup
    

    Alternatively, you may consider placing a soft link (using ln -s) to one of the locations listed in your PATH environment variable.

    To view the documentation with man, update the MANPATH variable.

    Contact us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: 2022-12-16
    Percona LLC and/or its affiliates, © 2023
    Made with Material for MkDocs

    Cookie consent

    We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.