码迷,mamicode.com
首页 > 其他好文 > 详细

手工编译lnmp环境

时间:2014-05-09 14:27:28      阅读:399      评论:0      收藏:0      [点我收藏+]

标签:lnmp

同步时间:ntpdate 202.120.2.101(上海交大ntp服务器)

使用ntsysv --level 2345,关闭非必要程序自动运行。

修改/etc/sysconfig/i18n文件内容为:LANG="zh_CN:gb2312"

源码放在/usr/local



//创建用户及站点目录并更改权限

groupadd www

useradd -r -g www -s /sbin/nologin www

groupadd mysql

useradd -r -g  mysql mysql

mkdir /app/website

chmod 755 /app/website

chown -R www /app/website

chgrp -R www /app/website

mkdir /app/local



//程序安装

cd /usr/local/src

tar zxvf zlib-1.2.3.tar.gz

cd zlib-1.2.3

./configure --prefix=/app/local/zlib

make && make install



tar zxvf mysql-5.1.49.tar.gz

cd mysql-5.1.49

./configure --prefix=/app/mysql --with-charset=gb2312 --with-extra-charsets=all

make && make install

./mysql_install_db --user=mysql

cp support-files/my-medium.cnf /etc/my.cnf

cd /app/mysql/

//组设为mysql,var(数据目录)设为mysql,其他user设为root

chown -R root .

chown -R mysql var

chgrp -R mysql .

./bin/mysqld_safe --user=mysql &

//将mysql,nginx,Php添加到环境变量

echo "export PATH=$PATH:/app/mysql/bin/" >>/etc/profile

source /etc/profile



tar zxvf pcre-7.9.tar.gz

tar zxvf nginx-0.8.49.tar.gz

./configure --prefix=/app/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-7.9 --with-http_gzip_static_module --user=www --group=www

make && make install

vi /app/nginx/conf/nginx.conf (此处为修改nginx配置文件)

//启动nginx

/app/nginx/sbin/nginx



//安装php插件

//安装图形支持插件

//字体插件

tar zxvf freetype-2.2.1.tar.gz

cd freetype-2.2.1

./configure --prefix=/app/local/freetype

make && make install

cd ..


//png格式支持

tar zxvf libpng-1.2.12.tar.gz (png图片支持)

cd libpng-1.2.12

./configure --prefix=/app/local/libpng

make && make install

cd ..


//jpeg格式支持

mkdir -p /app/local/jpeg6/bin

mkdir -p /app/local/jpeg6/lib

mkdir -p /app/local/jpeg6/include

mkdir -p /app/local/jpeg6/man/man1

tar zxvf jpegsrc.v6b.tar.gz

cd jpeg-6b/

./configure --prefix=/app/local/jpeg6/ --enable-shared --enable-static

make && make install

cd ..


//gd库

tar zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

./configure --prefix=/app/local/gd2 --with-png=/app/local/libpng/lib/ --with-freetype=/app/local/freetype/ --with-jpeg=/app/local/jpeg6/ --enable-m4_pattern_allow

make (第一次可能会报错,请再次执行make)

make install

cd ..


//文件传输工具

tar zxvf  curl-7.15.5.tar.gz

cd curl-7.15.5

./configure --prefix=/app/local/curl

make && make install

cd ..


tar zxvf libxml2-sources-2.7.3.tar.gz

cd libxml2-2.7.3/

./configure --prefix=/app/local/libxml2

make && make install

cd ..


tar zxvf libxslt-1.1.24.tar.gz

cd libxslt-1.1.24

./configure --prefix=/app/local/libxslt --with-libxml-prefix=/app/local/libxml2/

make && make install

ldconfig

cd ..


//字符集转换插件(转码)

tar zxvf libiconv-1.13.1.tar.gz

cd libiconv-1.13.1

./configure --prefix=/app/local/libiconv

make && make install

cd ..


//加解密

tar zxvf mhash-0.9.9.9.tar.gz

cd mhash-0.9.9.9

./configure

make && make install

cd ..


tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure

make && make install

/sbin/ldconfig

cd libltdl/

./configure  --enable-ltdl-install

make && make install


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

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

cd /usr/local/src

tar zxvf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8

./configure

make && make install

cd ..


tar zxvf php-5.2.10.tar.gz

gzip -cd php-5.2.10-fpm-0.5.13.diff.gz |patch -d php-5.2.10 -p1

./configure --prefix=/app/php5 --with-mysql=/app/local/mysql/ --with-mysqli=/app/local/mysql/bin/mysql_config --with-curl --with-curlwrappers --with-zlib --with-zlib-dir=/app/local/zlib/ --with-libxml-dir=/app/local/libxml2/ --with-xsl=/app/local/libxslt/ --with-gd=/app/local/gd2/ --with-png-dir=/app/local/libpng/ --with-jpeg-dir=/app/local/jpeg6/ --with-freetype-dir=/app/local/freetype/ --with-iconv-dir=/app/local/libiconv/ --with-mcrypt=/app/local/lib --with-mhash=/app/local/lib --enable-fastcgi --disable-cli --enable-soap --enable-sockets --enable-mbstring=cn --enable-fpm --enable-bcmath --enable-shmop --enable-inline-optimization --enable-force-cgi-redirect  --disable-debug

make && make install

cp php.ini-dist /app/php5/lib/php.ini

vi /app/php5/etc/php-fpm.conf (修改配置文件,将启动用户及组改为www)

/app/php5/sbin/php-fpm start


//添加php,nginx,mysql开机自启动

echo "/usr/local/php/sbin/php-fpm start" >>/etc/rc.local

echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local

echo "/usr/local/mysql/bin/mysqld_safe --user=mysql &" >>/etc/rc.local


//动态编译php id3模块:(支持mp3文件)

tar zxvf id3-0.2.tgz

cd id3-0.2

/app/php5/bin/phpize

./configure --with-php-config=/app/php5/bin/php-config

make

make install

//为了能动态加载id3模块,修改php.ini文件

在约491行位置,修改extension_dir = "/app/php/lib/php/extensions/no-debug-non-zts-20060613/"

下一行再加入:extension = id3.so

重启nginx和php即可。



本文出自 “杨尼玛” 博客,谢绝转载!

手工编译lnmp环境,布布扣,bubuko.com

手工编译lnmp环境

标签:lnmp

原文地址:http://sunrain891213.blog.51cto.com/4609720/1408754

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!