安装rpm-build [root@master ~]# yum install rpm-build 创建工作目录 [root@master ~]# mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} [root@master ~]# cp mysql-5.5.27.tar.gz /root/rpmbuild/SOURCES/ [root@master ~]# cp my.cnf /root/rpmbuild/SOURCES/ [root@master ~]# cp mysqld /root/rpmbuild/SOURCES/ [root@master ~]# cd /root/rpmbuild/SPECS/ [root@master SPECS]# vim mysql.spec Name: mysql Version: 5.5.27 Release: 1%{?dist} Summary: mysql-5.5.27.tar.gz to mysql-5.5.27.rpm Group: Applications/Archiving License:GPL URL: http://www.cnblogs.com/kingtigerhu Vendor: knight Source0: %{name}-%{version}.tar.gz Source1: mysqld Source2: my.cnf BuildRequires: cmake Requires: ncurses-devel Autoreq: no Autoprov : no %description Build mysql-5.5.27.tar.gz to mysql-5.5.27.rpm %prep %setup -q %build //编译的时候会报错,所以把%configure删除了 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci make %{?_smp_mflags} %install rm -rf %{buildroot} make install DESTDIR=%{buildroot} %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}/etc/rc.d/init.d/mysqld %{__install} -p -D %{SOURCE2} %{buildroot}/etc/my.cnf %pre //$1有3个值,代表动作,安装类型,1表示安装,2表示升级,0表示卸载 if [ $1 == 1 ];then /usr/sbin/useradd mysql 2> /dev/null fi %post if [ $1 == 1 ];then /sbin/chkconfig --add mysqld /sbin/chkconfig mysqld on echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile source /etc/profile chown -R mysql:mysql /usr/local/mysql /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data > /dev/null 2>&1 fi %preun if [ $1 == 0 ];then /usr/sbin/userdel mysql 2> /dev/null /etc/init.d/mysqld stop > /dev/null 2>&1 fi %postun %clean rm -rf %{buildroot} %files %defattr(-,root,root,0755) /usr/local/mysql/ %attr(0755,root,root) /etc/rc.d/init.d/mysqld %config(noreplace) /etc/my.cnf %doc %changelog * Thu May 12 2016 knight <1908616619@qq.com> - 5.5.27-1 - Initial version [root@master SPECS]# rpmbuild -bb mysql.spec [root@master SPECS]# ll /root/rpmbuild/RPMS/x86_64/mysql-* -rw-r--r-- 1 root root 28426984 5月 12 04:16 /root/rpmbuild/RPMS/x86_64/mysql-5.5.27-1.el6.x86_64.rpm [root@slave2 ~]# rpm -ivh mysql-5.5.27-1.el6.x86_64.rpm --nodeps --force Preparing... ########################################### [100%] 1:mysql ########################################### [100%] [root@slave2 ~]# Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/mysql/bin/mysqladmin -u root password 'new-password' /usr/local/mysql/bin/mysqladmin -u root -h slave2 password 'new-password' Alternatively you can run: /usr/local/mysql/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/local/mysql/scripts/mysqlbug script! rpm包安装的时候会显示这些信息,但是不影响,不知道怎么屏蔽这些信息,求指教
rpm打包mysql5.5
原创kingtigerhu 博主文章分类:linux服务 ©著作权
©著作权归作者所有:来自51CTO博客作者kingtigerhu的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:nginx 安装禅道
下一篇:我的友情链接
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Mysql8.0.35rpm安装(不区分大小写、弱密码规则)
mysql8.0.23rpm安装
mysql 初始化 数据库 部署 -
mysql5.5安装
MySQL下载地址:http://dev.mysql.com/downloads/installer/1、首先进入的是安装引导界面2、然后进入的是类型选择界面
mysql5.5安装教程 MySQL安装 MySQL 服务器 并行连接 -
Centos6 rpm 安装mysql5.5(转)mysql linux sed 配置文件 最大连接数