编译安装LNMP(在centos6.4系统下)
所需资源 http://pan.baidu.com/s/1sjwXut3 mjxs编译环境安装
yum install gcc gcc-c++ cmake ncurses-devel bison
安装TCMalloc(libunwind库 和 )google-perftools
安装libunwind库
tar xf libunwind-0.99.tar.gz
cd libunwind-0.99
CFLAGS=-fpic ./configure
make CFLAGS=-fpic
make CFLAGS=-fPIC install
安装google-perftools
tar xf gperftools-2.1.tar.gz
cd gperftools-2.1
./configure
make
make install
echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr_local_lib.conf
ldconfig
安装cmake(如果yum装了cmake,以下编译安装可不执行 yum install cmake)
tar xvf cmake-2.8.12.tar.gz
cd cmake-2.8.12/
./bootstrap
make &&make install
安装NGINX
1、必要软件准备
yum install pcre* //为了支持rewrite功能
yum install openssl* //需要ssl的支持
2、安装nginx
解压
tar xzvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
安装
./configure --prefix=/usr/local/nginx \ //安装路径
--with-http_ssl_module \ //支持nginx状态查询
--with-http_spdy_module \ //支持https
--with-http_stub_status_module \ //支持google的 spdy
--with-pcre //支持rewrite重写
make & make install
3、启动、停止、重启
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -s reload
安装mysql
shell> groupadd mysql && useradd -g mysql mysql -s /sbin/nologin
shell> mkdir -p /data/mysql
shell> cd /home/softs/mysql-5.5.30
shell> cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/dbdata -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1-DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_SSL=yes
shell> make && make install
#配置
shell> cp -f /home/softs/mysql-5.5.30/support-files/my-large.cnf /etc/my.cnf
shell> cp -f /home/softs/mysql-5.5.30/support-files/mysql.server /etc/init.d/mysqld
shell> chmod 755 /etc/init.d/mysqld
shell> vim /etc/my.cnf
---------------------------
datadir=/data/mysql
socket=/usr/local/mysql/tmp/mysql.sock
---------------------------
shell> chown mysql.mysql /usr/local/mysql -R
#初始化数据库
shell> /usr/local/mysql/scripts/mysql_install_db --user=root --datadir=/data/mysql --basedir=/usr/local/mysql
shell> chown mysql.mysql /data/mysql -R
shell> /etc/init.d/mysqld restart
#添加环境变量
shell> echo "export PATH=${PATH}:/usr/local/mysql/bin" >> /etc/profile
1.编译前说明
#yum安装运行环境
shell> yum –y install libxml2-devel curl-devel libpng-devel openldap-devel
#安装PHP前需要编译安装这两个源码包:libmcrypt mhash
#nginx使用fpm的方式条用php,php5.4以后版本中已经支持php-fpm,所以只需要在php编译参数里指定--enable-fpm即可
2.首先安装libmcrypt-2.5.8
tar xvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make && make install
3.安装mhash-0.9.9.9
tar -jxvf mhash-0.9.9.9.tar.bz2
cd mhash-0.9.9.9
./configure
make && make install
4.建立软连接到/usr/lib
ln -s /usr/local/lib/libmcrypt* /usr/lib
ln -s /usr/local/lib/libmhash.* /usr/lib
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
5.安装php5.4
tar xvf php-5.4.25.tar.gz
cd php-5.4.25
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/usr/local/mysql/tmp/mysql.sock --with-zlib --enable-xml --disable-rpath --enable-bcmath--enable-shmop --enable-sysvsem --with-curl --with-curlwrappers --enable-fpm --with-mcrypt --with-gd --with-openssl --with-mhash --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc -enable-zip --enable-soap
【error1】
configure: error: Cannot find ldap libraries in /usr/lib.
【solution1】
shell> ln -s /usr/lib64/libldap* /usr/lib/
shell> ldconfig
【error2】
Generating phar.php
/home/softs/php-5.4.25/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
make: *** Error 127
【solution2】
shell> ln -s /usr/local/mysql/lib/libmysqlclient* /usr/lib/
shell> ldconfig
shell> make && make install
1.首先为php创建配置文件:
cp php.ini-production /usr/local/php/php.ini
mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
ln -s /usr/local/php/bin/php /usr/bin/
2.配置php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
--------------------------------
listen = /var/run/php-fpm.sock # 使用unix socket
--------------------------------
#启动php-fpm
/usr/local/php/sbin/php-fpm
shell> ps aux | grep php-fpm #查看php-fpm是否成功
版权声明:本文为博主原创文章,未经博主允许不得转载。
页:
[1]