您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

自动化部署MySQL 5.6 步骤

2024/8/23 20:53:40发布26次查看
自动化部署mysql 5.6 步骤 准备工作 首先需要搭建ftpserver yum install vsftpd service vsftpd start 这样ftp服务就起来了,这里
自动化部署mysql 5.6 步骤
准备工作
首先需要搭建ftpserver
yum install vsftpd
service vsftpd start
这样ftp服务就起来了,这里只是简单的使用,所以没有使用配置文件。这样我们只要将需要的文件置于/var/ftp/pub/文件夹下,匿名用户就可以copy文件到本机了。
安装rpm-build
build需要用到rpm-build,这里简单安装即可
yum install rpm-build
下面开始rpm打包
mget
cd /u01/mysql-5.6.21
mkdir rpm
cd rpm
修改mysql.spec
name: mysql-rpm
version:5.6.21
release: renfengjun
license: gpl
url:
group: applications/database
buildroot:%{_tmppath}/%{name}-%{version}-%{release}-root
buildrequires: cmake
packager: dexter.ren.jl@gmail.com
autoreq: no
prefix: /u01/mysql
summary: mysql-5.6.21.tar.gz
%description
the mysql(tm) software delivers a very fast,multi-threaded, multi-user,
and robust sql (structured query language)database server. mysql server
is intended for mission-critical, heavy-loadproduction systems as well
as for embedding into mass-deployed software.
%define mysql_user mysql
%define mysql_group mysql
%define __os_install_post %{nil}
%build
cd $oldpwd/../
cflags=-o3 -g -fno-exceptions-static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing
cxx=g++
cxxflags=-o3 -g -fno-exceptions -fno-rtti-static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing
export cflags cxx cxxflags
cmake .                                                \
 -dsysconfdir:path=%{prefix}                            \
 -dcmake_install_prefix:path=%{prefix}                  \
 -dcmake_build_type:string=release                      \
 -denable_profiling:bool=on                            \
 -dwith_debug:bool=off                                  \
 -dwith_valgrind:bool=off                              \
  -denable_debug_sync:bool=off                          \
 -dwith_extra_charsets:string=all                      \
 -dwith_ssl:string=bundled                              \
 -dwith_unit_tests:bool=off                            \
 -dwith_zlib:string=bundled                            \
 -dwith_partition_storage_engine:bool=on                \
 -dwith_innobase_storage_engine:bool=on                \
 -dwith_archive_storage_engine:bool=on                  \
 -dwith_blackhole_storage_engine:bool=on                \
 -dwith_perfschema_storage_engine:bool=on              \
 -ddefault_charset=utf8                                \
 -ddefault_collation=utf8_general_ci                    \
 -dwith_extra_charsets=all                            \
 -denabled_local_infile:bool=on                        \
 -dwith_embedded_server=0                              \
 -dinstall_layout:string=standalone                    \
 -dcommunity_build:bool=on                              \
  -dmysql_server_suffix='-r5436';
make -j `cat /proc/cpuinfo | grep processor| wc-l`
%install
cd $oldpwd/../
make destdir=$rpm_build_root install
%clean
rm -rf $rpm_build_root
%files
%defattr(-, %{mysql_user}, %{mysql_group})
%attr(755, %{mysql_user}, %{mysql_group})%{prefix}/*
%pre
mkdir -p /u01/mysql/data
mkdir -p /u01/mysql/run
mkdir -p /u01/mysql/log
groupadd mysql
useradd -g mysql mysql
chown -r mysql:mysql /u01/mysql/data
chown -r mysql:mysql /u01/mysql/log
chown -r mysql:mysql /u01/mysql/run
echo exportpath=$path:/u01/mysql/bin >> /home/mysql/.bash_profile
%post
ln -s %{prefix}/lib %{prefix}/lib64
cp /u01/mysql/support-files/mysql.server/etc/init.d/mysql
chkconfig mysql on
%preun
chkconfig --del mysql
rm -rf /u01
userdel mysql
rm -rf /var/spool/mail/mysql
rm -rf /etc/init.d/mysql
rm -rf /home/mysql
%changelog
执行打包命令
rpmbuild -bb ./mysql.spec
输出:
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product