#Install Aptitude
apt-get update
apt-get install aptitude
#Install Ubuntu Essential
aptitude update
aptitude dist-upgrade
aptitude install dstat build-essential fail2ban git
aptitude install python-software-properties
#Install the Latest Nginx:
add-apt-repository ppa:nginx/development
aptitude update
aptitude install nginx
#Install the Latest PHP7.0:
add-apt-repository ppa:ondrej/php
aptitude update
aptitude install php7.0-fpm php7.0-cli php7.0-curl php7.0-mysql php7.0-dev php7.0-cli php7.0-common php7.0-mbstring php7.0-intl
#Install the Latest GeoIP:
aptitude install libgeoip-dev
aptitude install git
git clone https://github.com/Zakay/geoip.git
cd geoip
phpize
./configure --with-php-config=/usr/bin/php-config
make
make install
echo "extension=geoip.so" > /etc/php/7.0/mods-available/geoip.ini
ln -s /etc/php/7.0/mods-available/geoip.ini /etc/php/7.0/cli/conf.d/20-geoip.ini
ln -s /etc/php/7.0/mods-available/geoip.ini /etc/php/7.0/fpm/conf.d/20-geoip.ini
#Install the Latest Imagick:
aptitude install libmagickwand-dev libmagickcore-dev
git clone https://github.com/mkoppanen/imagick.git
cd imagick
phpize
./configure --with-php-config=/usr/bin/php-config
make
make install
echo "extension=imagick.so" > /etc/php/7.0/mods-available/imagick.ini
ln -s /etc/php/7.0/mods-available/imagick.ini /etc/php/7.0/cli/conf.d/20-imagick.ini
ln -s /etc/php/7.0/mods-available/imagick.ini /etc/php/7.0/fpm/conf.d/20-imagick.ini
#Install the Latest OpenCC
aptitude install cmake doxygen
git clone https://github.com/BYVoid/OpenCC.git
cd OpenCC
make
sudo make install
git clone https://github.com/NauxLiu/opencc4php
cd opencc4php
phpize
./configure --with-php-config=/usr/bin/php-config
make
sudo make install
echo "extension=opencc.so" > /etc/php/7.0/mods-available/opencc.ini
ln -s /etc/php/7.0/mods-available/opencc.ini /etc/php/7.0/cli/conf.d/20-opencc.ini
ln -s /etc/php/7.0/mods-available/opencc.ini /etc/php/7.0/fpm/conf.d/20-opencc.ini
#Install Railgun
echo 'deb http://pkg.cloudflare.com/ wily main' | sudo tee /etc/apt/sources.list.d/cloudflare-main.list
curl -C - https://pkg.cloudflare.com/pubkey.gpg | sudo apt-key add -
aptitude update
aptitude install memcached railgun-stable
2016年4月22日 星期五
The Best my.cnf for Percona 5.7
[mysql]
socket = /var/run/mysql/mysql.sock
[mysqld]
user = mysql
bind-address = 0.0.0.0
port = 3306
basedir = /usr/local/mysql
pid-file = /var/run/mysql/mysql.pid
socket = /var/run/mysql/mysql.sock
datadir = /var/data/mysql
tmpdir = /tmp
# Log Path
#lc-messages-dir = /var/log/mysql
#lc_messages = en_US
log-error = /var/log/mysql/error.log
explicit_defaults_for_timestamp
skip-name-resolve
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links = 0
max_allowed_packet = 16M
max_connect_errors = 1000000
thread_stack = 192K
thread_cache_size = 50
max_connections = 500
#max_heap_table_size = 2G
#tmp_table_size = 2G
table_open_cache = 16384
table_definition_cache = 16384
open_files_limit = 65536
#key_buffer_size = 512M
query_cache_type = 0
#default_storage_engine = TokuDB
#default_tmp_storage_engine = TokuDB
# Innodb Settings
innodb_buffer_pool_size = 12G
innodb_buffer_pool_instances = 8
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1
innodb_flush_method = O_DIRECT
innodb_log_files_in_group = 2
innodb_log_file_size = 4G
innodb_flush_log_at_trx_commit = 0
innodb_change_buffering = all
# innodb_additional_mem_pool_size = 32M
innodb_file_per_table = 1
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 50000
#innodb_log_buffer_size = 16M
innodb_thread_concurrency = 0
#innodb_lock_wait_timeout = 120
innodb_open_files = 65536
innodb_autoinc_lock_mode = 1
#innodb_log_write_ahead_size = 4096
innodb_flush_neighbors = 0
#tokudb_loader_memory_size = 10G
#tokudb_directio = 1
#tokudb_cache_size = 25G
#tokudb_commit_sync = OFF
#tokudb_fsync_log_period = 1000
#tokudb_analyze_in_background = ON
#tokudb_analyze_mode = TOKUDB_ANALYZE_RECOUNT_ROWS
# BINARY LOGGING #
#log-bin = /var/data/mysql/mysql-bin
#sync-binlog = 1
#expire-logs-days = 14
# Slow Query Log
#slow_query_log_file = /var/log/mysql/slow-query.log
slow_query_log = 0
long_query_time = 3
socket = /var/run/mysql/mysql.sock
[mysqld]
user = mysql
bind-address = 0.0.0.0
port = 3306
basedir = /usr/local/mysql
pid-file = /var/run/mysql/mysql.pid
socket = /var/run/mysql/mysql.sock
datadir = /var/data/mysql
tmpdir = /tmp
# Log Path
#lc-messages-dir = /var/log/mysql
#lc_messages = en_US
log-error = /var/log/mysql/error.log
explicit_defaults_for_timestamp
skip-name-resolve
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links = 0
max_allowed_packet = 16M
max_connect_errors = 1000000
thread_stack = 192K
thread_cache_size = 50
max_connections = 500
#max_heap_table_size = 2G
#tmp_table_size = 2G
table_open_cache = 16384
table_definition_cache = 16384
open_files_limit = 65536
#key_buffer_size = 512M
query_cache_type = 0
#default_storage_engine = TokuDB
#default_tmp_storage_engine = TokuDB
# Innodb Settings
innodb_buffer_pool_size = 12G
innodb_buffer_pool_instances = 8
innodb_buffer_pool_dump_at_shutdown = 1
innodb_buffer_pool_load_at_startup = 1
innodb_flush_method = O_DIRECT
innodb_log_files_in_group = 2
innodb_log_file_size = 4G
innodb_flush_log_at_trx_commit = 0
innodb_change_buffering = all
# innodb_additional_mem_pool_size = 32M
innodb_file_per_table = 1
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 50000
#innodb_log_buffer_size = 16M
innodb_thread_concurrency = 0
#innodb_lock_wait_timeout = 120
innodb_open_files = 65536
innodb_autoinc_lock_mode = 1
#innodb_log_write_ahead_size = 4096
innodb_flush_neighbors = 0
#tokudb_loader_memory_size = 10G
#tokudb_directio = 1
#tokudb_cache_size = 25G
#tokudb_commit_sync = OFF
#tokudb_fsync_log_period = 1000
#tokudb_analyze_in_background = ON
#tokudb_analyze_mode = TOKUDB_ANALYZE_RECOUNT_ROWS
# BINARY LOGGING #
#log-bin = /var/data/mysql/mysql-bin
#sync-binlog = 1
#expire-logs-days = 14
# Slow Query Log
#slow_query_log_file = /var/log/mysql/slow-query.log
slow_query_log = 0
long_query_time = 3
Build Percona 5.7 on Ubuntu 16.04
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
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
訂閱:
文章 (Atom)