zoukankan      html  css  js  c++  java
  • fpm制做mysql-5.6.33 rpm包

    增加用户:

    # groupadd -r mysql
    # useradd -g mysql -r -s /sbin/nologin -M -d /data/my_db mysql
    

    源码安装mysql-5.6.33.tar.gz 初始代数据库

    [root@c01 mysql-5.6.33]# cp /apps/mysql-5.6.33/support-files/mysql.server /etc/init.d/mysqld
    
    
    [root@c01 mysql-5.6.33]# chmod 777 /etc/init.d/mysld
    修改以下内容
    basedir=/apps/mysql-5.6.33
    datadir=/data/my_db
    # Set some defaults
    mysqld_pid_file_path=/data/my_db/mysqld.pid
    
    
    [root@c01 mysql-5.6.33]# ln -sv /apps/mysql-5.6.33/include /usr/include/mysql
    `/usr/include/mysql' -> `/apps/mysql-5.6.33/include'
    
    [root@c01 mysql-5.6.33]# /apps/mysql-5.6.33/scripts/mysql_install_db --datadir=/data/my_db --user=mysql
    [root@c01 mysql-5.6.33]# echo '/apps/mysql-5.6.33/lib' >/etc/ld.so.conf.d/mysql-x86_64.conf
    [root@c01 mysql-5.6.33]# ldconfig
    [root@c01 mysql-5.6.33]# echo 'export PATH=/apps/mysql-5.6.33/bin/:$PATH' >/etc/profile.d/mysql.sh
    [root@c01 mysql-5.6.33]# source /etc/profile
    [root@c01 mysql-5.6.33]# mv /etc/init.d/mysld /etc/init.d/mysqld
    
    [root@c01 tmp]# fpm -s dir -t rpm -v 5.6.33 -n mysql --before-install /tmp/before.sh --after-install /tmp/after.sh --after-remove /tmp/remove.sh -d 'libaio' /apps/mysql-5.6.33/ /data/my_db/ /etc/init.d/mysqld
    no value for epoch is set, defaulting to nil {:level=>:warn}
    no value for epoch is set, defaulting to nil {:level=>:warn}
    Created package {:path=>"mysql-5.6.33-1.x86_64.rpm"}
    

     下面是所需要的脚本:

    # cat /tmp/after.sh 
    #!/bin/bash
    ln -sv /apps/mysql-5.6.33/include /usr/include/mysql
    echo '/apps/mysql-5.6.33/lib/' > /etc/ld.so.conf.d/mysql.conf
    ldconfig
    echo 'export PATH=/apps/mysql-5.6.33/bin/:$PATH' > /etc/profile.d/mysql.sh
    source /etc/profile
    chown -R mysql:mysql /data/my_db
    echo "[mysqld]
    basedir=/apps/mysql-5.6.33
    datadir=/data/my_db
    port=3306
    socket=/data/my_db/mysql.sock
    user=mysql
    innodb_file_per_table=on
    skip_name_resolve=on
    symbolic-links=0
    init-connect='SET NAMES utf8'
    character-set-server=utf8
    max_connections=5000
    max_connect_errors=100000
    [mysqld_safe]
    log-error=/data/my_db/mysqld.log
    pid-file=/data/my_db/mysqld.pid
    [client]
    socket=/data/my_db/mysql.sock
    " >/etc/my.cnf
    
    # cat /tmp/before.sh 
    #!/bin/bash
    #创建mysql数据存储目录
    if [ ! -d /apps/mysql-5.6.16 ];then
    	mkdir /apps/mysql-5.6.16 -p
    fi
    if [ ! -d /data/my_db ];then
    	mkdir /data/my_db -p
    fi
    #创建mysql用户
    groupadd -r mysql
    useradd -g mysql -r -s /sbin/nologin -M -d /data/my_db mysql
    #
    if [ -f /etc/ld.so.conf.d/mysql-x86_64.conf ];then
    	rm -rf /etc/ld.so.conf.d/mysql-x86_64.conf
    fi
    
    # cat /tmp/remove.sh 
    #!/bin/bash
    userdel -r mysql
    if [ -f /etc/ld.so.conf.d/mysql.conf ];then
    	rm -rf /etc/ld.so.conf.d/mysql.conf
    fi
    if [ -f cat /etc/profile.d/mysql.sh ];then
    	rm -rf cat /etc/profile.d/mysql.sh
    fi
    
  • 相关阅读:
    electron 安装失败解决办法
    面向 B 端的产品经理
    如何学习一门新语言或框架
    斑马为什么有条纹?
    沃伦·巴菲特 | 成功的 10/10/10 法则
    如果想进入一家大公司面试,你会怎么做?
    人工智能缺陷与误觉:让机器产生幻觉的「怪异事件」
    20 世纪 70 年代的太空殖民艺术
    如何实现SSH断开后 进程仍然在后台运行
    让Linux关闭终端(关闭SSH等)后,程序继续运行
  • 原文地址:https://www.cnblogs.com/bass6/p/7097823.html
Copyright © 2011-2022 走看看