Linux下Nginx+Mysql+PHP的編譯安裝過程

來源:互聯網
上載者:User

Linux軟體安裝方式有很多,為了保證伺服器啟動並執行穩定性,很多人會採用編譯軟體安裝原始碼的方式來安裝軟體;下面我來把Godaddy VPS上的編譯過程貼一下,包括安裝過過程和遇到的一些問題,以及解決的辦法等。需要說明的是,mysql的進階版本需要用cmake來編譯

yum install gcc gcc-c++ make
wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.32.tar.gz
wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz
wget http://nginx.org/download/nginx-1.4.1.tar.gz
wget http://us1.php.net/distributions/php-5.5.0.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz -4
wget http://zlib.net/zlib-1.2.8.tar.gz -4
wget http://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz -4
wget http://jaist.dl.sourceforge.net/project/libpng/libpng16/1.6.2/libpng-1.6.2.tar.gz -4
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.0.tar.gz -4
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz -4
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz -4


全部解壓
yum install ncurses-devel
編譯cmake
configure make make install
編譯mysql:
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make make install
cp ./support-files/my-huge.cnf /etc/my.cnf
./scripts/mysql_install_db –user=mysql
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
配置遠端管理,設定密碼等

編譯nginx
1.編譯pcre庫
2,編譯zlib庫
3,編譯nginx
./configure –prefix=/usr/local/nginx –user=nginx –group=nginx –with-pcre=/usr/local/src/pcre-8.33

編譯php
1,編譯 libmcrypt
2,編譯freetype (第一次編譯失敗,需要libpng)
3,編譯libpng
4,再次編譯freetype
還是找不到libpng 用命令export PATH=$PATH:/usr/local/libpng/bin
5,編譯libjpeg
./configure –prefix=/usr/local/jpeg –enable-shared
6,libxml2已經安裝,curl已經安裝
7,編譯安裝libmcrypt
8,編譯安裝libiconv
9,編譯php,錯誤,顯示沒有安裝libxml2
./configure –prefix=/usr/local/php –enable-fpm –enable-mbstring=all –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –enable-ftp –enable-gd-native-ttf –enable-session –with-gd –with-iconv –with-zlib –enable-xml –with-freetype-dir=/usr/local/freetype –with-jpeg-dir=/usr/local/jpeg –with-png-dir=/usr/local/libpng –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-sockets
10,編譯安裝libxml2
wget http://xmlsoft.org/sources/libxml2-2.8.0.tar.gz -4
編譯chenggong
11,重新編譯php
./configure –prefix=/usr/local/php –enable-fpm –enable-mbstring=all –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –enable-ftp –enable-gd-native-ttf –enable-session –with-gd –with-iconv –with-zlib –enable-xml –with-freetype-dir=/usr/local/freetype –with-jpeg-dir=/usr/local/jpeg –with-png-dir=/usr/local/libpng –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-sockets –with-libxml-dir=/usr/local/libxml –without-pear
make && make install
cp php.ini-production /usr/local/php/lib/php.ini
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
12,需要安裝apc加速器,編譯提示沒有安裝autoconf
13,下載編譯安裝autoconf
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz -4
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.
出現這個錯誤,需要編譯安裝 m4: wget http://ftp.gnu.org/gnu/m4/m4-1.4.tar.gz -4
14,繼續編譯APC
安裝編譯後還是提示這個錯誤export PHP_AUTOCONF=/usr/local/autoconf/bin/autoconf export PHP_AUTOHEADER=/usr/local/autoconf/bin/autoheader 成功
make出現錯誤 /usr/local/src/APC-3.1.9/apc_zend.c:62: error: ‘zend_execute_data’ has no member named ‘Ts’
換低版本APC安裝 同樣錯誤
yum install pcre-devel 沒用
15,安裝低版本php看看能不能解決 php5.4 完美解決

16,nginx服務的安裝
17,安裝memcached
18,必須先安裝libevent
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz -4
./configure –prefix=/usr/local/libevent make && make install
19,下載安裝memcached
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz -4
./configure –prefix=/usr/local/memcached –with-libevent=/usr/local/libevent make && make install
20,下載安裝php擴充 memcache
./configure –with-php-config=/usr/local/php/bin/php-config

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.