参考:http://54im.com/tag/libmcrypt
http://www.educity.cn/linux/1240338.html
yum -y install cmake gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libXpm* wget pcre-devel zlib-devel gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel bison automake zlib* libxml* ncurses-devel libtool-ltdl-devel* unzip
mkdir /opt/src && cd /opt/src
wget http://nginx.org/download/nginx-1.7.8.tar.gz #最新 wget http://cn2.php.net/distributions/php-5.4.36.tar.gz wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz #mysql5.6
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F&ts=1418528625&use_mirror=tcpdiag
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
wget http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.9%2F&ts=1418530194&use_mirror=hivelocity
wget http://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F&ts=1418531968&use_mirror=softlayer-dal
wget http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
wget http://www.cmake.org/files/v3.1/cmake-3.1.0.tar.gz
wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=1175740843&big_mirror=0"
wget https://github.com/eaccelerator/eaccelerator/archive/master.zip -O eaccelerator.zip
#更名
mv libmcrypt-2.5.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F libmcrypt-2.5.8.tar.gz
mv libmcrypt-2.5.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F libmcrypt-2.5.8.tar.gz mv mcrypt-2.6.8.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FMCrypt%2F2.6.8%2F mcrypt-2.6.8.tar.gz mv mhash-0.9.9.9.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fmhash%2Ffiles%2Fmhash%2F0.9.9.9%2F mhash-0.9.9.9.tar.gz mv eaccelerator-0.9.6.1.tar.bz2\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Feaccelerator%2Ffiles%2Feaccelerator%2FeAccelerator%200.9.6.1%2F eaccelerator-0.9.6.1.tar.bz2
tar zxvf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9 ./configure && make && make install ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
tar zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
./configure && make && make install
/sbin/ldconfig
cd libltdl/
./configure -enable-ltdl-install
make && make install
tar zxvf libiconv-1.14.tar.gz && cd libiconv-1.14
./configure --prefix=/opt
make && make install
tar zxvf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8 /sbin/ldconfig && ./configure && make && make install
tar zxvf cmake-3.1.0.tar.gz && cd cmake-3.1.0 && ./configure --prefix=/usr && gmake && gmake install
tar zxvf bison-3.0.tar.gz && cd bison-3.0 ./configure && make && make install
groupadd mysql useradd -g mysql mysql groupadd www useradd -g www www mkdir -p /data/mysql chown -R mysql:mysql /data/mysql mkdir -p /data/www chown -R www:www /data/www
tar zxvf mysql-5.6.22.tar.gz && cd mysql-5.6.22 cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_DATADIR=/data/mysql -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DSYSCONFDIR=/etc/ -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=on make && make install && ln -s /opt/mysql/lib/lib* /usr/lib/
/opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql/ --datadir=/data/mysql --user=mysql
cd /opt/mysql/support-files
cp my-default.cnf /etc/my.cnf
#初始化 cp /opt/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on #启动mysql /etc/rc.d/init.d/mysqld start #设置mysql登录密码 cd /opt/mysql && bin/mysql_secure_installation
tar zxvf php-5.4.36.tar.gz && cd php-5.4.36 ./configure --prefix=/opt/php --with-mysql=/opt/mysql --with-mysqli=/opt/mysql/bin/mysql_config --with-iconv-dir=/opt/src/libiconv-1.14 --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap && make && make install
cp php.ini-development /usr/local/php/etc/php.ini
#安装 unzip eaccelerator.zip && cd eaccelerator-master ./configure --enable-eaccelerator=shared --with-php-config=/opt/php/bin/php-config make && make install #配置 zend_extension="/opt/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so"#检查是否存在 eaccelerator.shm_size="64" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.log_file = "/opt/php/var/log/eaccelerator_log" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="3600" eaccelerator.shm_prune_period="3600" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9" #创建目录 mkdir -p /tmp/eaccelerator
cp /opt/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf vi /opt/php/etc/php-fpm.conf #几处修改,user/group要设好,其它选项可以自己调整 [global] pid = run/php-fpm.pid error_log = log/php-fpm.log emergency_restart_threshold = 10 emergency_restart_interval = 1m process_control_timeout = 5s [www] user = www group = www
更改php.ini 设置时区
vi etc/php.ini date.timezone = PRC
安装PCRE
wget http://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F&ts=1418696677&use_mirror=iwebhttp://downloads.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F&ts=1418696677&use_mirror=iweb -O pcre-8.36.tar.gz mv pcre-8.36.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.36%2F pcre-8.36.tar.gz tar zxvf pcre-8.36.tar.gz && cd pcre-8.36 ./configure make && make install
tar zxvf nginx-1.7.8.tar.gz && cd nginx-1.7.8 ./configure --user=www --group=www --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module make && make install
user www www; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; events { use epoll; worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /data/www; index index.html index.htm index.php; } error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
启动nginx和php-fpm
/opt/nginx/sbin/nginx
/opt/php/sbin/php-fpm