yum -y install 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 make cmake gd gd2 gd-devel gd2-devel libaio
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
ulimit -SHn 65535
sh -x /usr/local/sh/tar_all.sh
cd pcre-8.32
./configure --prefix=/usr/local/pcre
make && make install
cd ../
cd openssl-1.0.0e
./config --prefix=/usr/local/openssl
make
make install
cd ../
cd nginx-1.5.2
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/source/pcre-8.32 --with-http_realip_module --with-http_image_filter_module --with-openssl=/usr/local/source/openssl-1.0.0e
make
make install
cd ..
mkdir -p /usr/local/jpeg9
cd jpeg-9/
./configure --enable-shared --enable-static --prefix=/usr/local/jpeg9
make
make install
cd ..
cd libpng-1.6.10
./configure --prefix=/usr/local/libpng
make
make install
cd ..
cd freetype-2.4.12/
./configure --prefix=/usr/local/freetype
make
make install
cd ../
cd libmcrypt-2.5.8/
./configure --prefix=/usr/local/libmcrypt --enable-ltdl-install
make
make install
cd ..
cd mhash-0.9.9.9/
./configure --prefix=/usr/local/mhash
make
make install
cd ../
cd mcrypt-2.6.8/
export LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/mhash/lib
export LDFLAGS="-L/usr/local/mhash/lib/ -I/usr/local/mhash/include/"
export CFLAGS="-I/usr/local/mhash/include/"
./configure --prefix=/usr/local/mcrypt --with-libmcrypt-prefix=/usr/local/libmcrypt
make
make install
cd ../
groupadd mysql
useradd -g mysql mysql
mkdir -p /usr/local/mysql
mkdir -p /var/data/mysql
chown mysql:mysql -R /usr/local/mysql
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \
-DMYSQL_DATADIR:PATH=/var/data/mysql \
-DMYSQL_USER=mysql
make
make install
cp support-files/my-default.cnf /etc/my.cnf
//设置mysqld的开机启动
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig --add /etc/init.d/mysqld
chkconfig mysql on
chmod 755 scripts/mysql_install_db
scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/data/mysql
export PATH=/usr/local/mysql/bin:$PATH
ln -s /usr/local/mysql/bin/mysql /usr/bin
/etc/init.d/mysqld start
mysqladmin -u root password 'archermind'
use mysql;
update user set password='archermind' where user = '127.0.0.1';
delete from user where password="";
flush privileges;
quit;
三、实现MySQL远程连接的实际操作流程
mysql –u root –p
use mysql;
select user,password,host from user;
update user set host = '192.168.%' where user = '127.0.0.1'; //设置本地用户可以在任何终端登录
GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY 'root密码' WITH GRANT OPTION; //给root远程登录的权限
FLUSH PRIVILEGES; //使设置生效
jpeg9 libpng freetype libmcrypt mcrypt -------------------------
5、编译安装PHP 5.5
cd php-5.5.1/
//export LIBS="-lm -ltermcap -lresolv"
//export DYLD_LIBRARY_PATH="/usr/lib/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
//export LD_LIBRARY_PATH="/Data/apps/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg9 --with-png-dir=/usr/local/libpng --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring=all --with-mcrypt=/usr/local/libmcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash=/usr/local/mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --enable-pdo --with-pdo-mysql --enable-maintainer-zts
---------------------------------------------------------------------------------------------------------------------------------------------------
ln -s /usr/lib64/mysql /usr/lib
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/jpeg9 --with-png-dir=/usr/local/libpng --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring=all --with-mcrypt=/usr/local/libmcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash=/usr/local/mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --enable-pdo --with-pdo-mysql --enable-maintainer-zts --disable-fileinfo
---------------------------------------------------------------------------------------------------------------------------------------------------
make install
cd ../
#进行PHP配置文件配置
cp php.ini-production /usr/local/php/etc/php.ini
./build/shtool install -e ext/phar/phar.phar /usr/local/php/bin/
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
启动php-fpm
/usr/local/php/sbin/php-fpm
/usr/local/php/sbin/php-fpm
pkill php-fpm
启动nginx
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload
/usr/local/nginx/sbin/nginx -s reopen
测试配置文件是否正确 #./nginx -t
#将nginx添加到自启动中
echo "/usr/local/nginx/sbin/nginx">> /etc/rc.d/rc.local
#将php添加到自启动中
echo "/usr/local/php/sbin/php-fpm start">> /etc/rc.d/rc.local
5、编译安装PHP扩展
wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar zxvf autoconf-latest.tar.gz
cd autoconf-2.69/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf memcache-2.2.7.tgz
cd memcache-2.2.7/
export PHP_AUTOCONF="/Data/apps/libs/bin/autoconf"
export PHP_AUTOHEADER="/Data/apps/libs/bin/autoheader"
/Data/apps/php/bin/phpize
./configure --with-php-config=/Data/apps/php/bin/php-config
make
make install
cd ../
打开 /Data/apps/php/etc/php.ini 查找 ; extension_dir = "ext"
在其后增加一行:
extension = "memcache.so"
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
?配置讲解
nginx将会连接回环地址9000端口执行PHP文件,需要使用tcp/ip协议,速度比较慢.建议大家换成使用socket方式连接。将fastcgi_pass 127.0.0.1:9000;改成fastcgi_pass unix:/var/run/phpfpm.sock;
---------------------------------------------------------------------------------------------------