This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-14. For the latest, interactive version please visit https://mariadb.com/kb/.

在CentOS上构建MariaDB

CentOS Build Requirements

  • MariaDB sources
  • bzr. The bzr version of CentOS is too old to use it with MariaDB. You have to install Bazaar from source.
  • The following rpm packages:
    • gperf
    • rpm-devel
    • rpm-build
    • rpmdevtools
    • libdbi
MariaDB until 5.3

To build MariaDB of a version below 5.5 you need additionally

  • Packaging scripts
  • For a fully automated build — a sudo without password. This is NOT recommended on production systems! You have been warned!
    • visudo
    • and uncomment the line %wheel ALL=(ALL) NOPASSWD: ALL
    • usermod -a -G wheel {your_system_username}

.rpm Build Steps

First setup your build environment.

Then create packages:

cd $PACKAGING_WORK
bakery/preheat.sh
cd bakery_{number}
bakery/tarbake51.sh last:1 $MARIA_WORK
bakery/autobake51-centos.sh mariadb-{version_num}-maria-beta-ourdelta{number}.tar.gz

Update your Repositories

On subsequent packaging builds, you just update your repositories and run the packaging scripts:

rm -rf $MARIA_WORK
rm -rf $PACKAGING_WORK

cd $MARIA_MASTER
$BZR pull
$BZR branch $MARIA_MASTER $MARIA_WORK

cd $PACKAGING_MASTER
$BZR pull
$BZR branch $PACKAGING_MASTER $PACKAGING_WORK

Now you can create packages again.

MariaDB starting with 5.5

To build MariaDB of a version 5.5 and above you need to install cmake. If you want to build .rpm packages, you need at least cmake 2.8.7. Otherwise cmake 2.6 will do.

Note that you will not need any packaging scripts and the build process will never need root access.

.rpm Build Steps

First setup your build environment. Ignore the part about packaging scripts.

If you want to build .rpm's:

cmake -DRPM=centos .
make package

Instead of "centos" you may want to specify "centos5" or "centos6". This affects the name of the generated rpm packages. You may also specify any other cmake arguments to configure the binaries any way you want. For example, to build our releases on CentOS 5 we use

cmake .  -DBUILD_CONFIG=mysql_release -DRPM=centos5
make package

This procedure will not build MariaDB-compat rpm package, because it is not built from the 5.5 source tree. MariaDB-compat contains old client libraries and it is generated by repackaging MariaDB-shared-5.3 rpm package. To build this package you need to put a compatible (same architecture, similar distribution) MariaDB-shared-5.3.*.rpm file one level above the 5.5 source directory before running the cmake command as specified above.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.