将CentOS部署MySQL需要本地配置环境、本地编译MySQL,耗时较长的情况,优化为编译成型MySQL并打包,推送并按配置部署。
首先需要在一台机器配置好环境,搭个YUM源,并将所需要的包取出备用。
环境:
CentOS-6.3-x86_64-bin-DVD1.iso
cmake-2.8.3
mysql-5.5.14.tar.gz
一、配置yum源
CentOS-Base.repo 是yum 网络源的配置文件,CentOS-Media.repo 是yum 本地源的配置文件
禁用默认的yum 网络源,将yum 网络源配置文件改名为CentOS-Base.repo.bak,否则会先在网络源中寻找适合的包,改名之后直接从本地源读取。
##挂载并修改repo文件
mkdir /mnt/yum_source/ mount -o rw,remount /export/jiangxu/CentOS-6.3-x86_64-bin-DVD1.iso /mnt/yum_source -o loop ##挂载并可读写 echo " [software] name=software baseurl=file:///mnt/yum_source gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6" > /etc/yum.repos.d/yumsource_local.repo echo " # CentOS-Media.repo # # This repo is used to mount the default locations for a CDROM / DVD on # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command] [c6-media] name=CentOS-$releasever - Media #baseurl=file:///media/CentOS/ # file:///media/cdrom/ # file:///media/cdrecorder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 baseurl=file:///mnt/yum_source" > /etc/yum.repos.d/CentOS-Media.repo