自制rpm包
rpmbuild安装包制作
http://blog.51cto.com/laoguang/1103628
https://www.cnblogs.com/SQL888/p/5776407.html
http://blog.csdn.net/qianggezhishen/article/details/49182417
http://blog.csdn.net/redguardtoo/article/details/1373885
http://blog.csdn.net/signmem/article/details/7326061
https://www.cnblogs.com/postgres/p/5726339.html
mysql rpm包制作案例
%define debug_package %{nil} Name: mysql Version: 5.7.20 Release: 1%{?dist} Summary: mysql Group: mysql License: GPL URL: www.mysql.com BuildRoot: %{_tmppath}/%{name}-%{version}-root Source0: %{name}-%{version}.tar.gz Source1: my.cnf BuildRequires: automake Requires: chkconfig AutoReqProv: no %description mysql install %prep #编译之前的准备工作 rm -rf %{_builddir}/%{name}-%{version} rm -rf %{buildroot}/mysql* %setup -q # 解压 %build # 执行编译命令 cmake , make cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/local/mysql/data -DDEFAULT_CHARSET=utf8 -DSYSCONFDIR=/etc -DDEFAULT_COLLATION=utf8_general_ci -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 -DWITH_MEMORY_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=0 -DWITH_BOOST=boost make %{?_smp_mflags} %install # 执行 maken instal make install DESTDIR=%{buildroot} install -p -D %{SOURCE1} %{buildroot}/usr/local/mysql/my.cnf %pre # 安装之前的准备工作 作兴 rpm -ivh /usr/bin/grep mysql /etc/passwd > /dev/null if [ $? == 0 ] then /usr/sbin/userdel mysql fi /usr/bin/grep mysql /etc/group > /dev/null if [ $? == 0 ] then /usr/sbin/groupdel mysql fi if test -d /usr/local/mysql then rm -rf /usr/local/mysql fi if test -d /data/local/mysql then rm -rf /data/local/mysql fi if test -f /etc/my.cnf then rm -rf /etc/my.cnf fi %post # 安装完成后的动作 /usr/sbin/groupadd mysql /usr/sbin/useradd -r -g mysql -s /bin/false mysql /usr/bin/mkdir -p {/data/local/mysql/data,/data/local/mysql/tmpdir,/data/local/mysql/dir_log,/data/local/mysql/dir_binlog,/data/local/mysql/dir_relaylog,/data/local/mysql/data_innodb,/data/local/mysql/data_redolog,/data/local/mysql/data_undolog} chown -R mysql:mysql /data/local/mysql /usr/bin/cp /usr/local/mysql/my.cnf /etc/my.cnf /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --datadir=/data/local/mysql/data \cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld chkconfig --add mysqld echo 'export PATH=/usr/local/mysql/bin/:$PATH' >> /root/.bashrc source /root/.bashrc service mysqld start /usr/local/mysql/bin/mysql -e"set password for root@'localhost'=password('taipu@123');flush privileges;" >/dev/null 2>&1 %preun # 卸载之前的准备工作 service mysqld stop %postun # 卸载之后的动作 /usr/sbin/userdel mysql chkconfig --del mysqld rm -rf /etc/init.d/mysqld rm -rf /data/local/mysql rm -rf /etc/my.cnf %files # 安装路径 %defattr(-,root,root) /usr/local/mysql %doc %clean %changelog
mysql rpm 制作案例:http://down.51cto.com/data/2438296
fpmmm fpm制作案例:http://down.51cto.com/data/2438298