CentOS 7.0下编译安装LNMP(2)

[root@ipython nginx-1.6.0]# mkdir /tmp/tcmalloc
[root@ipython nginx-1.6.0]# chmod 0777 /tmp/tcmalloc/
###这文件在附件里###
[root@ipython nginx-1.6.0]# cp ../nginx.conf /software/nginx/conf/
[root@ipython nginx-1.6.0]# cp ../fcgi.conf /software/nginx/conf/
[root@ipython nginx-1.6.0]# chmod 755 /etc/init.d/nginx
[root@ipython nginx-1.6.0]# mkdir /data/{logs,}
[root@ipython nginx-1.6.0]# /software/nginx/sbin/nginx
[root@ipython nginx-1.6.0]# iptables -F
[root@ipython nginx-1.6.0]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT
[root@ipython nginx-1.6.0]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
[root@ipython nginx-1.6.0]# ps aux|grep nginx
root    61291  0.0  0.0  31120  896 ?        Ss  15:36  0:00 nginx: master process /software/nginx/sbin/nginx -c /software/nginx/conf/nginx.conf
nginx    61293  0.0  0.1  31560  1612 ?        S    15:36  0:00 nginx: worker process
  ncurses库(字符终端处理库)
[root@ipython lnmp]# tar jxf ncurses-5.9.tar.bz2
[root@ipython lnmp]# cd ncurses-5.9
[root@ipython ncurses-5.9]# ./configure --prefix=/software/ncurses --with-shared --without-debug
[root@ipython ncurses-5.9]# make && make install
  Mysql(数据库)
[root@ipython lnmp]# /usr/sbin/groupadd mysql
[root@ipython lnmp]# /usr/sbin/useradd -s /sbin/nologin -g mysql mysql
[root@ipython lnmp]# tar zxf mysql-5.5.6-rc.tar.gz
[root@ipython lnmp]# cd mysql-5.5.6-rc
[root@ipython mysql-5.5.6-rc]# ./configure --prefix=/software/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg --with-named-curses-libs=/software/ncurses/lib/libncurses.so.5
[root@ipython mysql-5.5.6-rc]# make && make install
[root@ipython mysql-5.5.6-rc]# mkdir /data/mysql/{binlog,relaylog} -p
[root@ipython mysql-5.5.6-rc]# chown -R mysql:mysql /data/mysql
[root@ipython mysql-5.5.6-rc]# /software/mysql/bin/mysql_install_db --basedir=/software/mysql/ --datadir=/data/mysql/ --user=mysql
###这文件在附件里###
[root@ipython mysql-5.5.6-rc]# \cp ../my.cnf /etc/my.cnf
[root@ipython mysql-5.5.6-rc]# \cp ../mysqld /etc/init.d/mysqld
[root@ipython mysql-5.5.6-rc]# chmod 755 /etc/init.d/mysqld
[root@ipython mysql-5.5.6-rc]# systemctl enable mysqld
[root@ipython mysql-5.5.6-rc]# systemctl start mysqld

[root@ipython mysql-5.5.6-rc]# ps aux | grep mysqld
root    55475  0.1  0.1 115348  1696 ?        S    16:07  0:00 /bin/sh /software/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysql.pid
mysql    56342  2.7 11.9 1918248 120680 ?      Sl  16:07  0:01 /software/mysql/libexec/mysqld --basedir=/software/mysql --datadir=/data/mysql --plugin-dir=/software/mysql/lib/mysql/plugin --user=mysql --log-error=/data/mysql/mysql_error.log --open-files-limit=10240 --pid-file=/data/mysql/mysql.pid --socket=/tmp/mysql.sock --port=3306
  libiconv库(字符编码转换)
[root@ipython lnmp]# tar zxf libiconv-1.14.tar.gz
###打补丁吧,避免手动修改隐患逻辑错误###
[root@ipython lnmp]# gzip -d libiconv-glibc-2.16.patch.gz 
[root@ipython lnmp]# cd libiconv-1.14/srclib
[root@ipython srclib]# patch -p1 < ../../libiconv-glibc-2.16.patch
patching file stdio.in.h
[root@ipython libiconv-1.14]# cd ..
[root@ipython libiconv-1.14]# ./configure --prefix=/software/sharelib/
[root@ipython libiconv-1.14]# make && make install
  libxml库(XML库)
[root@ipython lnmp]# tar jxf libxml2-2.8.0.tar.bz2
[root@ipython lnmp]# cd libxml2-2.8.0
[root@ipython libxml2-2.8.0]# ./configure --prefix=/software/sharelib
[root@ipython libxml2-2.8.0]# make && make install
  libpng库(图片库)
[root@ipython lnmp]# tar jxf libpng-1.6.8.tar.bz2
[root@ipython lnmp]# cd libpng-1.6.8
[root@ipython libpng-1.6.8]# LDFLAGS="-L/software/sharelib/lib/" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib
[root@ipython libpng-1.6.8]# make && make install
  jpeg库(图片库)
[root@ipython lnmp]# tar jxf jpegsrc.v9a.tar.bz2
[root@ipython lnmp]# cd jpeg-9a/
[root@ipython jpeg-9a]# ./configure --prefix=/software/sharelib/
[root@ipython jpeg-9a]# make && make install
  freetype(字库)
[root@ipython lnmp]# tar jxf freetype-2.5.2.tar.bz2
[root@ipython lnmp]# cd freetype-2.5.2
[root@ipython freetype-2.5.2]# LIBPNG_CFLAGS="-I/software/sharelib/include/" LIBPNG_LDFLAGS="-L/software/sharelib/lib/" ./configure --prefix=/software/sharelib
[root@ipython freetype-2.5.2]# make && make install
[root@ipython freetype-2.5.2]# ln -s /software/sharelib/include/freetype2 /software/sharelib/include/freetype2/freetype
  libmcrypt库(加密算法)
[root@ipython lnmp]# tar jxf libmcrypt-2.5.8.tar.bz2
[root@ipython lnmp]# cd libmcrypt-2.5.8
[root@ipython libmcrypt-2.5.8]# ./configure --prefix=/software/sharelib
[root@ipython libmcrypt-2.5.8]# make && make install
  mhash库(加密)
[root@ipython lnmp]# tar jxf mhash-0.9.9.9.tar.bz2
[root@ipython lnmp]# cd mhash-0.9.9.9
[root@ipython mhash-0.9.9.9]# ./configure --prefix=/software/sharelib/
[root@ipython mhash-0.9.9.9]# make && make install
  curl库(URL传��)
[root@ipython lnmp]# tar jxf curl-7.36.0.tar.bz2
[root@ipython lnmp]# cd curl-7.36.0
[root@ipython curl-7.36.0]# ./configure --prefix=/software/curl
[root@ipython curl-7.36.0]# make && make install
  gd库(绘图)
[root@ipython lnmp]# tar zxf gd-2.0.35.tar.gz
[root@ipython lnmp]# cd gd-2.0.35
[root@ipython gd-2.0.35]# LDFLAGS="-L/software/sharelib/lib" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib --enable-shared --with-png=/software/sharelib --with-freetype=/software/sharelib --with-libiconv-prefix=/software/sharelib --with-jpeg=/software/sharelib
[root@ipython gd-2.0.35]# make && make install
  libtool(库编译支持)
[root@ipython lnmp]# tar zxf libtool-2.4.2.tar.gz
[root@ipython lnmp]# cd libtool-2.4.2
[root@ipython libtool-2.4.2]# ./configure --prefix=/software/sharelib/ --enable-ltdl-install
[root@ipython libtool-2.4.2]# make && make install
  将mysql的库文件加入动态共享
[root@ipython lnmp]# echo "/software/mysql/lib/mysql/" >> /etc/ld.so.conf && ldconfig
  PHP(一种语言吧)
[root@ipython lnmp]# tar zxf php-5.3.5.tar.gz
[root@ipython lnmp]# cd php-5.3.5
[root@ipython php-5.3.5]# sed -i s"#mysql/psi/psi.h#/software/mysql/include/mysql/psi/psi.h#" /software/mysql/include/mysql/my_sys.h
[root@ipython php-5.3.5]# sed -i s"#mysql/plugin.h#/software/mysql/include/mysql/plugin.h#" /software/mysql/include/mysql/m_string.h
[root@ipython php-5.3.5]# sed -i s"#mysql/services.h#/software/mysql/include/mysql/services.h#" /software/mysql/include/mysql/plugin.h
[root@ipython php-5.3.5]# sed -i s"#mysql/service_my_snprintf.h#/software/mysql/include/mysql/service_my_snprintf.h#" /software/mysql/include/mysql/services.h
[root@ipython php-5.3.5]# sed -i s"#mysql/service_thd_alloc.h#/software/mysql/include/mysql/service_thd_alloc.h#" /software/mysql/include/mysql/services.h
[root@ipython php-5.3.5]# ./configure --prefix=/software/php --with-config-file-path=/software/php/etc --with-mysql=/software/mysql --with-mysqli=/software/mysql/bin/mysql_config --with-iconv-dir=/software/sharelib --disable-ipv6 --with-freetype-dir=/software/sharelib/ --with-jpeg-dir=/software/sharelib/ --with-png-dir=/software/sharelib/ --with-zlib=/software/sharelib/ --with-libxml-dir=/software/sharelib/ --disable-rpath --enable-bcmath --enable-safe-mode --enable-shmop --enable-sysvsem --with-curl=/software/curl/ --enable-fpm --enable-mbstring  --with-mcrypt=/software/sharelib/ --with-gd=/software/sharelib/ --enable-gd-native-ttf --with-openssl=/software/openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-inline-optimization --with-curlwrappers --enable-mbregex --with-gettext
[root@ipython php-5.3.5]# make install

##创建PHP-FPM配置文件,参数什么的自己根据配置调整##
[root@ipython php-5.3.5]# cat >> /software/php/etc/php-fpm.conf <
好了...看图

CentOS 7.0下编译安装LNMP

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/2a35fb8a6d5b771cb4a4d534b3bdafc6.html