标签:global san linux tcp ORC structure ssi linu amp
适用环境:
数据库版本: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安装目录 %define mysql_server_path /data0/software/mysql/server # mysql数据目录 %define mysql_data_path /data0/software/mysql/data %define MYSQL_USER mysql %define MYSQL_GROUP mysql # mysql配置文件目录 %define mysql_conf_path /data0/software/mysql/server/etc/my.cnf # mysql描述 %description The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. # ========================================= # # 环境准备 %prep rm -rf $RPM_BUILD_ROOT/%{name}-%{version} # 安装前先将mysql包和boost包解压至下面路径 # ./rpmbuild/BUILD/mysql-5.7.28/ # ./rpmbuild/BUILD/boost_1_59_0/ %setup -q -n %{src_dir} groupadd %{MYSQL_GROUP} >/dev/null 2>&1 || : useradd -g %{MYSQL_GROUP} %{MYSQL_USER} -s /bin/nologin >/dev/null 2>&1 || : # ========================================= # # 编译 %build %{cmake_bin} ../%{src_dir} -DCMAKE_INSTALL_PREFIX=%{mysql_server_path} -DMYSQL_DATADIR=%{mysql_data_path} -DSYSCONFDIR=%{mysql_server_path}/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=%{mysql_data_path}/tmp/mysql.sock -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=.. make -j3 %{?_smp_mflags} # ========================================= # # 安装 %install rm -rf %{buildroot} make DESTDIR=%{buildroot} install # ========================================= # # 制作RPM包 %files %defattr(-, %{MYSQL_USER}, %{MYSQL_GROUP}) %attr(755, %{MYSQL_USER}, %{MYSQL_GROUP}) %{mysql_server_path}/* %changelog
未处理问题:
1、打包过程中会自动下载boost压缩文件,数据源信息应该存在问题
标签:global san linux tcp ORC structure ssi linu amp
原文地址:https://www.cnblogs.com/gaogao67/p/12148214.html