FPM Mysql-5.7.21 RPM Package Production

Source: Internet
Author: User
Tags fpm uuid dedicated server

FPM Mysql-5.7.21 RPM Package production first, install the mysql-5.7.21 installation package to the custom directory
1. Download the installation package wget Http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gzwget https:// DEV.MYSQL.COM/GET/DOWNLOADS/MYSQL-5.7/MYSQL-5.7.21.TAR.GZ2. Installing the dependent Package yum-y install GCC gcc-c++ ncurses ncurses-devel Cmake3. Add MySQL user with group Groupadd MySQL useradd-r-g MySQL mysql4. New MySQL installation directory, with data storage directory Mkdir-p/app/mysqlmkdir-p. Solution Pressure Mount Tar-zxvf boost_1_59_0.tar.gztar-zxvf mysql-5.7.21.tar.gzcd mysql-5.7.21 #进入mysql的解压目录6. Use CMake to compile mysqlcmake. -dcmake_install_prefix=/app/mysql-dmysql_datadir=/app/data-ddownload_boost=1-dwith_boost=/root/boost_1_59_0- Dsysconfdir=/etc \-dwith_innobase_storage_engine=1-dwith_partition_storage_engine=1-dwith_federated_storage_ Engine=1-dwith_blackhole_storage_engine=1-dwith_myisam_storage_engine=1-denabled_local_infile=1-denable_dtrace =0-ddefault_charset=utf8mb4-ddefault_collation=utf8mb4_general_ci-dwith_embedded_server=17. Compiling and installing Mysqlmake & & Make Install8. Set the boot auto-start script Cp/app/mysql/support-files/mysql.server/etc/init.d/mysqldchmOD +x/etc/init.d/mysqldchkconfig--add mysqldchkconfig mysqld on9. Modify the environment variables for MySQL vi/etc/profileexport path= $PATH:/app/ Mysql/bin source/etc/profile10. Modify the directory permissions of MySQL chown-r mysql:mysql/app/mysql11. initializing MySQL database [[email protected] ~] #/app/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/app/mysql--datadir=/app/mysql/ data2018-03-26t07:31:17.298033z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-03-26t07 : 31:18.332278z 0 [Warning] innodb:new log files created, lsn=457902018-03-26t07:31:18.436844z 0 [Warning] Innodb:creatin G FOREIGN KEY constraint system tables.2018-03-26t07:31:18.453099z 0 [Warning] No existing UUID have been found, so we assu Me that's the first time that this server has been started. Generating a new uuid:ac7149bc-30c7-11e8-999a-005056804f18.2018-03-26t07:31:18.458082z 0 [Warning] Gtid table is not rea Dy to be used. Table ' MYSQL.GTid_executed ' cannot be opened.2018-03-26t07:31:18.458468z 1 [Warning] [email protected] was created with an empty PAS Sword! Please consider switching off the--initialize-insecure option. [[email protected] ~]# ll/app/data/total 110620-rw-r-----. 1 mysql mysql 15:31 auto.cnf-rw-r-----. 1 MySQL mysql 420 Mar 15:31 ib_buffer_pool-rw-r-----. 1 mysql mysql 12582912 Mar 15:31 ibdata1-rw-r-----. 1 mysql mysql 50331648 Mar 15:31 ib_logfile0-rw-r-----. 1 mysql mysql 50331648 Mar 15:31 ib_logfile1drwxr-x---. 2 mysql mysql 4096 Mar 15:31 mysqldrwxr-x---. 2 mysql mysql 4096 Mar 15:31 performance_schemadrwxr-x---. 2 mysql mysql 12288 Mar 15:31 sys12. Modify the configuration file as follows: vi/etc/my.cnf[client]port=3306socket=/tmp/mysql.sock[mysqld]# Remove Leading # and set to the amount of RAM for the most important data# caches in MySQL. Start at 70% of all RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128m# Remove Leading # to turn on a V eryImportant data integrity option:logging# changes to the binary log between backups.# log_bin# These is commonly set, REM Ove the # and set as Required.user = Mysqlbasedir =/app/mysqldatadir =/app/mysql/dataport=3306server-id = 1socket=/tmp/m Ysql.sockcharacter-set-server = Utf8#log-error =/var/log/mysql/error.log#pid-file =/var/log/mysql/mysql.pidgeneral _log = 1skip-name-resolve#skip-networkingback_log = 300max_connections = 1000max_connect_errors = 6000open_files_limit = 65535table_open_cache = Max_allowed_packet = 4mbinlog_cache_size = 1mmax_heap_table_size = 8Mtmp_table_size = 16Mrea D_buffer_size = 2mread_rnd_buffer_size = 8msort_buffer_size = 8mjoin_buffer_size = 28mkey_buffer_size = 4Mthread_cache_  Size = 8query_cache_type = 1query_cache_size = 8mquery_cache_limit = 2mft_min_word_len = 4log_bin = Mysql-binbinlog_format = Mixedexpire_logs_days = 30performance_schema = 0explicit_defaults_for_timestamp#lower_case_table_names = 1myisam_ Sort_buffer_size = 8mmyisam_repair_threads = 1interactive_timeout = 28800wait_timeout = 28800# Remove Leading # To set options mainly useful for reporting servers.#  The server defaults is faster for transactions and fast selects.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128m# Sort_buffer_size = 2m# read_rnd_buffer_size = 2m# disabling symbolic-links is recommend Ed to prevent assorted security riskssymbolic-links=0# Recommended in standard MySQL Setupsql_mode=no_engine_ Substitution,no_auto_create_user,strict_trans_tables[mysqldump]quickmax_allowed_packet = 16m13. Create error log with PID storage location mkdir-p/var/log/mysql/chown-r MYSQL:MYSQL/VAR/LOG/MYSQL/14. Start mysql[[email protected] mysql]# service mysqld startstarting MySQL. [OK] [[email protected] mysql]# NETSTAT-TLNP | grep 3306tcp 0 0::: 3306:::* LISTEN 27565/mysqld
Second, the production of RPM package after the installation of the running script
[[email protected] mysql]#mkdir -p /app/mysql/script                    #存放安装后的运行脚本[[email protected] mysql]#cp /etc/my.cnf .                                      #将mysql的配置文件复制到该目录[[email protected] mysql]#vi server.sh                                             #rpm包安装后的要运行的脚本
#!/bin.bash#add mysql usergroupadd mysqluseradd -r -g mysql mysql#制作自启动服务cp /app/mysql/support-files/mysql.server /etc/init.d/mysqldchmod +x /etc/init.d/mysqldchkconfig --add mysqldchkconfig mysqld on#添加环境变量echo "export PATH=$PATH:/app/mysql/bin" >> /etc/profile#环境变量生效,但貌似不起作用,需后续在客户端运行source /etc/profile#修改mysql安装目录的权限chown -R mysql:mysql /app/mysql#复制配置文件到相应路径cp /app/mysql/script/my.cnf /etc/
Third, generate RPM package
fpm -s dir -t rpm -n mysql -v 5.7.21 -d ‘gcc,gcc-c++,ncurses,ncurses-devel,cmake‘ --post-install /app/mysql/script/server.sh -f /app/mysql/
Four, to the client Test installation RPM package
[[email protected] ~]# ll | grep mysql-5.7.21-1.x86_64.rpm -rw-r--r--  
Five, the effect after installation
[[email protected] ~]# ll /app/                #指定了安装目录total 8drwxr-xr-x 12 mysql mysql 4096 Jun 13 20:07 mysql                  drwxr-xr-x  4 root  root  4096 Jun 13 16:53 software[[email protected] ~]# chkconfig | grep mysqld           #添加了自启动服务mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off[[email protected] ~]# service mysqld start          #启动成功Starting MySQL.[  OK  ]

FPM Mysql-5.7.21 RPM Package Production

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.