2019独角兽企业重金招聘Python工程师标准>>>
####################### 安装依赖 #####################
安装必要的包:
yum install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel bzip2 bzip2-devel curl curl-devel openssl openssl-devel gd gd-devel libmcrypt libmcrypt-devel
yum install gcc
yum install make
安装Pcre(Nginx需要):
yum install pcre pcre-devel
安装mysql要用到
yum install libaio
##################### 编译安装Mcripty ##################
下载Libmcrypt、mhash、mcrypt源码
1 .先安装Libmcrypt
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
说明:libmcrypt默认安装在/usr/local
2.安装mhash
#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make
#make install
3.安装mcrypt
tar -zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
export LD_LIBRARY_PATH=/usr/local/lib
./configure
make
make install
################## Nginx 编译安装 ######################
groupadd www
useradd -g www www
mkdir -p /data/www
chown -R www:www /data/www
Nginx编译参数
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module
make && make install
/usr/local/nginx/sbin/nginx // 启动Nginx
################### 编译MYSQL ######################
到MYSQL官网下载Mysql
解压后看INSTALL-BINARY这个文件 里面有详细的安装说明
1.问题:
./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解决办法: yum install libaio
2.问题:Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
解决办法:再次运行 scripts/mysql_install_db --user=mysql
################### PHP 编译安装 ####################
PHP编译参数:
./configure --prefix=/usr/local/php \
--with-libxml-dir \
--with-zlib \
--with-curl \
--enable-exif \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-gettext \
--with-mcrypt \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql \
--enable-soap \
--with-iconv \
--with-pear \
--enable-fastcgi \
--enable-fpm \
--enable-force-cgi-redirect \
--enable-pcntl \
--enable-mbstring \
--disable-fileinfo \
make && make install
将/usr/local/php/etc/下的php-fpm.conf.default 改为 php-fpm.conf
php 5.3.3 下的php-fpm
不再支持 php-fpm 以前具有的 /usr/local/php/sbin/php-fpm (start|stop|reload)等命令,需要使用信号控制:
master进程可以理解以下信号:
INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块
/usr/local/php/sbin/php-fpm & // 启动php-fpm
php-fpm 关闭:
kill -INT `cat /usr/local/php/var/run/php-fpm.pid`
php-fpm 重启:
kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`
查看php-fpm进程数:
ps aux | grep -c php-fpm