Compiling and Installing Percona
The process of compiling and installing Percona involves downloading the source code and dependency libraries, decompressing, repairing the source code, and compiling and installing Percona. It is a detailed process of manually building the Percona database from the source code. This section describes how to compile and install Percona 8.0.25.
- Download the Percona source package percona-server-8.0.25-15tar.gz and the Boost library package, and upload them to the /home directory on the server.
For the download URL, see Environment Requirements.
- Go to the /home directory and decompress the Boost library package and Percona source package.
1 2 3
cd /home tar xvf boost_1_73_0.tar.gz tar zxvf percona-server-8.0.25-15.tar.gz
- Optional: Modify and repair the Percona source code before compilation if Percona 8.0.15 is to be installed, because problems may exist in the downloaded Percona source code. Skip this step if Percona 8.0.25 is to be installed.
- Go to the Percona source code directory after the decompression.
1cd /home/percona-server-8.0.15-6
- Open the sync0rw.cc file.
1vi storage/innobase/sync/sync0rw.cc - Press i to enter the insert mode to repair the sync0rw.cc file. Modify the contents of lines 512 to 514 in the /storage/innobase/sync/sync0rw.cc file as follows:
bool recursive; os_thread_id_t writer_thread; if (!pass) { recursive = lock->recursive; os_rmb; writer_thread = lock->writer_thread; }Figure 1 and Figure 2 are examples of the file before and after the modification.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Go to the Percona source code directory after the decompression.
- Go to the Percona source code directory decompressed.
1cd /home/percona-server-8.0.25-15
- Compile Percona.
1cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_BOOST=/home/boost_1_73_0 -DCMAKE_INSTALL_PREFIX=/usr/local/percona -DMYSQL_DATADIR=/data/percona -DSYSCONFDIR=/etc -DWITHOUT_TOKUDB=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LOBWRAP=0 -DMYSQL_UNIX_ADDR=/data/percona/run/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DFORCE_INSOURCE_BUILD=1
To install Percona 8.0.15 on openEuler 22.03, run the following cmake command:
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_BOOST=/home/boost_1_68_0 -DCMAKE_INSTALL_PREFIX=/usr/local/percona -DMYSQL_DATADIR=/data/percona -DSYSCONFDIR=/etc -DWITHOUT_TOKUDB=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LOBWRAP=0 -DMYSQL_UNIX_ADDR=/data/percona/run/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DFORCE_INSOURCE_BUILD=1 -DHAVE_CLOCK_GETTIME=1 -DCMAKE_C_COMPILER=/opt/tools/gcc/gcc-7.3.0/bin/gcc -DCMAKE_CXX_COMPILER=/opt/tools/gcc/gcc-7.3.0/bin/g++
During the compilation and installation, use the actual compilation paths as required. Table 1 describes the key paths. If the message "Could not find rpcgen" is displayed during the compilation, see "Could not find rpcgen" Displayed After CMake Is Executed During MySQL Compilation on openEuler.
Table 1 Key paths involved in compilation and installation Parameter
Description
DWITH_BOOST
Specifies the path where the boost_1_73_0 folder is located after the Percona installation package is decompressed.
For example, if the package is decompressed in the /home directory, the path is /home/boost_1_73_0.
DCMAKE_INSTALL_PREFIX
Specifies the software installation path.
In this example, it is /usr/local/percona.
DMYSQL_DATADIR
Specifies the path for storing data files during database creation.
In this example, it is /data/percona.
DCMAKE_C_COMPILER
Specifies the installation path of GCC. If no path is specified when GCC is installed, the default path is /usr/local/bin.
In this example, it is /opt/tools/gcc/gcc-7.3.0/bin/gcc as specified in 4.4.12.
DCMAKE_CXX_COMPILER
Specifies the installation path of g++. If no path is specified when GCC is installed, the default path is /usr/local/bin.
In this example, it is /opt/tools/gcc/gcc-7.3.0/bin/g++ as specified in 4.4.12.
- Install Percona.
1make -j 96
In the command, -j 96 can make full use of the multi-core feature of the CPUs to accelerate the compilation. The number following -j indicates the number of CPU cores. You can run the cat /proc/cpuinfo | grep processor | wc -l command to query the number of CPU cores. The value specified must be less than or equal to the actual number of CPU cores.

1make install

