一、build-essential的安裝 # bulid-essential是編譯源碼包(C/C++程序)所需的編譯工具 # ubuntu 下默認沒有安裝,ubuntu下可以執行sudo apt-get install build-essential 安裝包 build-essential_11.4.tar.gz # 安裝命令 tar -zxvf build-essential_11.4.tar.gz cd build-essential-11.4 ./configure make sudo make install make clean
二、MySql的安裝
step.1 ncurses的安裝 # 如果缺少ncurses包mysql編譯會報No curses/termcap library found的錯誤 安裝包 ncurses-5.6.tar.gz tar -zxvf ncurses-5.6.tar.gz cd ncurses-5.6 ./configure --prefix=/usr/local/ncurses --with-shared --without-debug --enable-widec make sudo make install
make clean
step.2 mysql的安裝 安裝包 mysql-5.1.42.tar.gz
step.a # 安裝命令 tar -zxvf mysql-5.1.42.tar.gz cd mysql-5.1.42 ./configure --prefix=/usr/local/mysql--with-named-curses-libs=/usr/local/ncurses/lib/libncursesw.so.5.6--with-charset=gbk # --prefix=/usr/local/mysql mysql的安裝路徑 # 關于mysql配置文件路徑的說明:mysql按照下列順序搜索my.cnf # /etc,mysql安裝目錄如 /usr/local/mysql/etc,安裝目錄下的data目錄如 /usr/local/mysql/data,以最先找到的為準。/etc下my.cnf的配置是全局設置 # --with-named-curses-libs=/usr/local/ncurses/lib/libncursesw.so.5.6 ncurses庫文件安裝路徑 # --localstatedir=/usr/local/mysql/var 數據庫默認存放路徑(可以設置其它路徑如,/var/lib/mysql) # --with-charset=gbk 設置數據庫支持中文字符集 make sudo make install
四、PHP的安裝 step.1 freetype的安裝 安裝包 freetype-2.3.11.tar.gz # 安裝命令 tar -zxvf freetype-2.3.11.tar.gz cd freetype-2.3.11 ./configure --prefix=/usr/local/freetype make sudo make install make clean
step.2 zlib的安裝 安裝包 zlib-1.2.3.tar.gz # 安裝命令 tar -zxvf zlib-1.2.3.tar.gz cd zlib-1.2.3 ./configure make sudo make install make clean # 安裝時更改過zlib的安裝目錄如/usr/local/zlib,改后libpng的安裝也成功了,當是到安裝gd庫時一直失敗,不得已又把zlib安裝到默認路徑,后邊才順利通過 step.3 libpng的安裝 安裝包 libpng-1.4.0.tar.gz # 安裝命令 tar -zxvf libpng-1.4.0.tar.gz cd libpng-1.4.0 ./configure --prefix=/usr/local/libpng make sudo make install make clean # 很多人這樣操作 cp scripts/makefile.std makefile 代替了./configure (兩者區別有待查證) step.4 jpeg的安裝 安裝包 jpegsrc.v7.tar.gz # 安裝命令 tar -zxvf jpegsrc.v7.tar.gz cd jpeg-7 ./configure --prefix=/usr/local/jpeg7 make sudo make install make clean # 很多人手動建立 jpeg的目錄結構不知道是因為不同還是有其它原因(有待查證) # 以上包都是gd庫所需要的組成庫,下面安裝gd庫 step.5 gd庫的安裝 安裝包 gd-2.0.35.tar.gz # 安裝命令 step.a tar -zxvf gd-2.0.35.tar.gz cd gd-2.0.35 ./configure --prefix=/usr/local/gd2 --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg7
step.b # 編輯 Makefile 文件, 找到 232 行左右 # 看到類似內容 CPPFLAGS = -I/usr/local/freetype/include/freetype2 -I/usr/local/freetype/include -I/usr/local/freetype/include -I/usr/local/jpeg7/include # 修改為 CPPFLAGS = -I/usr/local/freetype/include/freetype2 -I/usr/local/freetype/include -I/usr/local/freetype/include -I/usr/local/libpng/include -I/usr/local/jpeg7/include step.c # 編輯 gd_png.c 文件 找到 if (!png_check_sig (sig, 8)) { /* bad signature */ # 修改為 if (png_sig_cmp (sig, 0, 8)) { step.d # 執行命令 make sudo make install make clean # gd庫安裝完成 step.6 libxml2的安裝 # libxml2用來解析xml # 安裝命令 tar -zxvf libxml2-2.6.26.tar.gz cd libxml2-2.6.26 ./configure --prefix=/usr/local/libxml make make install make clean
step.7 php的安裝 安裝包 php-5.3.1.tar.gz # 安裝命令 step.a tar -zxvf php-5.3.1.tar.gz cd php-5.3.1.tar ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql--with-libxml-dir=/usr/local/libxml2 --with-zlib --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg7 --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd2 make sudo make install make clean