cd /1.将准备功夫都先做好,把lnmp各个安装包放到/usr/local/src 下面
1.1:nginx: http://nginx.org/download/nginx-1.4.4.tar.gz
1.2:pcre (支持nginx伪静态): http://ncu.dl.sourceforge.net/project/pcre/pcre/7.8/pcre-7.8.tar.gz
1.4:mysql: http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
1.5:cmake(MySQL编译工具): http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
1.6:libmcrypt(PHPlibmcrypt模块): http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
1.7:GD库安装包(php页面图片验证码支持): https://phpsqq.googlecode.com/files/gd-2.0.36RC1.tar.gz
1.10:gzip压缩库(zlib)(nginx):http://zlib.net/zlib-1.2.8.tar.gz
1.11:ssl -openssl(nginx):http://www.openssl.org/source/openssl-1.0.1g.tar.gz
2.安装编译工具以及库文件
yum install make apr* autoconf automake curl curl-devel gcc gcc-c++ gtk+-devel zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* cpp glibc libgomp libstdc++-devel keyutils-libs-devel libsepol-devel libselinux-devel krb5-devel libXpm* freetype freetype-devel freetype* fontconfig fontconfig-devel libjpeg* libpng* php-common php-gd gettext gettext-devel ncurses* libtool* libxml2 libxml2-devel patch policycoreutils bison 和
yum -y install make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap lsof
和
yum install -y gcc libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel libXpm libXpm-devel freetype freetype-devel t1lib t1lib-devel gmp gmp-devel libc-client-devel openldap openldap-devel gcc-c++ unixODBC unixODBC-devel libtidy libtidy-devel libxslt libxslt-devel pcre-devel
安装mssql支持 freetds ./configure –with-tdsver=8.0 –prefix=/usr/local/freetds –enable-msdblib -> make && make install
libmcrypt手动编译
3.开始安装
3.1:安装cmake
3.1.1 cd /usr/local/src
tar zxvf cmake-2.8.12.1.tar.gz
cd cmake-2.8.8
./configure –prefix=/usr/local/cmake
make && make install
3.2:安装mysql
3.2.1:rpm -qa|grep mysql #检查安装与否
3.2.2:rpm -e mysql-libs-5.1.73-3.el6_5.x86_64 –nodeps #检查安装与否
3.2.3: groupadd mysql #添加mysql组
3.2.4:useradd -s /sbin/nologin -g mysql -M mysql #创建一个用户,不允许登陆和不创主目录 /etc/passwd检查用户是否创建成功
3.2.5: cd /usr/local/src -> tar zxvf mysql-5.6.17.tar.gz -> cd mysql-5.6.17 #切换目录并解压mysql
3.2.6:/usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql -DWITH_DEBUG=0 -DWITH_SSL=system #使用cmake配置mysql
3.2.6.1:export PATH=$PATH:/usr/local/cmake/bin/cmake #加入临时命令,可以直接使用cmake source /etc/profile使配置立即生效(没实际作用,可不加入)
3.2.7:make && make install #编译并安装mysql
3.2.8:chmod +w /usr/local/mysql -> chown -R mysql:mysql /usr/local/mysql -> cd /usr/local/mysql #修改mysql目录权限
3.2.9:cp support-files/my-default.cnf /etc/my.cnf #拷贝配置文件到etc目录下
3.2.10:/usr/local/mysql/scripts/mysql_install_db –defaults-file=/etc/my.cnf –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –user=mysql #执行初始化配置脚本,创建系统自带的数据库和表,注意配置文件的路径
3.2.11:cp support-files/mysql.server /etc/init.d/mysqld #拷贝脚本
3.2.12:chmod +x /etc/init.d/mysqld #赋予权限
3.2.13:chkconfig mysqld on #设置开机启动
3.2.14:service mysqld start #启动mysql
3.2.15:vim /etc/profile #设置PATH,要不,不能直接调用mysql,再最下面加入下面两句,并 source /etc/profile 让配置立即生效
PATH=/usr/local/mysql/bin:$PATH
export PATH
3.2.16:设置mysql登陆密码,初始密码为空 mysqladmin -uroot -p password ‘你的密码’
3.2.17:远程登陆 1.只需要在想要远程登录的帐号里复制一个出来.将host改为%就可以..2.FLUSH PRIVILEGES; 刷新权限
3.3:安装php(尝试放弃编译安装某些东西,尝试yum)
3.3.1: cd /usr/local/src -> tar zxvf tar zxvf libmcrypt-2.5.8.tar.gz -> cd libmcrypt-2.5.8 ->./configure -> make && make install #libmcrypt扩展
3.3.4: cd /usr/local/src -> tar zxvf php-5.5.7.tar.gz -> cd php-5.5.7
3.3.5: ./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –enable-fpm –with-fpm-user=www –with-fpm-group=www –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-iconv-dir –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –with-curl –enable-mbregex –enable-mbstring –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –enable-fileinfo –enable-opcache –with-mssql=/usr/local/freetds/ –enable-json –enable-phar –without-readline –with-tidy –with-unixODBC –enable-pdo –enable-xmlwriter –enable-xmlreader –enable-dom –enable-wddx –with-bz2 –with-xpm-dir –enable-calendar –disable-debug –enable-exif –with-ldap –with-ldap-sasl –with-t1lib –without-gdbm –with-iconv –with-gmp –with-libxml-dir –with-xsl –with-kerberos –with-pcre-regex –with-imap-ssl –with-imap –with-sqlite3 –with-pdo-dblib=/usr/local/freetds –with-pdo-sqlite –with-pdo-odbc=unixODBC -> make && make install #编译安装php
3.3.6: cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #复制默认文件成为新的php-fpm配置文件
3.3.7: cp php.ini-production /usr/local/php/etc/php.ini #复制安装包里的ini文件到php配置目录下
3.3.7.1: rm -rf /etc/php.ini -> ln -s /usr/local/php/etc/php.ini /etc/php.ini #添加软链接
3.3.8: cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm #复制php安装包里的php-fpm启动脚本到init.d
3.3.8.1: chmod +x /etc/init.d/php-fpm(赋予执行权限) -> chkconfig –add php-fpm(添加为启动项) -> chkconfig php-fpm on(设置开机启动)
3.3.9: groupadd www(创建群组) -> useradd -s /sbin/nologin -g www -M www (创建一个用户,不允许登陆和不创主目录)
3.3.10: service php-fpm start #启动php-fpm
3.4:安装nginx
3.4.1:安装PCRE库 ./configure && make && make install
3.4.2:安装zlib库 ./configure && make && make install
3.4.3:解压ssl库 不用编译安装
3.4.4:./configure –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_gzip_static_module –with-pcre=/usr/local/src/pcre-7.8 –with-zlib=/usr/local/src/zlib-1.2.8 –with-openssl=/usr/local/src/openssl-1.0.1g
3.4.5:启动脚本vim /etc/init.d/nginx -> 内容文件在文章最下面
3.4.6:chmod +x /etc/init.d/nginx(赋予执行权限) -> chkconfig –add nginx(添加为启动项) -> chkconfig nginx on(设置开机启动)
3.4.7:配置nginx配置文件,开启php-fpm
3.4.8:service nginx start #启动nginx,测试
3.5:安装coreseek
3.6:安装php_redis 扩展
一般,添加扩展后reload就可以了
Q:Cannot find imap library (libc-client.a)
A:ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
Q:configure: error: Cannot find ldap libraries in /usr/lib
A:ln -s /usr/lib64/libldap* /usr/lib
Q:configure: error: ODBC header file ‘/usr/local/include/sqlext.h’ not found!
A:ln -s /usr/include/sqlext.h /usr/local/include/sqlext.h
Q:Don’t know how to define struct flock on this system, set –enable-opcache=no
A:vim /etc/ld.so.conf 加入右边两个 /usr/local/lib /usr/local/freetds/lib保存 ldconfig