groupadd www useradd -g www www 1.centos编译安装 Nginx yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel gcc 下载Nginx源码包,减压。 cd ./configure --prefix=/usr/local/Nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --user=www --group=www make && make install cp /usr/local/Nginx/sbin/Nginx /usr/local/bin debian编译安装 Nginx aptitude install libpcre3-dev aptitude install libssl-dev ./configure --prefix=/usr/local/Nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --user=www-data --group=www-data 2. centos编译安装PHP 安装依赖包 yum install 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 bison bison-devel readline readline-devel net-snmp-devel libXpm* patch 下载源码包,减压, ./configure prefix=/usr/local/PHP --with-config-file-path=/usr/local/PHP/etc --with-fpm-user=www --with-fpm-group=www --with-libxml-dir --with-curl --with-mhash \ --with-pear --with-xmlrpc --with-iconv-dir --enable-soap --enable-fpm --enable-zip --with-zlib --enable-sockets --enable-mbstring --with-MysqL --with-MysqLi --enable-pdo --with-pdo-MysqL \ --with-openssl --with-jpeg-dir --with-png-dir --enable-exif --with-gd --with-freetype-dir --enable-gd-native-ttf make && make install cp PHP.ini-production /usr/local/PHP/etc/PHP.ini cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf cp /usr/local/src/PHP-5.6.3/sapi/fpm/init.d.PHP-fpm /etc/rc.d/init.d/PHP-fpm chmod +x /etc/init.d/PHP-fpm Nginx,fpm 都配置www用户,用户组需要一致 配置iptables iptables -A INPUT -p tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp --dport 80 -j ACCEPT service iptables save service iptables restart 注意(更改PHP的时区为亚洲上海) <?PHP PHPinfo(); ?> 安装扩展 /usr/local/PHP/bin/PHPize ./configure --prefix=/usr/local/PHP/ --with-PHP-config=/usr/local/PHP/bin/PHP-config make && make install 生成 一个类似/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20100525/ 的目录 vim /etc/PHP.ini extension=/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20100525/redis.so 重启fpm 3.centos编译安装MysqL groupadd MysqL useradd -g MysqL MysqL 安装依赖包 yum install -y apr* make cmake bison-devel ncurses-devel autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel font config fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool*libgomp libxml2 libxml2-devel libXpm* libtiff libtiff* makempfr ncurses* ntp openssl openssl-devel patchpcre-devel perl PHP-common PHP-gd policycoreutils telnet t1lib t1lib*nasm nasm*zlib-devel gd-devel libxslt-devel GeoIP* mkdir -p /data/MysqL && chown -R MysqL:MysqL /data/MysqL mkdir -p /usr/local/MysqL && chown -R MysqL:MysqL /usr/local/MysqL 下载源码包 cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/MysqL -DMysqL_DATADIR=/data/MysqL -DSYSCONFDIR=/etc make && make install 初始化数据库,配置启动脚本: mv/etc/my.cnf/etc/my.cnf.bak cd /usr/local/MysqL && ./scripts/MysqL_install_db --user=MysqL --basedir=/usr/local/MysqL --datadir=/data/MysqL && ln -s /usr/local/MysqL/my.cnf /etc/my.cnf cp ./support-files/MysqL.server /etc/rc.d/init.d/MysqLd chmod 755 /etc/init.d/MysqLd chkconfig MysqLd on #vim /etc/rc.d/init.d/MysqLd 改动如下: basedir=/usr/local/MysqL #MysqL程序安装路径 datadir=/data/MysqL #MysqL数据库存放目录 服务启动 service MysqLd start 手工启动 /usr/local/MysqL/bin/MysqLd --defaults-file=/etc/my.cnf --basedir=/usr/local/MysqL --datadir=/data/MysqL --plugin-dir=/usr/local/MysqL/lib/plugin --user=MysqL --log-error=/var/log/MysqL/localhost.err --open-files-limit=8192 --pid-file=/tmp/MysqLd_3308.pid --socket=/tmp/MysqL_3308.sock --port=3308 --general_log --general_log_file=/var/log/MysqL/query3308.log echo 'export PATH=$PATH:/usr/local/MysqL/bin' >> /etc/profile && source /etc/profile 4.编译memcached memcache yum install libevent libevent-devel ./configure --prefix=/usr/local/memcache make install cp memcached /usr/local/bin memcached -d -u nobody -m 512 -l 127.0.0.1 -p 11211 -d 为守护进程 -m分配内存 -l 监听地址 -p 端口 -c 最大运行的并发连接数,默认是1024, memcached -d -p 11211 -u memcached -m 1024 -c 2048 -P /var/run/memcached/memcached.pid 参考文档 http://www.cnblogs.com/jackluo/archive/2013/02/19/2917733.html 5.编译安装redis
原文链接:https://www.f2er.com/centos/382080.html