centOS6搭建lnmp環境 -开发者知识库

centOS6搭建lnmp環境 -开发者知识库,第1张

groupadd wwwuseradd -g www www1.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  installcp /usr/local/nginx/sbin/nginx /usr/local/bin  debian編譯安裝 nginxaptitude install libpcre3-devaptitude 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-data2. 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-ttfmake && make installcp php.ini-production /usr/local/php/etc/php.inicp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confcp /usr/local/src/php-5.6.3/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpmchmod x /etc/init.d/php-fpmnginx ,fpm 都配置www用戶,用戶組需要一致配置iptablesiptables -A INPUT -p tcp --dport 22 -j ACCEPTiptables -A INPUT -p tcp --dport 80 -j ACCEPTservice iptables saveservice iptables restart注意(更改php的時區為亞洲上海)<?php        phpinfo();?>安裝擴展/usr/local/php/bin/phpize./configure --prefix=/usr/local/php/ --with-php-config=/usr/local/php/bin/php-configmake && make install生成 一個類似/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/  的目錄vim /etc/php.iniextension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/redis.so重啟fpm3.centos編譯安裝mysql groupadd mysqluseradd -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/mysqlmkdir -p /usr/local/mysql && chown -R mysql:mysql /usr/local/mysql下載源碼包 cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etcmake && make install初始化數據庫,配置啟動腳本:mv/etc/my.cnf/etc/my.cnf.bakcd /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.cnfcp ./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.logecho 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile && source  /etc/profile4.編譯memcachedmemcacheyum install libevent libevent-devel./configure --prefix=/usr/local/memcachemake installcp memcached /usr/local/binmemcached -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.html5.編譯安裝redis

本文出自 “技術改變世界” 博客,轉載請與作者聯系!

最佳答案:

本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复