准备
下载
wget 'https://ftp.pcre.org/pub/pcre/pcre-8.40.zip' --no-check-certificate
wget 'http://nginx.org/download/nginx-1.12.2.tar.gz'
wget 'http://jp2.php.net/get/php-5.6.30.tar.xz'
wget 'https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz' --no-check-certificate
安装工具和依赖
yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison unzip
yum install openssl openssl-devel zlib-devel
yum install libxml2-devel bzip2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
安装
安装pcre
unzip pcre-8.40.zip
cd pcre-8.40
./configure && make && make install
nginx
useradd -s /sbin/nologin -r www
./configure --prefix=/usr/local/nginx \
--user=www --group=www \
--with-http_ssl_module --with-http_gzip_static_module \
--with-http_stub_status_module --with-http_dav_module \
--with-pcre=../pcre-8.40
make && make install
yum安装nginx
参考:http://nginx.org/en/linux_packages.html#stable
#vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
#centos 可以替换为rhel
nginx 配置
events {
worker_connections 1024;
use epoll;
}
log_format main_body '$remote_addr`$remote_user`$time_local`$request_method`$request_time`$request`$status`$body_bytes_sent`$request_body`$http_referer`$http_user_agent`$http_x_forwarded_for';
log_format main '$remote_addr`$remote_user`$time_local`$request_method`$request_time`$request`$status`$body_bytes_sent`$http_referer`$http_user_agent`$http_x_forwarded_for';
fastcgi_ignore_client_abort on;
limit_req_zone $binary_remote_addr zone=default:10m rate=8r/s;
charset utf-8;
tcp_nopush on;
tcp_nodelay on;
sendfile on;
mysql
useradd -s /sbin/nologin -r mysql
#5.7编译太慢了,慎用,建议直接下载二进制文件
#wget 'https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz' \
--no-check-certificate
#http://www.cnblogs.com/gsblog/p/3566878.html
#https://dev.mysql.com/doc/internals/en/cmake.html
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_USER=mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=boost
make && make install
#安装完成后
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
cd /usr/local/mysql/
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/
bin/mysqld_safe &
yum安装mysql
#vim /etc/yum.repos.d/mysql.repo
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
yum install mysql-community-server
service mysqld start
/usr/bin/mysql_secure_installation
授权
grant all privileges on *.* to ziliang@'%' identified by 'ziliang123' with grant option;
mysql配置
[mysql]
socket=/data0/var/log/mysql/mysql.sock
[mysqld]
datadir=/data0/mysql/data
socket=/data0/var/log/mysql/mysql.sock
slow-query-log-file=/data0/var/log/mysql/mysql-slow.log
log_queries_not_using_indexes=0
slow_query_log=1
long_query_time=0.02
log-error=/data0/var/log/mysql/mysql-error.log
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/data0/var/log/mysql/mysql-error.log
pid-file=/var/run/mysqld/mysqld.pid
php
#freetype 字体引擎 libxml2 c语言xml库
./configure --prefix=/usr/local/php --with-fpm-user=www --with-fpm-group=www \
--enable-fpm --enable-cli --enable-zip --enable-mbstring --enable-opcache --enable-ftp --enable-bcmath \
--enable-soap --enable-pcntl --enable-sockets \
--with-curl --with-openssl --with-iconv --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--with-zlib-dir --with-bz2 --with-libxml-dir --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir
make && make install
配置
cp php-5.6.30/php.ini-production /usr/local/php/lib/php.ini
date.timezone = PRC
error_log = /data0/var/log/php/error.log
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE
cp php-5.6.30/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
error_log = /data0/var/log/php/php-fpm.log
ftp
setenforce 0
[vsfptd.conf]
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=000
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
chroot_local_user=YES
chroot_list_enable=NO
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/ftp_user_ext
tcp_wrappers=YES
网友评论