# System platform: CentOS 6.8
# software version: mariadb_5.5.54, ruby_1.9.3, fpm_1.4.0
# need to use the tool shell, FPM
Ideas are as follows:
1. Install FPM Package,
2, install MARIADB software package,
3. Add installation, uninstall scripts, configure startup scripting environment variables, etc.
1, install FPM package, installation process, and some wrong solutions
1.1 You need to install Ruby first
Yum-y install ruby RubyGems ruby-devel rubygem-rspec-corerubygems rubygem-rake # view Source [[email protected] ~]# gem SOURC E List * * * Current SOURCES * * *
# Add domestic source [[email protected] ~]# gem sources-ahttp://mirrors.aliyun.com/rubygems/http://mirrors.aliyun.com/rubygems/ Added to sources # remove foreign sources [[email protected] ~]# gem sources--removehttp://rubygems.org/http://rubygems.org/remo Ved from sources
# When installing FPM, this error will be reported. Gem install fpm-v 1.4.0error:error installing fpm:jsonrequires Ruby version >= 1.9.
# Solution:
# packages need to be installed complete https://centos.pkgs.org/I'm downloading most of the packages from here.
Yum install gcc-c++ patch readlinereadline-devel zlib zlib-develyum install libyaml-devel libffi-developenssl-devel makeyum install bzip2 autoconf automake libtoolbison iconv-devel# Download Package Curl -l get.rvm.io | bash -s stable # Import the key pair or you will get an error when downloading RVM from GitHub Gpg2 --keyserver hkp://keys.gnupg.net--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3gpg: key Ring '/ROOT/.GNUPG/SECRING.GPG ' has established gpg: download key ' D39dc0e3 ', from hkp server &NBSP;KEYS.GNUPG.NETGPG:&NBSP;/ROOT/.GNUPG/TRUSTDB.GPG: Established a trust database gpg: key &NBSP;D39DC0E3: Public Key "michal papis (rvm signing) <[email protected]>" Imported gpg: No absolute trust keys found gpg: total number of processed:1gpg: imported: 1 (rsa: 1) # update environment variable source /etc/profile.d/rvm.sh # installation rubyrvm install 1.9.3# attached detailed solution: &NBsp;http://tecadmin.net/install-ruby-1-9-3-or-multiple-ruby-verson-on-centos-6-3-using-rvm/# will ruby 1.9.3 Set as Default rvm use 1.9.3 --defaultusing /usr/local/rvm/gems/ruby-1.9.3-p551 # Then install gem install fpm -v 1.4.0fetching: json-2.1.0.gem (100%) Building native extensions. this could take a while ... successfully installed json-2.1.0fetching: cabin-0.9.0.gem (100%) Successfully installed cabin-0.9.0fetching: backports-3.8.0.gem (100%) 8 gems installed
2, install MARIADB software package,
# need to be manually installed first mariadb
# Add user group and user groupadd-g 3010 mysqluseradd-g 3010-u 3011 mysql# Add Data directory and give the genus group Mkdir/data/mysql-pvchown-r mysql.mysql/us R/local/mysqlchown-r mysql.mysql/data/mysql# Delete the default my.cnf file, avoid FPM packaging times error RM-RF/ETC/MY.CNF
Cat/usr/local/mysql/support-files/my.cnf
# MY.CNF Add the following four lines datadir =/data/mysqlbasedir =/usr/local/mysqlinnodb_file_per_table = 1skip_name_resolve = 1 Cp/usr/loca l/mysql/support-files/my.cnf/etc/
# define MySQL environment to facilitate direct use of installation
Cat Mysql.shexport Path=/usr/local/mysql/bin: $PATH cp/usr/local/mysql/support-files/mysql.sh/etc/profile.d/source /etc/profile.d/mysql.sh
# It is important to note that modifying the Basedir and DataDir files to a manually set directory
cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqldbasedir= Directory datadir=
# Configure Boot Boot
Chkconfig mysqld on
# to modify the directory can also be directly linked to the
]# MV mariadb-5.5.54-linux-x86_64 MySQL
# Install MARIADB
]#./scripts/mysql_install_db--user=mysql--group=mysql--basedir=/usr/local/mysql/--datadir=/data/mysql/
3. FPM Packs the mariadb into RPM packages
FPM Common parameters:-S: Specify the Source Type-T: Specify the target type, that is, why Package-N: Specify the name of the package-V: Specify the version number of the package-C: Specify the relative path of the packaging--no-rpm-sign specify the installation directory if the C/--no-rpm-sign/usr/ Local/zabbix the packet path of the packaged machine is/usr/local/zabbix the local data is/usr/local/zabbix after the RPM package is installed. If it's-c/usr/local/zabbix--no-rpm-sign, then you have to. The packet is placed under/usr/local/zabbix/usr/local/zabbix, no installation is installed all in the/root directory-D: Specifies which package-F is dependent on: The second package time directory if there is a same name installation package exists, then overwrite it-P: output of the directory of the installation package, do not want to put in the current directory you need to specify--post-install: The package to run after the installation of the script The same--offer-install--pre-install: the script to run before the package installation is complete, and--before-install--post-uninstall: The script to run after the package uninstallation is complete The same--offer-remove--pre-uninstall: the script to run before the package uninstallation is complete;-before-remove--description: Package description Details: fpm-h
# First you need two scripts, one for installation, one for uninstalling packages
# installation Script Script directory/usr/local/mysql/support-files/install
#!/bin/bash#groupadd-g 3010 mysqluseradd-g 3010-u 3011 mysqlmkdir/data/mysql-pvchown-r MYSQL.MYSQL/USR/LOCAL/MYSQLC Hown-r mysql.mysql/data/mysql/bin/cp-i/usr/local/mysql/support-files/my.cnf/etc//bin/cp-i/usr/local/mysql/ Support-files/mysql.sh/etc/profile.d//bin/cp-i/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld# Iptables-i input-p TCP--dport 3306-m State--statenew,established-j accept# service iptables save# service iptables R Estartchkconfig mysqld on
# Unload Script
#!/bin/bash#userdel -r mysql &>/dev/ Nullgroupdel mysql &>/dev/nullservice mysqld stop &>/dev/nullchkconfig mysqld offpkill -9 mysqldrm -rf /data/mysql rm -rf /etc/my.cnfrm -rf /etc/etc/profil.d/mysql.shrm -rf /etc/init.d/mysqldrm -rf /usr/local/mysql
file format for directory, name mariadb, type RPM package, version 5.5.54 required components, where to store the packaged files, descriptive information,-- The URL is also --post-install for the installation script --port-uninstall address for the Unload script --no-rpm-sign directory There are two basic files here, One is the data file directory fpm -f -s dir -n mariadb -t rpm -v 5.5.54 -d ' gcc, Gcc-c++ ' -C / -p /tmp --description "Mariadb_5.5.54_noacrh.rpm,xiongmake" - -url "http://www.mariadb.org/" --license "BSD"-m "mariadb" --post-install/usr/local/ mysql/support-files/install --post-uninstall /usr/local/mysql/support-files/uninstall -- No-rpm-sign/usr/local/mysql /data/mysql
# The output success information is as follows no value for the epoch is set, defaulting to nil {: Level=>:warn}no value for epoch is set, defaulting to Nil{:le vel=>:warn}created package{:p ath=> "/tmp/mariadb-5.5.54-1.x86_64.rpm"}# the display after packaging is complete
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/9F/60/wKioL1mb4a7QFksnAABfAif2vzo599.png "title=" 1 "alt = "Wkiol1mb4a7qfksnaabfaif2vzo599.png"/>
This article is from the "Xiong" blog, make sure to keep this source http://xiong51.blog.51cto.com/5239058/1958361
MARIADB Customized RPM Package