一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導航

Linux|Centos|Ubuntu|系統(tǒng)進程|Fedora|注冊表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服務(wù)器之家 - 服務(wù)器系統(tǒng) - Centos - centos5 源碼安裝Nginx + mysql + apache + php的方法

centos5 源碼安裝Nginx + mysql + apache + php的方法

2019-10-09 17:55centos教程網(wǎng) Centos

安裝教程網(wǎng)上有很多,放在google或是baidu一搜就有很多了,我也是新手,安裝的時候也是從網(wǎng)上查找資料然后安裝

主要依照的是張宴的一篇博文《http://blog.s135.com/post/366/》,安裝的軟件是也是從他提供的列表中下載,這里都是tar.gz格式,如果更希望是rpm格式的話,提供一個網(wǎng)址《http://rpmfind.net/linux/rpm2html/search.php》這里列出了比較完全的下載包。 

我安裝的系統(tǒng):Centos5 

1、下載; 

我安裝的下載來自張宴博文下的地址,下載保存的是home下自己目錄的一個文件夾下: 

復(fù)制代碼

代碼如下:


cd /home/xuxx/software 
wget http://blog.s135.com/soft/linux/nginx_php/nginx/nginx-0.7.51.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.8.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.8-fpm-0.5.10.diff.gz 
wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.1.33.zip 
wget http://blog.s135.com/soft/linux/nginx_php/libiconv/libiconv-1.13.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/memcache/memcache-2.2.5.tgz 
wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-7.8.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.5.3.tar.bz2 
wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz 
wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz 
wget http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.2.2.tgz 


2、準備編譯安裝環(huán)境,需要編譯源碼用到gc++ 
建議如果是新安裝的系統(tǒng),使用yum upgrade更新下系統(tǒng)。 

復(fù)制代碼

代碼如下:


sudo -s 
LANG=C 
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel 
glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel 
openldap openldap-devel nss_ldap openldap-clients openldap-servers 


注意:這里所有的命令是一行的而不能有換行符,如果是copy的時候,注意要去處該換行符 

確保安裝成功!才能正確使用編譯。 

3、安裝: 

一、安裝PHP 5.2.8(FastCGI模式) 
1、編譯安裝PHP 5.2.8所需的支持庫: 

1] libiconv庫 

復(fù)制代碼

代碼如下:


tar zxvf libiconv-1.13.tar.gz 
cd libiconv-1.13/ 
./configure --prefix=/usr/local 
make 
make install 
make clean 
>make distclean 
cd ../ 


make clean 和make distclean都是刪除安裝過程中生成的緩存文件。當然如果你不介意放著也可以跳過這兩步清理操作。 

2]libmcrypt庫 

復(fù)制代碼

代碼如下:


tar zxvf libmcrypt-2.5.8.tar.gz 
cd libmcrypt-2.5.8/ 
./configure 
make 
make install 
make clean 
make distclean 
/sbin/ldconfig 
cd libltdl/ 
./configure --enable-ltdl-install 
make 
make install 
make clean 
make distclean 
cd http://www.cnblogs.com/ 


3] mhash庫 

復(fù)制代碼

代碼如下:


tar zxvf mhash-0.9.9.9.tar.gz 
cd mhash-0.9.9.9/ 
./configure 
make 
make install 
cd ../ 


4]mcrypt庫 

注意:因為該庫和libmcrypt有依賴性,所以在安裝前必須知道libmcrypt,否則的話會出現(xiàn): 
錯誤 

復(fù)制代碼

代碼如下:


checking for libmcrypt – version >= 2.5.0… 
*** ‘libmcrypt-config –version’ returned 2.4.0, but LIBMCRYPT (2.5.8) 
*** was found! If libmcrypt-config was correct, then it is best 
*** to remove the old version of LIBMCRYPT. You may also be able to fix the error 
*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing 
*** /etc/ld.so.conf. Make sure you have run ldconfig if that is 
*** required on your system. 
*** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG 
*** to point to the correct copy of libmcrypt-config, and remove the file config.cache 
*** before re-running configure 
configure: error: *** libmcrypt was not found 


是因為path的問題,所以執(zhí)行: 

復(fù)制代碼

代碼如下:


ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la 
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so 
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a 
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la 
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so 
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config 


然后再安裝: 

復(fù)制代碼

代碼如下:


tar zxvf mcrypt-2.6.8.tar.gz 
cd mcrypt-2.6.8/ 
/sbin/ldconfig 
./configure 
make 
make install 
cd ../ 


二、安裝mysql 

復(fù)制代碼

代碼如下:


/usr/sbin/groupadd mysql 
/usr/sbin/useradd -g mysql xxx 
unzip mysql-5.1.33.zip 
cd mysql-5.1.33/ 
./configure --prefix=/usr/local/webserver/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=innobase 
make 
make install 
make clean 
make distclean 
chmod +w /usr/local/webserver/mysql 
chown -R xxx:mysql /usr/local/webserver/mysql 
cp support-files/my-medium.cnf.sh /usr/local/webserver/mysql/my.cnf 
cd ../ 


注意:這里編譯./configure命令是一行的而不能有換行符,如果是copy的時候,注意要去處該換行符 

在最后一步拷貝的時候,我安裝完在support-files下沒有my-medium.cnf而只有my-medium.cnf.sh所以將這個文件拷貝過去。 

@張宴原文: 

附:以下為附加步驟,如果你想在這臺服務(wù)器上運行MySQL數(shù)據(jù)庫,則執(zhí)行以下兩步。如果你只是希望讓PHP支持MySQL擴展庫,能夠連接其他服務(wù)器上的MySQL數(shù)據(jù)庫,那么,以下兩步無需執(zhí)行。 
 ?、?、以xxx用戶帳號的身份建立數(shù)據(jù)表: 

復(fù)制代碼

代碼如下:


/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data --user=xxx 


②、啟動MySQL(最后的&表示在后臺運行) 

復(fù)制代碼

代碼如下:


/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/usr/local/webserver/mysql/my.cnf & 


3、編譯安裝PHP(FastCGI模式) 

復(fù)制代碼

代碼如下:


tar zxvf php-5.2.8.tar.gz 
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1 
cd php-5.2.8/ 
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql 
--with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib 
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem 
--enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect 
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap 
--with-ldap-sasl 
make ZEND_EXTRA_LIBS='-liconv' 
make install 
cp php.ini-dist /usr/local/webserver/php/etc/php.ini 
cd ../ 


注意:這里./configure命令是一行的而不能有換行符,如果是copy的時候,注意要去處該換行符 

4、編譯安裝PHP5擴展模塊--可選安裝 

復(fù)制代碼

代碼如下:


tar zxvf memcache-2.2.5.tgz 
cd memcache-2.2.5/ 
/usr/local/webserver/php/bin/phpize 
./configure --with-php-config=/usr/local/webserver/php/bin/php-config 
make 
make install 
make clean 
make distclean 
cd ../ 
tar jxvf eaccelerator-0.9.5.3.tar.bz2 
cd eaccelerator-0.9.5.3/ 
/usr/local/webserver/php/bin/phpize 
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config 
make 
make install 
make clean 
make distclean 
cd ../ 
tar zxvf PDO_MYSQL-1.0.2.tgz 
cd PDO_MYSQL-1.0.2/ 
/usr/local/webserver/php/bin/phpize 
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql 
make 
make install 
make clean 
make distclean 
cd ../ 
tar zxvf ImageMagick.tar.gz 
cd ImageMagick-6.5.1-2/ 
./configure 
make 
make install 
make clean 
make distclean 
cd ../ 
tar zxvf imagick-2.2.2.tgz 
cd imagick-2.2.2/ 
/usr/local/webserver/php/bin/phpize 
./configure --with-php-config=/usr/local/webserver/php/bin/php-config 
make 
make install 
make clean 
make distclean 
cd ../ 



5、修改php.ini文件 
  <STRONG>手工修改:</STRONG>查找/usr/local/webserver/php/etc/php.ini中的extension_dir = "./" 
  修改為extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/" 
  并在此行后增加以下幾行,然后保存: 
  extension = "memcache.so" 
  extension = "pdo_mysql.so" 
  extension = "imagick.so" 

  再查找output_buffering = Off 
  修改為output_buffering = On 

6、配置eAccelerator加速PHP: 
mkdir -p /usr/local/webserver/eaccelerator_cache 
vi /usr/local/webserver/php/etc/php.ini 
按shift+g鍵跳到配置文件的最末尾,加上以下配置信息: 

復(fù)制代碼

代碼如下:


[eaccelerator] 
zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so" 
eaccelerator.shm_size="128" 
eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache" 
eaccelerator.enable="1" 
eaccelerator.optimizer="1" 
eaccelerator.check_mtime="1" 
eaccelerator.debug="0" 
eaccelerator.filter="" 
eaccelerator.shm_max="0" 
eaccelerator.shm_ttl="300" 
eaccelerator.shm_prune_period="120" 
eaccelerator.shm_only="0" 
eaccelerator.compress="1" 
eaccelerator.compress_level="9" 


修改配置文件: 
vi /etc/sysctl.conf 
kernel.shmmax = 134217728 
然后執(zhí)行以下命令使配置生效:/sbin/sysctl -p 

以下的步驟和張宴步驟中一樣配置,不再贅訴

延伸 · 閱讀

精彩推薦
  • CentosCentOS下Uptime命令詳解

    CentOS下Uptime命令詳解

    在Linux下,我們可以使用uptime命令,而且此命令不必使用root權(quán)限。uptime命令在系統(tǒng)中已經(jīng)默認安裝了。今天小編為大家?guī)淼氖荂entOS下Uptime命令詳解;希望...

    CentOS之家11482019-06-19
  • Centoscentos不小心刪除/root目錄該如何解決?

    centos不小心刪除/root目錄該如何解決?

    一些朋友最近在問小編centos不小心刪除/root目錄該如何解決?今天小編就為大家分享centos不小心刪除/root目錄解決辦法;希望對大家會有幫助,有需要的朋友...

    腳本之家8022019-05-29
  • CentosCentos 7開啟網(wǎng)卡自動獲取IP的詳細方法

    Centos 7開啟網(wǎng)卡自動獲取IP的詳細方法

    本篇文章主要介紹了Centos 7開啟網(wǎng)卡自動獲取IP的詳細方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧...

    凌鋒8972021-12-29
  • CentosCentOS 6.6實現(xiàn)永久修改DNS地址的方法

    CentOS 6.6實現(xiàn)永久修改DNS地址的方法

    這篇文章主要介紹了CentOS 6.6實現(xiàn)永久修改DNS地址的方法,涉及針對CentOS配置文件的相關(guān)設(shè)置技巧,具有一定參考借鑒價值,需要的朋友可以參考下 ...

    Linux社區(qū)4472020-08-21
  • Centoscentos 安裝與操作方法

    centos 安裝與操作方法

    這篇文章主要介紹了centos 安裝與操作方法,需要的朋友可以參考下...

    centos之家5272019-07-11
  • CentosCentos7運用/dev/shm進行網(wǎng)站優(yōu)化

    Centos7運用/dev/shm進行網(wǎng)站優(yōu)化

    這篇文章主要介紹了LINUX中Centos7運用/dev/shm進行網(wǎng)站優(yōu)化相關(guān)知識點,對此有興趣的朋友參考學習下。...

    彬菌9912022-03-02
  • CentosCentOS6.5下Redis安裝與配置詳細步驟

    CentOS6.5下Redis安裝與配置詳細步驟

    本篇文章主要介紹了CentOS6.5下Redis安裝與配置詳細步驟,詳細介紹redis單機單實例安裝與配置,服務(wù)及開機自啟動。有興趣的可以了解一下。...

    飛流11452021-12-24
  • CentosCentOS7設(shè)置日期和時間方法以及基本概念介紹

    CentOS7設(shè)置日期和時間方法以及基本概念介紹

    這篇文章主要介紹了CentOS7設(shè)置日期和時間方法以及基本概念介紹,本文講解使用CentOS7中的新命令timedatectl設(shè)置日期時間方法,需要的朋友可以參考下 ...

    CentOS之家6522019-09-19
主站蜘蛛池模板: 国色天香 社区视频 | 欧美折磨另类系列sm | 国产卡一卡二卡三乱码手机 | 我与么公激情性完整视频 | 久久草香蕉频线观 | 日本在线观看www免费 | 亚洲AV国产精品无码精 | 国产一精品一av一免费爽爽 | 国产九九在线 | 福利一区在线观看 | 大色综合 | 天天综合色天天综合 | 欧美男同video | 免费观看小视频 | 奇米网7777| 日韩综合一区 | 成人国产一区 | 色综七七久久成人影 | 久久中文字幕亚洲 | 人人爱天天做夜夜爽88 | 四虎影视网站 | 1024日韩基地 | 动漫美女被羞羞产奶 | 国产一卡二卡四卡免费 | 韩国www| 欧美日韩精品乱国产 | 午夜免费体验30分 | 久久人妻无码毛片A片麻豆 久久热这里只有 精品 | 日韩国产欧美一区二区三区 | 国产一级片免费观看 | 精品无码久久久久久久动漫 | 好吊色网站 | 亚洲国产三级在线观看 | 天天干天天爽天天操 | 国产91精选学生在线观看 | 色综合97天天综合网 | 亚洲成人伦理 | 久久精品国产清白在天天线 | 日韩精品一二三区 | 91在线 一区 二区三区 | 日本在线www|