搜尋
首頁資料庫mysql教程CentOS7 编译安装LNMP

LNMPCentOS

LNMP(Linux-Nginx-Mysql-PHP),本文在 CentOS7.0 上编译LNMP尝尝鲜,全文基本上都是采用手动编译部署...依赖yum帮我安装了GCC和automake..写这个东西耗时有点久了...尼玛 太花时间啦,Linux运维交流群:344177552 

主要软件版本:

nginx-1.6.0<br>php-5.3.5<br>mysql-5.5.6

yum源配置(其实没什么改动)

[root@ipython ~]# cat /etc/yum.repos.d/1.repo <br>[1]<br>name=1<br>baseurl=file:///media<br>enabled=1<br>gpgcheck=0<br><br>[root@ipython ~]# mount /dev/cdrom /media && yum clean all<br>mount: /dev/sr0 is write-protected, mounting read-only<br>Loaded plugins: fastestmirror<br>Cleaning repos: 1<br>Cleaning up everything

编译工具安装

[root@ipython ~]# yum install gcc-c++ automake autoconf bzip2

zlib库(提供数据压缩用的函式库):

[root@ipython lnmp]# tar zxf zlib-1.2.8.tar.gz <br>[root@ipython lnmp]# cd zlib-1.2.8<br>[root@ipython zlib-1.2.8]# ./configure --prefix=/software/sharelib<br>[root@ipython zlib-1.2.8]# make && make install

pcre库(rewrite的支持)

[root@ipython lnmp]# tar zxf pcre-8.35.tar.gz <br>[root@ipython lnmp]# cd pcre-8.35<br>[root@ipython pcre-8.35]# ./configure --prefix=/software/pcre --enable-utf8 --enable-unicode-properties<br>[root@ipython pcre-8.35]# make && make install

OpenSSL库(https的支持)

[root@ipython lnmp]# tar zxf openssl-1.0.1h.tar.gz <br>[root@ipython lnmp]# cd openssl-1.0.1h<br>[root@ipython openssl-1.0.1h]# ./config --prefix=/software/openssl<br>[root@ipython openssl-1.0.1h]# make && make install

TCMalloc工具(google内存管理套件)

[root@ipython lnmp]# tar zxf libunwind-1.1.tar.gz <br>[root@ipython lnmp]# cd libunwind-1.1<br>[root@ipython libunwind-1.1]# CFLAGS=-fPIC ./configure --prefix=/software/google-libunwind<br>[root@ipython libunwind-1.1]# make CFLAGS=-fPIC && make CFLAGS=-fPIC install<br><br>[root@ipython lnmp]# tar zxf gperftools-2.2.tar.gz <br>[root@ipython lnmp]# cd gperftools-2.2<br>[root@ipython gperftools-2.2]# LDFLAGS="-L/software/google-libunwind/lib" CPPFLAGS="-I/software/google-libunwind/include" ./configure --prefix=/software/google-perftools<br>[root@ipython gperftools-2.2]# make && make install<br><br>###路径加到动态链接库###<br>[root@ipython gperftools-2.2]# echo "/software/google-libunwind/lib/" >> /etc/ld.so.conf<br>[root@ipython gperftools-2.2]# echo "/software/google-perftools/lib/" >> /etc/ld.so.conf<br>[root@ipython gperftools-2.2]# echo "/software/sharelib/lib/" >> /etc/ld.so.conf && ldconfig

Nginx(不解释)

[root@ipython lnmp]# groupadd -g 1500 nginx<br>[root@ipython lnmp]# useradd -M -u 1500 -g nginx -s /sbin/nologin nginx<br>[root@ipython lnmp]# mkdir /var/tmp/nginx<br>[root@ipython lnmp]# chown nginx:nginx /var/tmp/nginx/<br>[root@ipython lnmp]# tar zxf nginx-1.6.0.tar.gz <br>[root@ipython lnmp]# cd nginx-1.6.0<br>[root@ipython nginx-1.6.0]# sed -i 's/CFLAGS="$CFLAGS -g"/#CFLAGS="$CFLAGS -g"/' auto/cc/gcc<br>[root@ipython nginx-1.6.0]# sed -i "s#/usr/local#/software/google-perftools#" auto/lib/google-perftools/conf<br>##配置参数有点长##<br>[root@ipython nginx-1.6.0]# ./configure --prefix=/software/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre=/root/lnmp/pcre-8.35 --with-openssl=/root/lnmp/openssl-1.0.1h --with-zlib=/root/lnmp/zlib-1.2.8 --with-google_perftools_module<br>[root@ipython nginx-1.6.0]# make && make install<br><br>[root@ipython nginx-1.6.0]# mkdir /tmp/tcmalloc<br>[root@ipython nginx-1.6.0]# chmod 0777 /tmp/tcmalloc/<br>###这文件在附件里###<br>[root@ipython nginx-1.6.0]# cp ../nginx.conf /software/nginx/conf/<br>[root@ipython nginx-1.6.0]# cp ../fcgi.conf /software/nginx/conf/<br>[root@ipython nginx-1.6.0]# chmod 755 /etc/init.d/nginx<br>[root@ipython nginx-1.6.0]# mkdir /data/{logs,www.ipython.me}<br>[root@ipython nginx-1.6.0]# /software/nginx/sbin/nginx<br>[root@ipython nginx-1.6.0]# iptables -F<br>[root@ipython nginx-1.6.0]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT<br>[root@ipython nginx-1.6.0]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT<br>[root@ipython nginx-1.6.0]# ps aux|grep nginx<br>root 612910.00.031120 896 ?Ss 15:36 0:00 nginx: master process /software/nginx/sbin/nginx -c /software/nginx/conf/nginx.conf<br>nginx612930.00.1315601612 ?S15:36 0:00 nginx: worker process

ncurses库(字符终端处理库)

[root@ipython lnmp]# tar jxf ncurses-5.9.tar.bz2 <br>[root@ipython lnmp]# cd ncurses-5.9<br>[root@ipython ncurses-5.9]# ./configure --prefix=/software/ncurses --with-shared --without-debug<br>[root@ipython ncurses-5.9]# make && make install

Mysql(数据库)

[root@ipython lnmp]# /usr/sbin/groupadd mysql<br>[root@ipython lnmp]# /usr/sbin/useradd -s /sbin/nologin -g mysql mysql<br>[root@ipython lnmp]# tar zxf mysql-5.5.6-rc.tar.gz <br>[root@ipython lnmp]# cd mysql-5.5.6-rc<br>[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<br>[root@ipython mysql-5.5.6-rc]# make && make install<br>[root@ipython mysql-5.5.6-rc]# mkdir /data/mysql/{binlog,relaylog} -p<br>[root@ipython mysql-5.5.6-rc]# chown -R mysql:mysql /data/mysql<br>[root@ipython mysql-5.5.6-rc]# /software/mysql/bin/mysql_install_db --basedir=/software/mysql/ --datadir=/data/mysql/ --user=mysql<br>###这文件在附件里###<br>[root@ipython mysql-5.5.6-rc]# /cp ../my.cnf /etc/my.cnf<br>[root@ipython mysql-5.5.6-rc]# /cp ../mysqld /etc/init.d/mysqld<br>[root@ipython mysql-5.5.6-rc]# chmod 755 /etc/init.d/mysqld <br>[root@ipython mysql-5.5.6-rc]# systemctl enable mysqld<br>[root@ipython mysql-5.5.6-rc]# systemctl start mysqld<br><br>[root@ipython mysql-5.5.6-rc]# ps aux | grep mysqld<br>root 554750.10.1 1153481696 ?S16:07 0:00 /bin/sh /software/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysql.pid<br>mysql563422.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<br>###打补丁吧,避免手动修改隐患逻辑错误###<br>[root@ipython lnmp]# gzip -d libiconv-glibc-2.16.patch.gz<br>[root@ipython lnmp]# cd libiconv-1.14/srclib<br>[root@ipython srclib]# patch -p1 patching file stdio.in.h<br>[root@ipython libiconv-1.14]# cd ..<br>[root@ipython libiconv-1.14]# ./configure --prefix=/software/sharelib/<br>[root@ipython libiconv-1.14]# make && make install

libxml库(XML库)

[root@ipython lnmp]# tar jxf libxml2-2.8.0.tar.bz2 <br>[root@ipython lnmp]# cd libxml2-2.8.0<br>[root@ipython libxml2-2.8.0]# ./configure --prefix=/software/sharelib<br>[root@ipython libxml2-2.8.0]# make && make install

libpng库(图片库)

[root@ipython lnmp]# tar jxf libpng-1.6.8.tar.bz2 <br>[root@ipython lnmp]# cd libpng-1.6.8<br>[root@ipython libpng-1.6.8]# LDFLAGS="-L/software/sharelib/lib/" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib<br>[root@ipython libpng-1.6.8]# make && make install

jpeg库(图片库)

[root@ipython lnmp]# tar jxf jpegsrc.v9a.tar.bz2<br>[root@ipython lnmp]# cd jpeg-9a/ <br>[root@ipython jpeg-9a]# ./configure --prefix=/software/sharelib/<br>[root@ipython jpeg-9a]# make && make install

freetype(字库)

[root@ipython lnmp]# tar jxf freetype-2.5.2.tar.bz2 <br>[root@ipython lnmp]# cd freetype-2.5.2<br>[root@ipython freetype-2.5.2]# LIBPNG_CFLAGS="-I/software/sharelib/include/" LIBPNG_LDFLAGS="-L/software/sharelib/lib/" ./configure --prefix=/software/sharelib<br>[root@ipython freetype-2.5.2]# make && make install<br>[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 <br>[root@ipython lnmp]# cd libmcrypt-2.5.8<br>[root@ipython libmcrypt-2.5.8]# ./configure --prefix=/software/sharelib<br>[root@ipython libmcrypt-2.5.8]# make && make install

mhash库(加密)

[root@ipython lnmp]# tar jxf mhash-0.9.9.9.tar.bz2<br>[root@ipython lnmp]# cd mhash-0.9.9.9<br>[root@ipython mhash-0.9.9.9]# ./configure --prefix=/software/sharelib/<br>[root@ipython mhash-0.9.9.9]# make && make install

curl库(URL传输)

[root@ipython lnmp]# tar jxf curl-7.36.0.tar.bz2<br>[root@ipython lnmp]# cd curl-7.36.0<br>[root@ipython curl-7.36.0]# ./configure --prefix=/software/curl<br>[root@ipython curl-7.36.0]# make && make install

gd库(绘图)

[root@ipython lnmp]# tar zxf gd-2.0.35.tar.gz <br>[root@ipython lnmp]# cd gd-2.0.35<br>[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<br>[root@ipython gd-2.0.35]# make && make install

libtool(库编译支持)

[root@ipython lnmp]# tar zxf libtool-2.4.2.tar.gz <br>[root@ipython lnmp]# cd libtool-2.4.2<br>[root@ipython libtool-2.4.2]# ./configure --prefix=/software/sharelib/ --enable-ltdl-install<br>[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 <br>[root@ipython lnmp]# cd php-5.3.5<br>[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<br>[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<br>[root@ipython php-5.3.5]# sed -i s"#mysql/services.h#/software/mysql/include/mysql/services.h#" /software/mysql/include/mysql/plugin.h<br>[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<br>[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<br>[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<br>[root@ipython php-5.3.5]# make install<br><br>##创建PHP-FPM配置文件,参数什么的自己根据配置调整##<br>[root@ipython php-5.3.5]# cat >> /software/php/etc/php-fpm.conf <p>好了...看图</p><p> <img src="/static/imghwm/default1.png" data-src="http://img.bitscn.com/upimg/allimg/c140719/1405K4515Y060-243438.jpg" class="lazy" title="centos7-lnmp.jpg" alt="wKiom1PCoIPhQ3pXAAKppSWGhd8839.jpg"> </p>
    
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
如何使用Alter Table語句在MySQL中更改表?如何使用Alter Table語句在MySQL中更改表?Mar 19, 2025 pm 03:51 PM

本文討論了使用MySQL的Alter Table語句修改表,包括添加/刪除列,重命名表/列以及更改列數據類型。

如何為MySQL連接配置SSL/TLS加密?如何為MySQL連接配置SSL/TLS加密?Mar 18, 2025 pm 12:01 PM

文章討論了為MySQL配置SSL/TLS加密,包括證書生成和驗證。主要問題是使用自簽名證書的安全含義。[角色計數:159]

您如何處理MySQL中的大型數據集?您如何處理MySQL中的大型數據集?Mar 21, 2025 pm 12:15 PM

文章討論了處理MySQL中大型數據集的策略,包括分區,碎片,索引和查詢優化。

哪些流行的MySQL GUI工具(例如MySQL Workbench,PhpMyAdmin)是什麼?哪些流行的MySQL GUI工具(例如MySQL Workbench,PhpMyAdmin)是什麼?Mar 21, 2025 pm 06:28 PM

文章討論了流行的MySQL GUI工具,例如MySQL Workbench和PhpMyAdmin,比較了它們對初學者和高級用戶的功能和適合性。[159個字符]

如何使用Drop Table語句將表放入MySQL中?如何使用Drop Table語句將表放入MySQL中?Mar 19, 2025 pm 03:52 PM

本文討論了使用Drop Table語句在MySQL中放下表,並強調了預防措施和風險。它強調,沒有備份,該動作是不可逆轉的,詳細介紹了恢復方法和潛在的生產環境危害。

您如何用外國鑰匙代表關係?您如何用外國鑰匙代表關係?Mar 19, 2025 pm 03:48 PM

文章討論了使用外國密鑰來代表數據庫中的關係,重點是最佳實踐,數據完整性和避免的常見陷阱。

如何在JSON列上創建索引?如何在JSON列上創建索引?Mar 21, 2025 pm 12:13 PM

本文討論了在PostgreSQL,MySQL和MongoDB等各個數據庫中的JSON列上創建索引,以增強查詢性能。它解釋了索引特定的JSON路徑的語法和好處,並列出了支持的數據庫系統。

如何保護MySQL免受常見漏洞(SQL注入,蠻力攻擊)?如何保護MySQL免受常見漏洞(SQL注入,蠻力攻擊)?Mar 18, 2025 pm 12:00 PM

文章討論了使用準備好的語句,輸入驗證和強密碼策略確保針對SQL注入和蠻力攻擊的MySQL。(159個字符)

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
2 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
2 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強大的PHP整合開發環境

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。