适用环境:
数据库版本:MySQL 5.7.26 操作系统:CentOS 7
制作思路:
将数据库初始化和配置工作放到安装脚本中方便定制: 1、打包MySQL应用目录 2、不自动生成配置文件 3、不自动生成数据目录 4、不自动初始化数据
Spec代码:
# ========================================= # # MySQL参数配置 # mysql源码路径 # 源码包版本 %global src_base mysql %global version 5.7.26 %global src_dir %{src_base}-%{version} %global cmake_bin /home/rpmbuilder/cmake-3.16.2-Linux-x86_64/bin/cmake Name: %{src_base} Version: %{version} # 安装版本 Release: 1 # 安装包介绍 Summary: MySQL Server # 遵循协议 License: GPLv2 # 打包需要 # BuildRequires: cmake /sbin/useradd /sbin/groupadd /bin/bash /bin/sh /bin/chown # 安装需要 # Requires: ncurses ncurses-devel pcre numactl-libs numactl bison libaio libaio-devel # 安装的虚拟环境,在rpmbuild/BUILDROOT目录下 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-XXXXXX) # Sorce信息 Source0: %{name}-%{version}.tar.gz Source10: boost_1_59_0.tar.bz2 Source90: filter-provides.sh Source91: filter-requires.sh %if 0%{?rhel} > 6 # For rpm => 4.9 only: https://fedoraproject.org/wiki/Packaging:AutoProvidesAndRequiresFiltering %global __requires_exclude ^perl\((GD|hostnames|lib::mtr|lib::v1|mtr_|My::) %global __provides_exclude_from ^(/usr/share/(mysql|mysql-test)/.*|%{_libdir}/mysql/plugin/.*\.so)$ %else # https://fedoraproject.org/wiki/EPEL:Packaging#Generic_Filtering_on_EPEL6 %global __perl_provides %{SOURCE90} %global __perl_requires %{SOURCE91} %endif # mysql安装目录