歡迎來(lái)到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁(yè) 裝配圖網(wǎng) > 資源分類 > DOC文檔下載  

CentOS6.5下搭建LAMP環(huán)境源碼編譯方式

  • 資源ID:45039166       資源大?。?span id="velsre0" class="font-tahoma">278.50KB        全文頁(yè)數(shù):19頁(yè)
  • 資源格式: DOC        下載積分:0積分
快捷下載 游客一鍵下載
會(huì)員登錄下載
微信登錄下載
三方登錄下載: 微信開(kāi)放平臺(tái)登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要0積分
郵箱/手機(jī):
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機(jī)號(hào),方便查詢和重復(fù)下載(系統(tǒng)自動(dòng)生成)
支付說(shuō)明:
本站最低充值0.01積分,下載本資源后余額將會(huì)存入您的賬戶,您可在我的個(gè)人中心查看。
驗(yàn)證碼:   換一換

 
賬號(hào):
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會(huì)被瀏覽器默認(rèn)打開(kāi),此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁(yè)到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請(qǐng)使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無(wú)水印,預(yù)覽文檔經(jīng)過(guò)壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標(biāo)題沒(méi)有明確說(shuō)明有答案則都視為沒(méi)有答案,請(qǐng)知曉。

CentOS6.5下搭建LAMP環(huán)境源碼編譯方式

CentOS 6.4安裝配置LAMP服務(wù)器(Apache+PHP5+MySQL)學(xué)習(xí)PHP腳本編程語(yǔ)言之前,必須先搭建并熟悉開(kāi)發(fā)環(huán)境,開(kāi)發(fā)環(huán)境有很多種,例如LAMP ,WAMP,MAMP等。這里我介紹一下LAMP環(huán)境的搭建,即Linux、 Apache、 MySQL 、PHP環(huán)境。一、首先安裝操作系統(tǒng)操作系統(tǒng):centos6.5操作系統(tǒng)安裝步驟,此處不再詳述。備注:服務(wù)器系統(tǒng)采用最小化安裝,安裝一下GCC編譯工具和一個(gè)桌面即可。如下圖所示:由于安裝系統(tǒng)的時(shí)候我是最小化安裝,只安裝了一個(gè)桌面,GCC編譯工具也是系統(tǒng)裝完之后安裝的,所以沒(méi)有默認(rèn)的LAMP環(huán)境,如下圖示:如果安裝的時(shí)候有選擇默認(rèn)全部安裝,就已經(jīng)安裝了LAMP環(huán)境,但是相對(duì)版本較低,而且安裝的路徑等可能不是我們想要的結(jié)果。所以這里順便介紹一下,如果存在默認(rèn)的LAMP環(huán)境,進(jìn)行卸載的方法,以apache為例:#rpm -qa | grep -i httd/ 查詢系統(tǒng)中已安裝的Apache相關(guān)軟件包#service httpd stop/如果 apache已開(kāi)啟,停止運(yùn)行apache服務(wù)器#rpm -e httpd-xxx -nodeps /卸載 apache服務(wù)器php、 mysql卸載方法同上?!敬罱↙AMP環(huán)境須知】搭建LAMP環(huán)境時(shí),需要安裝的所有軟件都要按照一定的順序安裝,我們按照Apache->MySQL->PHP的順序安裝。但是在安裝PHP之前,應(yīng)先安裝PHP5需要的最新版本庫(kù)文件,例如libxml2、libmcrypt,以及GD2庫(kù)等文件。安裝GD2庫(kù)是為了讓PHP5支持 GIF、PNG和JPEG圖片格式,所以在安裝GD2庫(kù)之前還要先安裝最新的zlib、libpng、freetype和jpegsrc等庫(kù)文件。而且中間還會(huì)穿插安裝一些軟件。二、LAMP安裝前的準(zhǔn)備1、獲取軟件包httpd-2.4.9.tar.gzhttp:/httpd.apache.org/mysql-5.7.4.tar.gzphp-5.5.14.tar.gz phpMyAdmin-4.2.5-all-languages.tar.gzlibxml2-2.9.0.tar.gz ftp:/xmlsoft.org/libxml2/libmcrypt-2.5.8.tar.gzftp:/mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libgd-2.1.0.tar.gzhttps:/bitbucket.org/libgd/gd-libgd/downloadszlib-1.2.8.tar.gzautoconf-2.69.tar.gzhttp:/ftp.gnu.org/gnu/autoconf/freetype-2.5.3.tar.gzhttp:/download.savannah.gnu.org/releases/freetype/libpng-1.6.12.tar.gzftp:/ftp.simplesystems.org/pub/libpng/png/src/jpegsrc.v9a.tar.gzhttp:/www.ijg.org/files/ZendGuard-5_5_0.tar.gzapr-1.5.1.tar.gz http:/apr.apache.org/download.cgiapr-util-1.5.3.tar.gz http:/apr.apache.org/download.cgipcre-8.35.zip 把上面下載的16個(gè)源代碼包放到linux系統(tǒng)下的/usr/local/src/LAMP目錄中2、編譯工具安裝如果安裝系統(tǒng)的時(shí)候已經(jīng)安裝了GCC編譯工具,則顯示上圖中的信息,如果沒(méi)有安裝,可以使用下面的方法進(jìn)行安裝:檢查是否安裝:rootcentos6 # rpm -q make gcc gcc-c+zlib-devellibaio備注:安裝libpng時(shí)候需要zlib-devel安裝mysql時(shí)候需要libaio如果沒(méi)安裝則yum安裝:rootcentos6 # yum -y install make gcc gcc-c+zlib-devel libaio3、配置防火墻,開(kāi)啟80端口、3306端口編輯/etc/sysconfig/iptables文件,配置防火墻rootcentos6 # vi /etc/sysconfig/iptables添加下面兩句,開(kāi)啟相應(yīng)端口:-A INPUT -m state -state NEW -m tcp -p tcp -dport 80 -j ACCEPT #允許80端口通過(guò)防火墻-A INPUT -m state -state NEW -m tcp -p tcp -dport 3306 -j ACCEPT #允許3306端口通過(guò)防火墻備注:很多網(wǎng)友把這兩條規(guī)則添加到防火墻配置的最后一行,導(dǎo)致防火墻啟動(dòng)失敗,正確的應(yīng)該是添加到默認(rèn)的22端口這條規(guī)則的下面如下所示:# 添加好之后防火墻規(guī)則如下所示 # Firewall configuration written by system-config-firewall# Manual customization of this file is not recommended.*filter:INPUT ACCEPT 0:0:FORWARD ACCEPT 0:0:OUTPUT ACCEPT 0:0-A INPUT -m state -state ESTABLISHED,RELATED -j ACCEPT-A INPUT -p icmp -j ACCEPT-A INPUT -i lo -j ACCEPT-A INPUT -m state -state NEW -m tcp -p tcp -dport 22 -j ACCEPT-A INPUT -m state -state NEW -m tcp -p tcp -dport 80 -j ACCEPT-A INPUT -m state -state NEW -m tcp -p tcp -dport 3306 -j ACCEPT-A INPUT -j REJECT -reject-with icmp-host-prohibited-A FORWARD -j REJECT -reject-with icmp-host-prohibitedCOMMIT# 添加好之后防火墻規(guī)則如上所示 #最后重啟防火墻使配置生效rootcentos6 # /etc/init.d/iptables restart 4、關(guān)閉SELINUX編輯/etc/selinux/config文件rootcentos6 # vi /etc/selinux/config詳細(xì)修改如下所示:#SELINUX=enforcing #注釋掉#SELINUXTYPE=targeted #注釋掉SELINUX=disabled #增加:wq #保存,關(guān)閉rootcentos6 #shutdown -r now #重啟系統(tǒng)三、開(kāi)始搭建LAMP環(huán)境安裝時(shí)的主要步驟:(1)解壓tar.gz為后綴的壓縮包軟件LAMP環(huán)境搭建所需要的每個(gè)軟件的源代碼文件,都是以.tar.gz提供給我們的打包壓縮文件,所以我們必須將其解壓再解包。可通過(guò)命令#tar zxvf tarfile.tar.gz達(dá)到目的。(2)在linux系統(tǒng)中源代碼包安裝過(guò)程進(jìn)行解壓后的目錄,LAMP環(huán)境搭建所需要的軟件都使用C語(yǔ)言開(kāi)發(fā)的,所以安裝源代碼文件最少需要配置(configure)、編譯(make)、安裝(make install)三個(gè)步驟。1、確認(rèn)搭建LAMP所需要的環(huán)境是否已經(jīng)安裝此步驟前面已經(jīng)完成。2、編譯安裝libxml2注:libxml2是一個(gè)xml的c語(yǔ)言版的解析器,不僅支持c語(yǔ)言,還支持c+、php、Pascal、Ruby、Tcl等語(yǔ)言的綁定rootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf libxml2-2.7.8.tar.gzrootcentos6 LAMP# cd ./libxml2-2.7.8rootcentos6 libxml2-2.7.8# ./configure -prefix=/usr/local/libxml2/rootcentos6 libxml2-2.7.8# makerootcentos6 libxml2-2.7.8# make install注:選項(xiàng)-prefix=/usr/local/libxml2作用是將軟件安裝到/usr/local/libxml2 目錄下。如果安裝成功以后,在/usr/local/libxml2/目錄下將生成bin,include,lib,share四個(gè)目錄。在后面安裝 PHP5源代碼的配置時(shí),會(huì)通過(guò)在configure命令的選項(xiàng)中加上"-with-libxml-dir=/usr/local/libxml2"選項(xiàng),用于指定安裝libxml2庫(kù)文件的位置。3、編譯安裝libmcrypt注:libmcrypt是加密算法擴(kuò)展庫(kù)。支持DES, 3DES, RIJNDAEL, Twofish, IDEA, GOST, CAST-256, ARCFOUR, SERPENT, SAFER+等算法。rootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf libmcrypt-2.5.8.tar.gzrootcentos6 LAMP# cd ./libmcrypt-2.5.8rootcentos6 libmcrypt-2.5.8# ./configure -prefix=/usr/local/libmcrypt/rootcentos6 libmcrypt-2.5.8# make;make install如果安裝成功就會(huì)在/usr/local/libmcrypt/目錄下生成bin,include,lib,man,share五個(gè)目錄。然后在安 裝PHP5源代碼包的配置時(shí),就可以通過(guò)configure命令加上“-with-mcrypt-dir=/usr/local/libmcrypt” 選項(xiàng),指定這個(gè)libmcrypt庫(kù)文件的位置。如./configure時(shí)報(bào)錯(cuò):configure: error: C+ compiler cannot create executables 。解決方案:運(yùn)行下面命令,然后重新configure(配置)yum install gcc gcc-c+ gcc-g77安裝完成libmcrypt庫(kù)以后,不同的linux系統(tǒng)版本有可能還要安裝一下libltdl庫(kù)。安裝方法和前面的步驟相同,可以進(jìn)入到解壓縮的 目錄/usr/local/src/libmcrypt-2.5.8下,找到libltdl庫(kù)源代碼所在的目錄libltdl,進(jìn)入這個(gè)目錄按照下面幾個(gè) 命令配置、編譯、安裝就可以了。rootlocalhost libltdl# pwd/usr/local/src/libmcrypt-2.5.8/libltdl/進(jìn)入軟件源代碼目錄rootlocalhost libltdl# ./configure enable-ltdl-install/配置ltdl庫(kù)的安裝rootlocalhost libltdl# make/編譯rootlocalhost libltdl# make install/安裝4、編譯安裝zlib注:zlib是提供數(shù)據(jù)壓縮用的函式庫(kù)rootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf zlib-1.2.5.tar.gzrootcentos6 LAMP# cd ./zlib-1.2.5rootcentos6 zlib-1.2.5# ./configure -prefix=/usr/local/zlib/rootcentos6 zlib-1.2.5# make ; make install如果安裝成功將會(huì)在/usr/local /zlib目錄下生成include,lib,share三個(gè)目錄。在安裝PHP5配置時(shí),在configure命令的選項(xiàng)中加上“-with- zlib-dir=/usr/local/libmcrypt”選項(xiàng),用于指定zlib庫(kù)文件位置。5、編譯安裝libpngrootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf libpng-1.5.4.tar.gzrootcentos6 LAMP# cd ./libpng-1.5.4rootcentos6 libpng-1.5.4#./configure -prefix=/usr/local/libpng/ -enable-sharedrootcentos6 libpng-1.5.4# make ; make install在./configure -prefix=/usr/local/libpng這步最后會(huì)提示:configure: error: ZLib not installed解決方法如下:1)進(jìn)入zlib的源文件目錄,執(zhí)行命令 make clean,清除zlib;2)重新配置 ./configure,后面不要接-prefix參數(shù);3)make && make install;4)進(jìn)入libpng目錄,執(zhí)行命令 ./configure -prefix=/usr/local/libpng;5)make && make install;6)安裝成功.如果安裝成功將會(huì)在/usr/local/libpng目錄下生成bin,include,lib和share四個(gè)目錄。在安裝GD2庫(kù)配置時(shí),通 過(guò)在configure命令選項(xiàng)中加上“-with-png=/usr/local/libpng”選項(xiàng),指定libpng庫(kù)文件的位置。6、編譯安裝jpeg注:安裝GD2庫(kù)前所需的jpeg8庫(kù)文件,需要自己手動(dòng)創(chuàng)建安裝需要的目錄,它們?cè)诎惭b時(shí)不能自動(dòng)創(chuàng)建。rootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf jpegsrc.v8c.tar.gzrootcentos6 LAMP# cd ./jpeg-8c/rootcentos6 jpeg-8c# mkdir /usr/local/jpeg/(創(chuàng)建jpeg軟件的安裝目錄)rootcentos6 jpeg-8c# mkdir /usr/local/jpeg/bin/(創(chuàng)建存放命令的目錄)rootcentos6 jpeg-8c# mkdir /usr/local/jpeg/lib/(創(chuàng)建jpeg庫(kù)文件所在目錄)rootcentos6 jpeg-8c# mkdir /usr/local/jpeg/include/(創(chuàng)建存放頭文件目錄)rootcentos6 jpeg-8c# mkdir -p /usr/local/jpeg/man/man1(建立存放手冊(cè)的目錄)rootcentos6 jpeg-8c# ./configure -prefix=/usr/local/jpeg/ > -enable-shared > -enable-static(建立共享庫(kù)使用的GNU的libtool和靜態(tài)庫(kù)使用的GNU的libtool)rootcentos6 jpeg-8c# make ; make install在安裝GD2庫(kù)配置時(shí),可以在configure命令的選項(xiàng)中加上“-with-jpeg=/usr/local/jpeg8”選項(xiàng),指定jpeg8庫(kù)文件的位置。安裝PHP時(shí)也要指定該庫(kù)文件的位置。7、編譯安裝freetyperootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf freetype-2.4.6.tar.gzrootcentos6 LAMP# cd ./freetype-2.4.6rootcentos6 freetype-2.4.6#./configure -prefix=/usr/local/freetype/ -enable-sharedrootcentos6 freetype-2.4.6# make ;make install如果安裝成功將會(huì)在/usr/local/freetype目錄下存在bin,include,lib和share四個(gè)目錄。并在安裝GD2庫(kù)時(shí),通過(guò)configure命令選項(xiàng)中加上“-with-freetype=/usr/local/freetype/”選項(xiàng),指定freetype庫(kù)文件位置。8、編譯安裝autoconf唯一注意的地方是configure時(shí),不用指定路徑。rootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf autoconf-2.68.tar.gzrootcentos6 LAMP# cd ./autoconf-2.68rootcentos6 autoconf-2.68# ./configurerootcentos6 autoconf-2.68# make ; make install9、編譯安裝GDrootcentos6 LAMP# pwd/usr/local/src/LAMProotcentos6 LAMP# tar -zxvf gd-2.0.35.tar.gzrootcentos6 LAMP# cd ./gd-2.0.35rootcentos6 gd-2.0.35# ./configure /配置命令> -prefix=/usr/local/gd /指定安裝軟件的位置> -with-jpeg=/usr/local/jpeg/ /指定去哪找jpeg庫(kù)文件> -with-png=/usr/local/libpng/ /指定去哪找png庫(kù)文件> -with-zlib=/usr/local/zlib/指定去哪找zlib庫(kù)文件> -with-freetype=/usr/local/freetype/指定去哪找freetype 2.x字體庫(kù)的位置rootcentos6 gd-2.0.35# make ; make install如果安裝成功會(huì)在/usr/local/gd/目錄下存在bin、include和lib這三個(gè)目錄。在安裝PHP5時(shí),通過(guò)在configure命令選項(xiàng)中加上“-with-gd=/usr/local/gd”選項(xiàng),指定GD庫(kù)文件的位置。如果報(bào)錯(cuò):gd_png.c 中 gdMalloc函數(shù)的問(wèn)題make2: * gd_png.lo Error 1make2: Leaving directory /tmp/gd-2.0.35make1: * all-recursive Error 1make1: Leaving directory /tmp/gd-2.0.35make: * all Error 2解決方案:vi gd_png.c找到#include "png.h"改成#include "/usr/local/libpng/include/png.h"如果報(bào)錯(cuò):unrecognized option with-zlib那就重新安裝一次zlib,注意,需要把原先解壓出來(lái)的源碼刪掉,重新解壓進(jìn)行安裝。10、安裝apache卸載apr、apr-utilrootcentos6 LAMP# yum remove apr apr-util編譯安裝apr-1.5.1.tar.gzrootcentos6 LAMP# tar zxvf apr-1.5.1.tar.gzrootcentos6 LAMP# cd apr-1.5.1rootcentos6 apr-1.5.1# ./configure -prefix=/usr/local/apr-httpd/ && make && make install編譯安裝apr-util-1.5.3.tar.gzrootcentos6 LAMP# tar zxvf apr-util-1.5.3.tar.gzrootcentos6 LAMP# cd apr-util-1.5.1rootcentos6 apr-util-1.5.3# ./configure -prefix=/usr/local/apr-util-httpd/ -with-apr=/usr/local/apr-httpd/ && make && make install編譯安裝pcre-8.35.ziprootcentos6 LAMP# unzip -o pcre-8.35.ziprootcentos6 LAMP# cd pcre-8.35rootcentos6 pcre-8.35# ./configure -prefix=/usr/local/pcrerootcentos6 pcre-8.35# makerootcentos6 pcre-8.35# make install編譯安裝apacherootcentos6 LAMP# tar zxvf httpd-2.4.9.tar.gzrootcentos6 LAMP# cd httpd-2.4.9rootcentos6 httpd-2.4.9# ./configure > -prefix=/usr/local/apache249 > -enable-mods-shared=all > -enable-deflate > -enable-speling > -enable-cache > -enable-file-cache > -enable-disk-cache > -enable-mem-cache > -enable-so > -enable-expires=shared > -enable-rewrite=shared > -enable-static-support > -sysconfdir=/etc/httpd > -with-z=/usr/local/zlib/ > -with-apr=/usr/local/apr-httpd/ > -with-apr-util=/usr/local/apr-util-httpd/ > -with-pcre=/usr/local/pcre/ > -disable-userdirrootcentos6 httpd-2.4.9# make && make install安裝完成后,進(jìn)入/usr/local/apache243/目錄下,檢查是否有以下文件:bin build cgi-bin error htdocs icons include logs man manual modules啟動(dòng)Apache服務(wù)器,并查端口是否開(kāi)啟,啟動(dòng)Apache服務(wù)器的命令行如下:rootcentos6 httpd-2.4.9# /usr/local/apache249/bin/apachectl start提示信息:AH00558: httpd: Could not reliably determine the servers fully qualified domain name, using :1. Set the ServerName directive globally to suppress this message解決方案:rootcentos6 httpd-2.4.9# vi /etc/httpd/httpd.conf加上下面一行,重啟apacheServerName localhost:80查看端口命令行如下:#netstat -tnl|grep 80tcp 0 0 0.0.0.0:80 0.0.0.0:* LIST測(cè)試安裝結(jié)果,打開(kāi)瀏覽器,在地址欄中輸入U(xiǎn)RL為:http:/192.168.146.129/如果瀏覽器中出現(xiàn)It works!則表明Apache服務(wù)器可以使用。每種服務(wù)器軟件都有必要制成開(kāi)機(jī)時(shí)自動(dòng)啟動(dòng),Apache服務(wù)器開(kāi)機(jī)自動(dòng)啟動(dòng),只要在“/etc/rc.d/rc.local”文件,加上 Apache服務(wù)器的啟動(dòng)命令即可??梢灾苯哟蜷_(kāi)“/etc/rc.d/rc.local”文件,在最后一行寫入Apache啟動(dòng)命令,也可以用echo 命令追加進(jìn)去,如下命令行示:rootlocalhost apache243# echo "/usr/local/apache243/bin/apachectl start" >> /etc/rc.d/rc.localrootcentos6 LAMP# /usr/local/apache/bin/apachectl startrootcentos6 LAMP# cp /usr/local/apache/bin/apachectl /etc/init.d/httpdrootcentos6 LAMP# chmod +x /etc/init.d/httpdrootcentos6 # chkconfig -add httpd注意:如果提示servicehttpddoes not support chkconfig錯(cuò)誤解決辦法:編輯/etc/rc.d/init.d/httpd在文件第二行加入 #chkconfig:234510 90 #description:Activates/Deactivates Apache Web Serverrootcentos6 # chkconfig -level 2345 httpd onrootcentos6 LAMP# service httpd restart開(kāi)機(jī)自動(dòng)啟動(dòng)apache的另一種方法:修改/etc/rc.local文件# vim /etc/rc.local在文件中添加/usr/local/apache/bin/apachectl start11、編譯安裝mysql(新版本的mysql編譯)mysql版本5.5以上編譯安裝時(shí)需要用到軟件cmake,cmake特性是獨(dú)立于源碼編譯,編譯工作可以在另外一個(gè)目錄中而非源碼目錄中進(jìn)行,好處是可以保證源碼目錄不受任何一次編譯的影響。估計(jì)以后的版本也會(huì)采用這種方式,所以特地記錄一下安裝步驟及過(guò)程,以供參考。注意:此安裝是默認(rèn)centos下已經(jīng)安裝了最新工具包,比如GNUmake,GCC,Perl,libncurses5-dev,如果在編譯安裝過(guò)程中發(fā)現(xiàn)有缺失的工具包,先yuminstall單獨(dú)下載安裝再繼續(xù)即可。以下安裝中涉及的幾點(diǎn)需要提前說(shuō)明的問(wèn)題:l 所有下載的文件將保存在/usr/local/src/目錄下l mysql將以mysql用戶運(yùn)行,而且將加入service開(kāi)機(jī)自動(dòng)運(yùn)行l(wèi) mysql將被安裝在/usr/local/mysql/目錄下l mysql默認(rèn)安裝使用utf8字符集l mysql的數(shù)據(jù)和日志文件保存在/usr/local/mysql/data/對(duì)應(yīng)目錄下l mysql的配置文件保存于/etc/f1.下載安裝cmake下載軟件cmake-3.0.0.tar.gzhttp:/www.cmake.org/rootcentos6 # tar zxvf cmake-3.0.0.tar.gz rootcentos6 # cd cmake-3.0.0 rootcentos6 # ./bootstrap rootcentos6 # gmakerootcentos6 # make && make install在使用時(shí)可能會(huì)出現(xiàn)error,若提示是/usr/bin/cmake文件不存在。解決辦法:rootcentos6 #whereis cmake得到cmke的可執(zhí)行文件的路徑,如在:/usr/local/bin/cmakerootcentos6 # ln -s /usr/local/bin/cmake /usr/bin/cmake創(chuàng)建一個(gè)鏈接文件即可解決。2.安裝ncurses-devel首先需要使用yum安裝了下ncurses-develrootcentos6 # yum y install ncurses-devel否則在下面安裝過(guò)程中會(huì)出現(xiàn)缺少如下的ERROR:Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake:83 (MESSAGE): Curses library not found. Please install appropriate package, 3.安裝mysql(1)創(chuàng)建用戶、組和目錄rootcentos6 # groupadd mysqlrootcentos6 # useradd mysql -g mysqlrootcentos6 # passwd mysql/設(shè)置密碼為:123rootcentos6 # mkdir /usr/local/mysql /創(chuàng)建安裝目錄rootcentos6 # mkdir /usr/local/mysql/data/創(chuàng)建數(shù)據(jù)倉(cāng)庫(kù)目錄(不創(chuàng)建的話默認(rèn)就/是這個(gè)目錄即$PREFIX_DIR/data)rootcentos6 # chown -R mysql.mysql /usr/local/mysql/(2)編譯安裝mysql-5.7.4rootcentos6 # tar zxvf mysql-5.7.4.tar.gz rootcentos6 # cd mysql-5.7.4 rootcentos6 # cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql > -DMYSQL_UNIX_ADDR=/usr/local/mysql.sock /最好不要指定> -DMYSQL_DATADIR=/usr/local/mysql/data > -DDEFAULT_CHARSET=utf8 > -DDEFAULT_COLLATION=utf8_general_ci > -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk > -DWITH_MYISAM_STORAGE_ENGINE=1 > -DWITH_INNOBASE_STORAGE_ENGINE=1 > -DWITH_MEMORY_STORAGE_ENGINE=1 > -DWITH_READLINE=1 > -DENABLED_LOCAL_INFILE=1 > -DMYSQL_USER=mysql > -DMYSQL_TCP_PORT=3306rootcentos6 # make && make install注意:若第一次的配置錯(cuò)誤,需要先刪除當(dāng)前mysql源碼目錄中的CMakeCache.txt (不是cmake源碼目錄中的),然后再重新進(jìn)行cmake配置。cmake參數(shù)說(shuō)明:-DCMAKE_INSTALL_PREFIX= 數(shù)據(jù)庫(kù)程序安裝路徑;-DMYSQL_DATADIR= 數(shù)據(jù)庫(kù)文件存放路徑(不配置的話會(huì)默認(rèn)創(chuàng)建$PREFIX_DIR/data)-DMYSQL_UNIX_ADDR= 默認(rèn)位置是/var/lib/mysql/mysql.sock,如果指定其他路徑,需要做一個(gè)軟鏈接,或者在配置文件f中進(jìn)行設(shè)置。-DDEFAULT_CHARSET= 默認(rèn)數(shù)據(jù)庫(kù)編碼-DDEFAULT_COLLATION= 默認(rèn)數(shù)據(jù)庫(kù)整理編碼-DWITH_EXTRA_CHARSETS= 擴(kuò)展支持編碼(all | utf8,gbk,gb2312 | none)-DWITH_MYISAM_STORAGE_ENGINE= MYISAM引擎支持(1|0)-DWITH_INNOBASE_STORAGE_ENGINE= innoDB引擎支持(1|0)-DWITH_MEMORY_STORAGE_ENGINE= MEMORY引擎支持(1|0)(3)配置mysql權(quán)限設(shè)置:rootresource mysql# pwd/usr/local/mysql/mysql安裝目錄rootlocalhost mysql# chown -R root.mysql . /設(shè)置安裝目錄下所有文件的權(quán)限r(nóng)ootresource mysql# chown -R mysql.mysql ./data/data的權(quán)限r(nóng)ootresource mysql# chown -R mysql.mysql /var/lib/mysql/mysql.sock的權(quán)限修改配置文件f首先查看是否存在/etc/f文件,有則直接打開(kāi)編輯,否則請(qǐng)復(fù)制配置文件,目標(biāo)路徑自己設(shè)定:rootcentos6 # cp support-files/my-f /usr/local/mysql/f修改f參數(shù),沒(méi)有則加入如下:basedir = /usr/local/mysql(不配置的話默認(rèn)為$PREFIX_DIR)datadir = /usr/local/mysql/data(不配置的話默認(rèn)為$PREFIX_DIR/data)log-error = /usr/local/mysql/mysql_error.log(不配置的話默認(rèn)為$PREFIX_DIR/data/$hostname.err)pid-file = /usr/local/mysql/mysql.pid(不配置的話默認(rèn)為$PREFIX_DIR/data/$hostname.pid)user = mysqltmpdir = /tmp(不配置的話默認(rèn)為/tmp)/etc/f的配置請(qǐng)參考下面的例子進(jìn)行配置:* /etc/f配置示例 *mysqldbasedir=/usr/local/mysqldatadir=/usr/local/mysql/datasocket=/var/lib/mysql/mysql.sock/要正確配置user=mysqlport=3306# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0mysqld_safelog-error=/var/log/mysqld.logpid-file=/usr/local/mysql/data/CentOS6.5.pid/這個(gè)要配置正確* /etc/f配置示例 *注意:在/etc/f文件中的pid-file一定要設(shè)定正確,否則后面會(huì)出現(xiàn)無(wú)法登錄的情況,我在這里被耽誤來(lái)好久好久。該pid-file的路徑名在哪里,可使用下面的命令:rootcentos6 # ps aux | grep mysql會(huì)出現(xiàn)類似下面的情況,如果沒(méi)有則重新啟動(dòng)mysql就有了,在下面的輸出信息中找到pid-file的路徑名。root 3534 0.0 0.0 106232 1408 pts/0 S 23:40 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe -datadir=/usr/local/mysql/data -pid-file=/usr/local/mysql/data/CentOS6.5.pidmysql 3741 2.0 26.8 1248408 550728 pts/0 Sl 23:40 0:00 /usr/local/mysql/bin/mysqld -basedir=/usr/local/mysql -datadir=/usr/local/mysql/data -plugin-dir=/usr/local/mysql/lib/plugin -user=mysql -log-error=/var/log/mysqld.log -pid-file=/usr/local/mysql/data/CentOS6.5.pid -socket=/var/lib/mysql/mysql.sock -port=3306root 3952 0.0 0.0 103252 824 pts/3 S+ 23:41 0:00 grep mysql初始化數(shù)據(jù)庫(kù)執(zhí)行前需賦給scripts/mysql_install_db文件執(zhí)行權(quán)限:rootcentos6 # pwd/usr/local/mysql/mysql安裝目錄rootcentos6 # chmod 755 scripts/mysql_install_dbrootcentos6 # scripts/mysql_install_db -user=mysql > -basedir=/usr/local/mysql > -datadir=/usr/local/mysql/data注:basedir:mysql安裝路徑 datadir:數(shù)據(jù)庫(kù)文件儲(chǔ)存路徑,(-user一定要加,其他可不加,默認(rèn)會(huì)是$PREFIX_DIR和$PREFIX_DIR/data,因?yàn)?help看到說(shuō)不加-user會(huì)以當(dāng)前系統(tǒng)登錄用戶啟動(dòng)mysql)在數(shù)據(jù)庫(kù)成功初始化之后,可以根據(jù)現(xiàn)在屏幕上的提示信息來(lái)做,先啟動(dòng)mysql:/usr/local/mysql574/bin/mysqld_safe -user=mysql & /啟動(dòng)mysql/usr/local/mysql574/bin/mysqladmin -version /測(cè)試下再修改root密碼:/usr/local/mysql574/bin/mysqladmin -u root password 123456設(shè)置mysqld的開(kāi)機(jī)啟動(dòng)rootcentos6 # cp support-files/mysql.server /etc/init.d/mysqlrootcentos6 # chmod 755 /etc/init.d/mysqlrootcentos6 # chkconfig mysql on可使用chkconfig list | grep mysql 命令查詢剛才的設(shè)置情況。為MySQL配置環(huán)境變量將mysql的bin目錄加到PATH中,有利于以后管理和維護(hù),在/etc/profile中加入myslq/bin,同時(shí)增加兩個(gè)別名方便操作。注:后面兩個(gè)別名不加也可以,加上以后的操作更方便。rootcentos6 # export PATH=/usr/local/mysql/bin:$PATHrootcentos6 # alias mysql_start="mysqld_safe &"rootcentos6 # alias mysql_stop="mysqladmin -u root -p shutdown"啟動(dòng)mysql服務(wù):rootcentos6 # /etc/init.d/mysql start啟動(dòng)完成之后用ps -ef |grep mysql 命令查看是否啟動(dòng)登陸mysql:rootcentos6 # mysql -u root -p問(wèn)題 如果出現(xiàn)錯(cuò)誤:MYSQL:The server quit without updating PID file。一種可能是selinux惹的禍,如果是centos系統(tǒng),默認(rèn)會(huì)開(kāi)啟selinux。解決方法就是關(guān)閉它。rootcentos6 # vi /etc/selinux/config詳細(xì)修改如下所示:#SELINUX=enforcing #注釋掉#SELINUXTYPE=targeted #注釋掉SELINUX=disabled #增加:wq #保存,關(guān)閉rootcentos6 #shutdown -r now #重啟系統(tǒng)另外一種可能就是pid文件的路徑設(shè)置不正確,可參考上文中對(duì)pid文件的設(shè)置方法。問(wèn)題 Cant connect to local Mysql server through socket /tmp/mysql.sock (2)問(wèn)題分析:mysql安裝之后,需要使用mysql.sock的socket文件鏈接mysql數(shù)據(jù)庫(kù),默認(rèn)的引用位置為/tmp/mysql.sock,而mysql.sock文件一般在/var/lib/mysql/路徑下,因此需要做一個(gè)軟鏈接。另外注意mysql.sock的權(quán)限屬性。解決方法:rootcentos6 # ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sockrootCentOS6 hcyj# ll /tmp/mysql.sock lrwxrwxrwx 1 mysql mysql 25 Jul 17 23:21 /tmp/mysql.sock -> /var/lib/mysql/mysql.sockrootCentOS6 hcyj# ll /var/lib/mysql/mysql.sock srwxrwxrwx 1 mysql mysql 0 Jul 18 10:05 /var/lib/mysql/mysql.sock再次連接:rootcentos6 # /usr/local/mysql/bin/mysql -u root -p連接上了,問(wèn)題解決。問(wèn)題 若出現(xiàn)ERROR 1045 (28000): Access denied for user rootlocalhost (using password: YES(NO)) 這種情況。解決方法,如下:rootcentos6 # /etc/init.d/mysql stoprootcentos6 # /usr/local/mysql/bin/mysqld_safe -user=mysql -skip-grant-tables -skip-networking &rootcentos6 # /usr/local/mysql/bin/mysql -u root mysqlmysql> UPDATE user SET Password=PASSWORD(newpassword) where USER=root;/請(qǐng)將newpassword更換為自己設(shè)定的密碼即可,其他不變mysql> FLUSH PRIVILEG

注意事項(xiàng)

本文(CentOS6.5下搭建LAMP環(huán)境源碼編譯方式)為本站會(huì)員(痛***)主動(dòng)上傳,裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請(qǐng)重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!