apt-get update
apt-get install aptitude
aptitude update
aptitude dist-upgrade
aptitude install dstat build-essential fail2ban git
aptitude install cmake libncurses5-dev libaio-dev libreadline6-dev zlib1g-dev
aptitude update
groupadd mysql
useradd -g mysql mysql
mkdir -p /etc/mysql
mkdir -p /var/data/mysql
mkdir -p /var/log/mysql
mkdir -p /var/run/mysql
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /var/data/mysql
chown -R mysql:mysql /var/log/mysql
chown -R mysql:mysql /var/run/mysql
> Download Percona Server Latest Source
wget https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.11-4/source/tarball/percona-server-5.7.11-4.tar.gz
tar xvzf percona-server-5.7.11-4.tar.gz
cd percona-server-5.7.11-4/
cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DWITH_EMBEDDED_SERVER=OFF -DWITH_BOOST=~/boost -DDOWNLOAD_BOOST=1
make -j 8
make install
# If CMake got Error then remove CMakeCache.txt and run again.
rm CMakeCache.txt
cd /usr/local/mysql
cp ./support-files/mysql.server /etc/init.d/mysql
cp ./support-files/my-default.cnf /etc/mysql/my.cnf
# Add Path to system-wide enviroment variables applying to all users.
vim /etc/environment
Add "/usr/local/mysql/bin:" to the beginning of PATH
. /etc/environment
mysqld --initialize-insecure
#Regardless of platform, use --initialize for “secure by default” installation (that is, including generation of a random initial root password). In this case, the password is marked as expired and you will need to choose a new one. With the --initialize-insecure option, no root password is generated; it is assumed that you will assign a password to the account in timely fashion before putting the server into production use.
mysql_secure_installation
mysqld stop
# This command will ask you some inputs to set root password, remove anonymous users, disallow root login remotely, remove test database and reload privilege tables.
# Register Service
Create the service file in /etc/init.d/<service name>
chmod 700 /etc/init.d/<service name>
# Auto Start Up
update-rc.d mysql defaults
update-rc.d mysql enable
service --status-all
沒有留言:
張貼留言