马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们!LEMP主动化编译剧本下载:http://docs.linuxtone.org/autoinstall/(按期更新,迎接多测试,找bug)引见参考:http://bbs.linuxtone.org/thread-6976-1-1.html
hamgua(哈密瓜)http://bbs.linuxtone.org(IT运维专家网|集群架构|机能调优)
迎接转载,转载时请务必以超链接情势标明文章出处和作者信息及本声明。
更新时光:2011-03-06
平台搭建情况:
CentOS5.5x86_64
目的:
构建高机能的LEMP情况供给WEB办事
1、体系装置
1.体系分区建议
/boot100M(年夜约100阁下)
SWAP物理内存的2倍(假如你的物理内存年夜于4G,分派4G便可)
/分区15~20G
/usr/local(用于装置软件)
/data残剩一切空间
【注】详细分区请依据相干营业划分,详细装置本文不作引见,装置过程当中选择起码的包,采取文本形式装置请不要装置图形形式。
2.体系初始化体系初始化剧本(依据详细需求封闭不须要的办事)
#shnetwork.sh//下载本文供给的lemp.zip包,便可找到此剧本。
2、编译装置根本情况
1.装置预备
1.1体系软件包装置标准
体系商定
/usr/local/src软件源代码包寄存地位
/usr/local/softname_version源码包编译装置地位(prefix)
/usr/local/sbin剧本和保护法式寄存地位
/data/mysql/3306/dataMySQL数据库地位(可按情形设置)
/data/www/wwwroot网站根目次(可按情形设置)
/data/logs虚拟主机日记根目次(可按情形设置)
www:wwwnginx运转账户
mysql:mysqlmysq运转账户
install_softwartname_version.sh寄存编译参数剧本习气,将一切编译剧本寄存在
install_softwartname_version.sh中,便于进级和更新软件。
创立网站帐号及相干寄存目次
#shadd_nginx_user.sh
- /usr/sbin/groupaddwww
- /usr/sbin/useraddCgwwwwww
- mkdirCp/data/{logs,www/wwwroot}
- chmod755CR/data/{logs,www/wwwroot}
- chownwww:wwwCR/data/{logs,www/wwwroot}
复制代码
创立数据库帐号及寄存目次
#shadd_mysql_user.sh
- /usr/sbin/groupaddmysql-g27
- /usr/sbin/useradd-u27-gmysql-c"MySQLServer"mysql-s/sbin/nologin
- mkdirCp/data/mysql/3306/{data,logs/{binlog,relaylog}}
- chownmysql:mysqlCR/data/mysql
复制代码
1.2体系情况安排及调剂
检讨体系能否正常
#tailCn100/var/log/message(检讨有没有体系级毛病信息)
#dmesg(检讨硬件装备能否有毛病信息)
#ifconfig(检讨网卡设置能否准确)
#pingbbs.linuxtong.org(检讨收集能否正常)
1.3应用yum法式装置所需开辟包(以下为尺度的RPM包称号)
添加国际镜像源,加快软件装置下载速度,请参照:http://bbs.linuxtone.org/thread-158-1-1.html
#shyum.sh
- yum-yinstalldialogntpvim-enhancedvixie-crongccgcc-c++gcc-g77flexbisonautoconfautomakeglibcglibc-develglib2glib2-develbzip2bzip2-develncursesncurses-devellibtool*zlib-devellibxml2-devellibjpeg-devellibpng-devellibtiff-develfontconfig-develfreetype-devellibXpm-develgettext-develcurlcurl-develpam-devele2fsprogs-develkrb5-devellibidnlibidn-developensslopenssl-developenldapopenldap-develnet-snmpnet-snmp-develnss_ldapopenldap-clientsopenldap-serverslibtidylibtidy-devel
复制代码
1.4准时校订办事器时钟,准时与中国国度时光中间办事器同步
#crontabCe
参加一行:
- 151***/usr/sbin/ntpdate210.72.145.44;/usr/sbin/hwclock-w>/dev/null2>&1
复制代码
1.5下载编译相干的源码包
#cd/usr/local/src
#vilist.txt//在list.txt文件里填入下载地址列表
- http://docs.linuxtone.org/soft/lemp/packages/pcre-8.10.tar.gz
- http://labs.frickle.com/files/ngx_cache_purge-1.2.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/nginx-0.8.53.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/libiconv-1.13.1.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/libmcrypt-2.5.8.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/mcrypt-2.6.8.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/mhash-0.9.9.9.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/eaccelerator-0.9.6.1.tar.bz2
- http://docs.linuxtone.org/soft/lemp/packages/libevent-1.4.13-stable.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/memcache-2.2.6.tgz
- http://docs.linuxtone.org/soft/lemp/packages/memcached-1.0.2.tgz
- http://docs.linuxtone.org/soft/lemp/packages/memcached-1.4.5.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/libmemcached-0.44.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/ImageMagick.tar.gz
- http://docs.linuxtone.org/soft/lemp/packages/imagick-3.0.1.tgz
- http://download.suhosin.org/suhosin-patch-5.3.4-0.9.10.patch.gz
- http://www.ckuyun.com/files/v2.8/cmake-2.8.4.tar.gz
- http://pecl.php.net/get/tidy-1.2.tgz
- http://mirrors.sohu.com/php/php-5.3.4.tar.gz
- http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.8.tar.gz
- ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.12.tar.gz
- http://pecl.php.net/get/gmagick-1.0.8b1.tgz
复制代码
#wgetCilist.txt
2.编译装置软件包源码编译装置所需包(Source)
2.1编译装置Nginx
- tarzvxfpcre-8.10.tar.gz
- cdpcre-8.10
- ./configure&&make&&makeinstall
复制代码
- tarzvxfnginx-0.8.53.tar.gz
- cdnginx-0.8.53
- ./configure--user=www--group=www--prefix=/usr/local/nginx-0.8.53/--add-module=../ngx_cache_purge-1.2--with-http_stub_status_module--with-http_ssl_module--with-http_sub_module--with-md5=/usr/lib--with-sha1=/usr/lib--with-http_gzip_static_module
- make&&makeinstall
复制代码
- mkdir-p/data/cache/nginx_cache
- mkdir-p/data/cache/nginx_temp
复制代码
2.2编译装置MySQL
注:MySQL的5.5把原来用的autotools的换成CMake了。
mysql5.5融会了mysql数据库和innodb存储引擎的长处,可以或许供给高机能的数据库治理处理计划,包含:innodb作为默许的数据库存储引擎
多核机能晋升
复制功效(Replication)增强
加强表分区功效
晋升了windows体系下的体系机能和可扩大性
改良机能和可扩大性,周全应用各平台古代多核构架的留意才能
进步适用性
进步易治理性和效力
进步可用性
改良检测与诊断机能
- tarzvxfcmake-2.8.4.tar.gz
- cdcmake-2.8.4
- ./configure&&make&&makeinstall
复制代码
- tarzxvfmysql-5.5.8.tar.gz
- cdmysql-5.5.8
- cmake.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.8-DMYSQL_DATADIR=/data/mysql/3306/data-DSYSCONFDIR=/etc-DWITH_INNOBASE_STORAGE_ENGINE=1-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1-DWITH_FEDERATED_STORAGE_ENGINE=1-DWITH_PARTITION_STORAGE_ENGINE=1-DMYSQL_TCP_PORT=3306-DENABLED_LOCAL_INFILE=1-DWITH_SSL=yes-DEXTRA_CHARSETS=all-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci-DWITH_READLINE=on
- gmake
- makeinstall
复制代码
设置装备摆设mysql设置装备摆设文件
- cd/data/mysql/3306
- wgethttp://bbs.linuxtone.org/forum-attachment-aid-MjM4OXxkZGRhNDBhZHwxMjk5NDExMjc2fDQ2.html
- chownmysql:mysql/data/mysql/3306/my.cnf
- lnCs/data/mysql/3306/my.cnf/etc/
复制代码
(设置装备摆设文件也能够上传附件中my.cnf)
初始化mysql数据
- mkdir-p/usr/local/mysql-5.5.8/include/mysql
- ln-s/usr/local/mysql-5.5.8/include/*/usr/local/mysql-5.5.8/include/mysql/
- /usr/local/mysql-5.5.8/scripts/mysql_install_db--basedir=/usr/local/mysql-5.5.8/--datadir=/data/mysql/3306/data--user=mysql--defaults-file=/data/mysql/3306/my.cnf
- cp/usr/local/mysql-5.5.8/support-files/mysql.server/etc/rc.d/init.d/mysqld>/dev/null2>&1
- chmod755/etc/rc.d/init.d/mysqld
- chkconfig--addmysqld
- /etc/rc.d/init.d/mysqldstart>/dev/null2>&1
- rm-rf/usr/bin/mysql*>/dev/null2>&1
- cd/usr/local/mysql-5.5.8/bin/
- foriin*;doln-s/usr/local/mysql-5.5.8/bin/$i/usr/bin/$i;done
- echo"/usr/local/mysql-5.5.8/lib/">>/etc/ld.so.conf
- ldconfig
复制代码
2.3编译装置PHP相干的LIB
- tarzxvflibiconv-1.13.1.tar.gz
- cdlibiconv-1.13.1
- ./configure--prefix=/usr/local&&make&&makeinstall
复制代码
- tarzxvflibmcrypt-2.5.8.tar.gz
- cdlibmcrypt-2.5.8/
- ./configure--prefix=/usr&&make&&makeinstall
- cdlibltdl/
- ./configure--enable-ltdl-install
- make&&makeinstall
复制代码
- tarzxvfmhash-0.9.9.9.tar.gz
- cdmhash-0.9.9.9
- ./configure--prefix=/usr&&make&&makeinstall
- ldconfig
复制代码
- ln-s/usr/local/lib/libmcrypt.la/usr/lib/libmcrypt.la
- ln-s/usr/local/lib/libmcrypt.so/usr/lib/libmcrypt.so
- ln-s/usr/local/lib/libmcrypt.so.4/usr/lib/libmcrypt.so.4
- ln-s/usr/local/lib/libmcrypt.so.4.4.8/usr/lib/libmcrypt.so.4.4.8
- ln-s/usr/local/lib/libmhash.a/usr/lib/libmhash.a
- ln-s/usr/local/lib/libmhash.la/usr/lib/libmhash.la
- ln-s/usr/local/lib/libmhash.so/usr/lib/libmhash.so
- ln-s/usr/local/lib/libmhash.so.2/usr/lib/libmhash.so.2
- ln-s/usr/local/lib/libmhash.so.2.0.1/usr/lib/libmhash.so.2.0.1
- /sbin/ldconfig
复制代码
- tarzxvfmcrypt-2.6.8.tar.gz
- cdmcrypt-2.6.8
- ./configure--prefix=/usr&&make&&makeinstall
复制代码
- echo"/usr/lib">>/etc/ld.so.conf
- echo"/usr/local/lib">>/etc/ld.so.conf
- ldconfig
复制代码
2.4编译装置PHP-FastCGI
- gzip-dsuhosin-patch-5.3.4-0.9.10.patch.gz
- tarzxvfphp-5.3.4.tar.gz
- cdphp-5.3.4
- patch-p1-i../suhosin-patch-5.3.4-0.9.10.patch
- ./configure--prefix=/usr/local/php-5.3.4--with-config-file-path=/usr/local/php-5.3.4/etc--with-mysql=/usr/local/mysql-5.5.8--with-mysqli=/usr/local/mysql-5.5.8/bin/mysql_config--with-pdo-mysql=/usr/local/mysql-5.5.8/--with-iconv-dir=/usr/local--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-pdo-sqlite--enable-pdo--with-bz2--with-gettext--with-snmp--with-libxml-dir--enable-xml--disable-rpath--disable-safe-mode--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers--enable-mbregex--enable-fpm--enable-mbstring--with-mcrypt--with-gd--enable-gd-native-ttf--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-ldap--with-ldap-sasl--with-xmlrpc--enable-zip--enable-soap--without-pear
- makeZEND_EXTRA_LIBS=-liconv
- makeinstall
- cpphp.ini-production/usr/local/php-5.3.4/etc/php.ini
复制代码
设置装备摆设php-fcgi设置装备摆设文件和启动剧本
- cd/usr/local/php-5.3.4/etc
- wgethttp://bbs.linuxtone.org/forum-attachment-aid-MjM5MXw0MTJhMDZhNHwxMjk5NDExNjU4fDQ2.html
- cd/etc/init.d
- wgethttp://bbs.linuxtone.org/forum-attachment-aid-MjM5MHw4YjMyN2QxOXwxMjk5NDExNjU4fDQ2.html
- chmod+x/etc/init.d/php-fpm
- mkdir-p/usr/local/php-5.3.4/logs
- chownwww:wwwCR/usr/local/php-5.3.4/logs
复制代码
(设置装备摆设文件也能够上传附件中的php-fcgi设置装备摆设文件php-fpm.conf和附件中的php-fpm剧本)
2.5编译装置PHP扩大
- tarzvxflibevent-1.4.13-stable.tar.gz
- cdlibevent-1.4.13-stable
- ./configure&&make&&makeinstall
复制代码
- tarzxvfmemcached-1.4.5.tar.gz
- cdmemcached-1.4.5
- /usr/local/php-5.3.4/bin/phpize
- ./configure--prefix=/usr/local/memcached-1.4.5
- make&&makeinstall
复制代码
- tarzxvfmemcache-2.2.6.tgz
- cdmemcache-2.2.6
- /usr/local/php-5.3.4/bin/phpize
- ./configure--with-php-config=/usr/local/php-5.3.4/bin/php-config
- make&&makeinstall
复制代码
- tarzvxflibmemcached-0.44.tar.gz
- cdlibmemcached-0.44
- ./configure--prefix=/usr/local/libmemcached-0.44--with-memcached=/usr/local/memcached-1.4.5/bin/memcached
- make&&makeinstall
复制代码
- tarzvxftidy-1.2.tgz
- cdtidy-1.2
- /usr/local/php-5.3.4/bin/phpize
- ./configure--with-php-config=/usr/local/php-5.3.4/bin/php-config
- make&&makeinstall
复制代码
<divclass="blockcode"style="word-wrap:break-word;overflow:hidden;margin:10px0px;padding:10px0px5px10px;background-image:url(http://bbs.linuxtone.org/static/image/common/codebg.gif);background-color:#f7f7f7;color:#666666;zoom:1;border:1pxsolid#cccccc;font-family:tahoma,microsoftyahei,simsun;font-size:14px;line-height:21px;background-position:0px0px;background-repeat:no-repeatrepeat;">
- tarzxvfmemcached-1.0.2.tgz
- cdmemcached-1.0.2
- /usr/local/php-5.3.4/bin/phpize
- ./configure--with-php-config=/usr/local/php-5.3.4/bin/php-config--with-libmemcached-dir=/usr/local/libmemcached-0.44/
- make&&makeinstall
|