How to Build Percona Server for MongoDB Operating SystemsFollowing this series of blog posts started by Evgeniy Patlan:

we’ll show you how to build Percona Server for MongoDB for various operating systems¹ using Docker on your local Linux machine/build server. In this very case, we’ll build packages of Percona Server for MongoDB 4.4.9-10 version for Centos 8 and Debian 11 (bullseye).

This can be useful when you need to test your changes to the code for different RPMs/DEBs based platforms and make sure that all works as expected in different environments. In our case, this approach is used for building Percona Server for MongoDB packages/binary tarballs for all supported OSes.

Prepare Build Environment

  • Make sure that you have at least 60GB of free disk space
  • Create a “build folder” – the folder where all the build actions will be performed, in our case “/mnt/psmdb-44/test
  • Make sure that you have installed the package which provides docker and docker service is up and running

Obtain Build Script of Needed Version²

You need to download the build script of the needed version to the “/mnt/psmdb-44” folder:

Create Percona Server for MongoDB Source Tarball

  • Please note that for the creation of source tarball, we use the oldest supported OS, in this case, it is Centos 7.

  • Check that source tarball has been created:

Build Percona Server for MongoDB Generic Source RPM/DEB:

Please note that for building generic source RPM/DEB, we still use the oldest supported RPM/DEB-based OS, in this case, Centos 7/ Ubuntu Xenial(16.04).

  • Build source RPM:

  • Build source DEB:

  • Check that both SRPM and Source DEB have been created:

Build Percona Server for MongoDB RPMs/DEBs:

  • Build RPMs:

  • Build DEBs:

  • Check that RPMs for Centos 8 and DEBs for Debian 11 have been created:

Now, the packages are ready to be installed for testing/working on Centos 8 and Debian 11.

As you can see from the above, the process of building packages for various operating systems is quite easy and doesn’t require lots of physical/virtual machines. All you need is the build script and Docker.

Also, as you may have noticed, all the build commands are similar to each other except the last passed argument, which defines the action that should be performed. Such an approach allows us to unify the build process and make it scripted so that the last argument can be passed as a parameter to the script. Surely all the rest arguments can and should also be passed as parameters in case you are going to automate the build process.

¹ Supported operating systems(version psmdb-4.4.9-10):

  • Centos 7
  • Centos 8
  • Ubuntu Xenial(16.04)
  • Ubuntu Bionic(18.04)
  • Ubuntu Focal(20.04)
  • Debian Stretch(9)
  • Debian Buster(10)
  • Debian Bullseye(11)

² In order to build Percona Server for MongoDB of another version, you need to use the build script of the proper version. For example, it is needed to build Percona Server for MongoDB of 4.2.7-7 version:

Complete the 2021 Percona Open Source Data Management Software Survey

Have Your Say!

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments