2016年11月2日 星期三

Setup Latest Percona Server

apt-get update
apt-get install aptitude

aptitude update
aptitude dist-upgrade
aptitude install dstat build-essential fail2ban git cmake libncurses5-dev libaio-dev libreadline6-dev zlib1g-dev bison


git clone https://github.com/percona/percona-server.git
cd percona-server
git checkout 5.7
git submodule init
cmake . -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost
make dist -j

cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost
make -j

groupadd mysql
useradd -g mysql mysql

mkdir -p /etc/mysql
mkdir -p /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
mkdir -p /var/data/mysql
chown -R mysql:mysql /var/data/mysql
mkdir -p /var/log/mysql
chown -R mysql:mysql /var/log/mysql
mkdir -p /var/run/mysql
chown -R mysql:mysql /var/run/mysql

make install -j
cd /usr/local/mysql
cp ./support-files/mysql.server /etc/init.d/mysql
cp ./support-files/my-default.cnf /etc/mysql/my.cnf
chmod 700 /etc/init.d/mysql
update-rc.d mysql defaults
update-rc.d mysql enable
service --status-all

vim /etc/environment
sed -e 's|/usr/local/mysql/bin:||g' -i /etc/environment
sed -e 's|PATH="\(.*\)"|PATH="/usr/local/mysql/bin:\1"|g' -i /etc/environment
. /etc/environment

scp [REMOTE_ADDR]:/etc/mysql/my.cnf /etc/mysql/my.cnf

mysqld --initialize-insecure
mysql_secure_installation

沒有留言:

張貼留言