安装依赖库
yum -y install gcc gcc-c++ python-devel libtool cmake bison
libxml2-devel ncurses-devel zlib-devel pcre-devel
安装pcre
下载地址1:http://www.pcre.org/
下载地址2:https://www.cnblogs.com/LiuYanYGZ/p/5903954.html
./configure --prefix=/usr/local/pcre --libdir=/usr/local/lib/pcre --includedir=/usr/local/include/pcre
make && make install
安装libxml2
下载地址:http://xmlsoft.org/sources/
./configure --prefix=/usr/local/libxml2/
make
make install
安装libmcrypt
./configure --prefix=/usr/local/libmcrypt/
make
make install
安装 libltdl,也在 libmcrypt 源码目录中
./configure --enable-ltdl-install
make
make install
安装 mhash
./configure
make
make install
安装 mcrypt
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib \
./configure --with-libmcrypt-prefix=/usr/local/libmcrypt
安装zlib
./configure
make
make install >> /root/zlib.log
yum -y install zlib-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel libmcrypt-devel curl-devel
安装 libpng
下载地址1:http://www.libpng.org
下载地址2:https://sourceforge.net/
1.6安装失败降低版本1.5版本图片显示失败 再次降低版本
./configure --prefix=/usr/local/libpng
make
make install
安装 jpeg
下载地址:http://www.ijg.org/files/
mkdir /usr/local/jpeg9
mkdir /usr/local/jpeg9/bin
mkdir /usr/local/jpeg9/lib
mkdir /usr/local/jpeg9/include
mkdir -p /usr/local/jpeg9/man/man1
./configure --prefix=/usr/local/jpeg9/ --enable-shared --enable-static
make
make install
安装 freetype
https://www.freetype.org/
./configure --prefix=/usr/local/freetype/
make
make install
安装 GD 库
./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg9/ --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/
make
make install
安装openssl库
https://www.openssl.org/source/
./config shared zlib --prefix=/usr/local/openssl && make && make install
安装apr和apr-util
https://apr.apache.org/
cp -r /lamp/apr-1.4.6 /lamp/httpd-2.4.7/srclib/apr
cp -r /lamp/apr-util-1.4.1 /lamp/httpd-2.4.7/srclib/apr-util
安装apache
http://httpd.apache.org/download.cgi
./configure --prefix=/usr/local/apache24/ --sysconfdir=/usr/local/apache24/etc/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared
make
make install
/usr/local/apache24/bin/apachectl start
ps –aux | grep httpd
netstat –tlun | grep :80
设置开启启动
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local
安装nignx
http://nginx.org/en/download.html
groupadd www
useradd -g www www
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module
make
make install
./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_module
启动nginx
/usr/local/nginx/sbin/nginx
nginx -s reload :修改配置后重新加载生效
nginx -s reopen :重新打开日志文件
nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确
关闭nginx:
nginx -s stop :快速停止nginx
nginx -s quit :完整有序的停止nginx
ps -ef | grep nginx
安装ncurses
http://ftp.gnu.org/gnu/ncurses/
./configure --with-shared --without-debug --without-ada --enable-overwrite
make
make install
安装cmake
安装bison
安装boost
http://sourceforge.net/projects/boost/files/boost/
./bootstrap.sh
./b2 install
比较耗时可以不安装 安装mysql直接指定路径
必须用boost_1_59_0 其他版本不兼容
安装mysql
www.mysql.com
groupadd mysql
useradd -g mysql mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql57 -DMYSQL_DATADIR=/data/mysql57 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=/usr/local/boost
cd /usr/local/mysql57/
chown -R mysql .
chgrp -R mysql .
//初始化数据库
/usr/local/mysql57/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql57 --datadir=/data/mysql57
/usr/local/mysql57/bin/mysql_ssl_rsa_setup --user=mysql --basedir=/usr/local/mysql57 --datadir=/data/mysql57
chown -R root .
chown -R mysql data
启动mysql服务
/usr/local/mysql57/bin/mysqld_safe --defaults-file=/etc/my.cnf &
//修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
cat /root/.mysql_secret
bin/mysqladmin -h localhost -u root password 'root' -p'?G5W&tz1z.cN'
update mysql.user set authentication_string=password('root') where user='root' and Host = 'localhost';
//远程登录
update mysql.user set Host='%' where user='root' and Host = 'localhost';
flush privileges;
安装libtool
http://www.gnu.org/software/libtool/
安装curl
https://curl.haxx.se/download.html
./configure --prefix=/usr/local/curl
make && make install
./configure --prefix=/usr/local/curl --disable-shared --enable-static --without-libidn --without-ssl --without-librtmp --without-gnutls --without-nss --without-libssh2 --without-zlib --without-winidn --disable-rtsp --disable-ldap --disable-ldaps --disable-ipv6
安装libiconv
http://www.gnu.org/software/libiconv/
./configure --prefix=/usr/local/libiconv
make
make install
安装PHP
http://www.php.net/
yum -y install “libtool*”
yum -y install “libtool-ltdl*”
yum install libXpm-devel
wrong mysql library version or lib not found. Check config.log for more information.
configure: WARNING: unrecognized options: --with-mysql
不能指定mysql路径
如果之前编译过一次需要执行
make clean
make ZEND_EXTRA_LIBS='-lresolv'
./configure --prefix=/usr/local/php71/ --with-config-file-path=/usr/local/php71/etc/ --with-mysql=/usr/local/mysql57/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg9/ --with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-iconv-dir=/usr/local/libiconv --with-mysqli=/usr/local/mysql57/bin/mysql_config --with-pdo-mysql --with-curl=/usr/local/curl --with-xpm-dir=/usr/lib64/ --enable-fpm --enable-soap --enable-mbstring=all --enable-sockets --enable-opcache
make && make install
cd /usr/local/php71/etc/
cp php-fpm.conf.default php-fpm.conf
include=/usr/local/etc/php-fpm.d/*.conf
cd php-fpm.d/
cp www.conf.default www.conf
user = www
group = www
cp /usr/local/src/php-7.1.15/php.ini-production /usr/local/php71/etc/php.ini
date.timezone = Asia/Shanghai 设置时区
启动fpm
/usr/local/php71/sbin/php-fpm
ps -ef | grep php-fpm
netstat -tnl | grep 9000
添加开机启动
vi /etc/rc.local 添加 /usr/local/php71/sbin/php-fpm
INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块
kill -USR2 42891
或者修改配置文件打开pid
vim /usr/local/php71/etc/php-fpm.conf
;pid = run/php-fpm.pid
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'
编译安装 mcrypt
cd /usr/local/src/php-7.1.15/ext/mcrypt/
/usr/local/php71/bin/phpize
./configure --with-php-config=/usr/local/php71/bin/php-config
--with-mcrypt=/usr/local/libmcrypt/
./configure --with-php-config=/usr/local/php71/bin/php-config --with-mcrypt=/usr/local/libmcrypt/
make
make install
修改 /usr/local/php71/etc/php.ini
extension_dir = "/usr/local/php71/lib/php/extensions/no-debug-zts-20100525/"
#打开注释,并修改
extension="memcache.so";
extension="mcrypt.so";
重启fpm和nginx
安装libevent
http://libevent.org/
//yum -y install libevent libevent-devel
可以用yum安装
./configure --prefix=/usr/local/libevent
make
make install
安装 memcache 源代码
http://www.memcached.org/
memcached-1.5.6.tar.gz
./configure --prefix=/usr/local/memcached
make && make install
useradd memcached
/usr/local/memcached/bin/memcached -u memcached &
写入自启动
vi /etc/rc.d/rc.local
安装 libmemcache
./configure --prefix=/usr/local/libmemcached --with-memcached
make
make install
安装 memcached或memcache扩展
http://pecl.php.net/package/memcached
http://pecl.php.net/package/memcache
/usr/local/php71/bin/phpize
./configure --with-php-config=/usr/local/php71/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
make
make install
./configure --enable-memcache --with-php-config=/usr/local/php71in/php-config --with-zlib-dir
make && make install
vi /usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/"
extension="memcached.so";
extension="mcrypt.so"
安装eAccelerator
https://github.com/eaccelerator/eaccelerator
https://sourceforge.net/projects/eaccelerator/
/usr/local/php71/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make
make install
mkdir /tmp/cache/eaccelerator
chmod 0777 /tmp/cache/eaccelerator
安装igbinary
https://pecl.php.net/package/igbinary
/usr/local/php/bin/phpize
./configure --enable-igbinary --with-php-config=/usr/local/php/bin/php-config
make && make install
cd phpredis-master
/usr/local/php/bin/phpize
./configure --enable-redis --enable-redis-igbinary --with-php-config=/usr/local/php/bin/php-config
make && make install
tar zxvf ImageMagick-6.8.3-10.tar.gz
cd ImageMagick-6.8.3-10/
./configure
make
make install
tar zxvf imagick-3.0.1.tgz
cd imagick-3.0.1/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
make
make install