CentOS5.5下快速編譯安裝最新的LAMP環境
文章轉自linuxtone論壇:http://bbs.linuxtone.org/thread-7579-1-1.html
首先安裝相關依賴包:
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
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
複製程式碼
安裝MySQL:
[root@lamptest~]#tar zxvf mysql-5.1.51.tar.gz
[root@lamptest~]#cd mysql-5.1.51/
[root@lamptest mysql-5.1.51]#./configure –prefix=/usr/local/mysql –with-extra-charsets=all –enable-thread-safe-client –enable-assembler –with-charset=utf8 –enable-thread-safe-client –with-extra-charsets=all –with-big-tables –with-readline –with-ssl –with-embedded-server –enable-local-infile
[root@lamptest mysql-5.1.51]#make && make install
[root@lamptest mysql-5.1.51]#groupadd mysql
[root@lamptest mysql-5.1.51]#useradd –g mysql mysql
[root@lamptest mysql-5.1.51]#/usr/local/mysql/bin/mysql_install_db –user=mysql
[root@lamptest mysql-5.1.51]#cp /usr/local/mysql/share/mysql/my-medium /etc/my.cnf
[root@lamptest mysql-5.1.51]#chown –R mysql /usr/local/mysql/var
[root@lamptest mysql-5.1.51]#chgrp –R mysql /usr/local/mysql/.
[root@lamptest mysql-5.1.51]#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
[root@lamptest mysql-5.1.51]#chmod 755 /etc/init.d/mysql
[root@lamptest mysql-5.1.51]#chkconfig –level 345 mysql on
[root@lamptest mysql-5.1.51]#echo “/usr/local/mysql/lib/mysql” >> /etc/ld.so.conf
[root@lamptest mysql-5.1.51]#echo “/usr/local/lib” >> /etc/ld.so.conf
[root@lamptest mysql-5.1.51]#ldconfig
[root@lamptest mysql-5.1.51]#ln –s /usr/local/mysql/lib/mysql /usr/lib/mysql
[root@lamptest mysql-5.1.51]#ln –s /usr/local/mysql/include/mysql /usr/include/mysql
[root@lamptest mysql-5.1.51]#service mysql start
[root@lamptest mysql-5.1.51]#/usr/local/mysql/bin/mysqladmin –u root password $mysqlpass (這裡填寫你的mysql的密碼)
[root@lamptest mysql-5.1.51]#service mysql restart
[root@lamptest mysql-5.1.51]#service mysql stop
[root@lamptest mysql-5.1.51]#cd ../
[root@lamptest~]#cd mysql-5.1.51/
[root@lamptest mysql-5.1.51]#./configure –prefix=/usr/local/mysql –with-extra-charsets=all –enable-thread-safe-client –enable-assembler –with-charset=utf8 –enable-thread-safe-client –with-extra-charsets=all –with-big-tables –with-readline –with-ssl –with-embedded-server –enable-local-infile
[root@lamptest mysql-5.1.51]#make && make install
[root@lamptest mysql-5.1.51]#groupadd mysql
[root@lamptest mysql-5.1.51]#useradd –g mysql mysql
[root@lamptest mysql-5.1.51]#/usr/local/mysql/bin/mysql_install_db –user=mysql
[root@lamptest mysql-5.1.51]#cp /usr/local/mysql/share/mysql/my-medium /etc/my.cnf
[root@lamptest mysql-5.1.51]#chown –R mysql /usr/local/mysql/var
[root@lamptest mysql-5.1.51]#chgrp –R mysql /usr/local/mysql/.
[root@lamptest mysql-5.1.51]#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
[root@lamptest mysql-5.1.51]#chmod 755 /etc/init.d/mysql
[root@lamptest mysql-5.1.51]#chkconfig –level 345 mysql on
[root@lamptest mysql-5.1.51]#echo “/usr/local/mysql/lib/mysql” >> /etc/ld.so.conf
[root@lamptest mysql-5.1.51]#echo “/usr/local/lib” >> /etc/ld.so.conf
[root@lamptest mysql-5.1.51]#ldconfig
[root@lamptest mysql-5.1.51]#ln –s /usr/local/mysql/lib/mysql /usr/lib/mysql
[root@lamptest mysql-5.1.51]#ln –s /usr/local/mysql/include/mysql /usr/include/mysql
[root@lamptest mysql-5.1.51]#service mysql start
[root@lamptest mysql-5.1.51]#/usr/local/mysql/bin/mysqladmin –u root password $mysqlpass (這裡填寫你的mysql的密碼)
[root@lamptest mysql-5.1.51]#service mysql restart
[root@lamptest mysql-5.1.51]#service mysql stop
[root@lamptest mysql-5.1.51]#cd ../
複製程式碼
安裝Apache:
[root@lamptest~]#tar zxvf httpd-2.2.17.tar.gz
[root@lamptest~]#cd httpd-2.2.17/
[root@lamptest httpd-2.2.17]#./configure –prefix=/usr/local/apache –enable-rewrite=shared –enable-so –enable-ssl –with-charset=UTF8 –disable-access –disable-auth –disable-charset-lite –disable-include –disable-log-config –disable-env –disable-setenvif –disable-mime –disable-status –disable-autoindex –disable-asis –disable-cgid –disable-cgi –disable-negotiation –disable-dir –disable-actions –disable-userdir –disable-alias –enable-so –enable-mods-shared=`access auth auth_anon auth_dbm auth_digest dav dav_fs actions alias asis autoindex cache cern_meta cgi charset_lite deflate dir disk_cache env expires file_cache headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias`
[root@lamptest httpd-2.2.17]#make && make install
[root@lamptest httpd-2.2.17]#/usr/local/apache/bin/apachectl start
[root@lamptest httpd-2.2.17]#cd ../
[root@lamptest~]#cd httpd-2.2.17/
[root@lamptest httpd-2.2.17]#./configure –prefix=/usr/local/apache –enable-rewrite=shared –enable-so –enable-ssl –with-charset=UTF8 –disable-access –disable-auth –disable-charset-lite –disable-include –disable-log-config –disable-env –disable-setenvif –disable-mime –disable-status –disable-autoindex –disable-asis –disable-cgid –disable-cgi –disable-negotiation –disable-dir –disable-actions –disable-userdir –disable-alias –enable-so –enable-mods-shared=`access auth auth_anon auth_dbm auth_digest dav dav_fs actions alias asis autoindex cache cern_meta cgi charset_lite deflate dir disk_cache env expires file_cache headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias`
[root@lamptest httpd-2.2.17]#make && make install
[root@lamptest httpd-2.2.17]#/usr/local/apache/bin/apachectl start
[root@lamptest httpd-2.2.17]#cd ../
複製程式碼
安裝PHP:
[root@lamptest~]#tar zxvf libiconv-1.13.tar.gz
[root@lamptest~]#cd libiconv-1.13/
[root@lamptest libiconv-1.13]#./configure –prefix=/usr/local
[root@lamptest libiconv-1.13]#make && make install
[root@lamptest libiconv-1.13]#cd ../
[root@lamptest~]#tar zxvf libmcrypt-2.5.8.tar.gz
[root@lamptest~]#cd libmcrypt-2.5.8/
[root@lamptest libmcrypt-2.5.8]#./configure
[root@lamptest libmcrypt-2.5.8]#make && make install
[root@lamptest libmcrypt-2.5.8]#/sbin/ldconfig
[root@lamptest libmcrypt-2.5.8]#cd libltdl/
[root@lamptest libltdl]#./configure –enable-ltdl-install
[root@lamptest libltdl]#make && make install
[root@lamptest libltdl]#cd ../../
[root@lamptest~]#tar zxvf mhash-0.9.9.9.tar.gz
[root@lamptest~]#cd mhash-0.9.9.9/
[root@lamptest mhash-0.9.9.9]#./configure
[root@lamptest mhash-0.9.9.9]#make && make install
[root@lamptest mhash-0.9.9.9]#cd ../
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
[root@lamptest~]#ln –s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
[root@lamptest~]#ln –s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
[root@lamptest~]#ln –s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
[root@lamptest~]#ln –s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
[root@lamptest~]#ln –s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
[root@lamptest~]#ln –s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
[root@lamptest~]#tar zxvf mcrypt-2.6.8.tar.gz
[root@lamptest~]#cd mcrypt-2.6.8/
[root@lamptest mcrypt-2.6.8]#/sbin/ldconfig
[root@lamptest mcrypt-2.6.8]#./configure
[root@lamptest mcrypt-2.6.8]#make && make install
[root@lamptest mcrypt-2.6.8]#cd ../
[root@lamptest~]#tar zxvf php-5.2.14.tar.gz
[root@lamptest~]#gzip –d ./suhosin-patch-5.2.14-0.9.7.patch.gz
[root@lamptest~]#gzip –cd php-5.2.14-fpm-0.9.7.diff.gz | patch –d php-5.2.14 -p1
[root@lamptest~]#cd php-5.2.14/
[root@lamptest php-5.2.14]#patch –p 1 –i ../suhosin-patch-5.2.14-0.9.7.patch.gz
[root@lamptest php-5.2.14]#./buildconf –force
[root@lamptest php-5.2.14]#./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –enable-mbstring –enable-ftp –with-gd –with-jpeg-dir=/usr –with-png-dir=/usr –enable-magic-quotes –with-mysql=/usr/local/mysql –with-pear –enable-sockets –with-ttf –with-freetype-dir=/usr –enable-gd-native-ttf –with-zlib –enable-sysvsem –enable-sysvshm –with-libxml-dir=/usr –with-apxs2=/usr/local/apache/bin/apxs –with-iconv-dir=/usr/local –with-xmlrpc –enable-xml –enable-shmop –enable-zip –with-mhash –with-mcrypt –enable-discard-path –enable-bcmath –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –with-openssl
[root@lamptest php-5.2.14]#make ZEND_EXTRA_LIBS=’-liconv’
[root@lamptest php-5.2.14]#make install
[root@lamptest php-5.2.14]#./libtool –finish /usr/local/src/php-5.2.14/libs
[root@lamptest php-5.2.14]#cp php.ini-dist /usr/local/php/etc/php.ini
[root@lamptest php-5.2.14]#echo ‘ulimit –SHn 65535’ >> /etc/rc.local
[root@lamptest php-5.2.14]#cd ../
[root@lamptest~]#cd libiconv-1.13/
[root@lamptest libiconv-1.13]#./configure –prefix=/usr/local
[root@lamptest libiconv-1.13]#make && make install
[root@lamptest libiconv-1.13]#cd ../
[root@lamptest~]#tar zxvf libmcrypt-2.5.8.tar.gz
[root@lamptest~]#cd libmcrypt-2.5.8/
[root@lamptest libmcrypt-2.5.8]#./configure
[root@lamptest libmcrypt-2.5.8]#make && make install
[root@lamptest libmcrypt-2.5.8]#/sbin/ldconfig
[root@lamptest libmcrypt-2.5.8]#cd libltdl/
[root@lamptest libltdl]#./configure –enable-ltdl-install
[root@lamptest libltdl]#make && make install
[root@lamptest libltdl]#cd ../../
[root@lamptest~]#tar zxvf mhash-0.9.9.9.tar.gz
[root@lamptest~]#cd mhash-0.9.9.9/
[root@lamptest mhash-0.9.9.9]#./configure
[root@lamptest mhash-0.9.9.9]#make && make install
[root@lamptest mhash-0.9.9.9]#cd ../
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
[root@lamptest~]#ln –s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
[root@lamptest~]#ln –s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
[root@lamptest~]#ln –s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
[root@lamptest~]#ln –s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
[root@lamptest~]#ln –s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
[root@lamptest~]#ln –s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
[root@lamptest~]#tar zxvf mcrypt-2.6.8.tar.gz
[root@lamptest~]#cd mcrypt-2.6.8/
[root@lamptest mcrypt-2.6.8]#/sbin/ldconfig
[root@lamptest mcrypt-2.6.8]#./configure
[root@lamptest mcrypt-2.6.8]#make && make install
[root@lamptest mcrypt-2.6.8]#cd ../
[root@lamptest~]#tar zxvf php-5.2.14.tar.gz
[root@lamptest~]#gzip –d ./suhosin-patch-5.2.14-0.9.7.patch.gz
[root@lamptest~]#gzip –cd php-5.2.14-fpm-0.9.7.diff.gz | patch –d php-5.2.14 -p1
[root@lamptest~]#cd php-5.2.14/
[root@lamptest php-5.2.14]#patch –p 1 –i ../suhosin-patch-5.2.14-0.9.7.patch.gz
[root@lamptest php-5.2.14]#./buildconf –force
[root@lamptest php-5.2.14]#./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –enable-mbstring –enable-ftp –with-gd –with-jpeg-dir=/usr –with-png-dir=/usr –enable-magic-quotes –with-mysql=/usr/local/mysql –with-pear –enable-sockets –with-ttf –with-freetype-dir=/usr –enable-gd-native-ttf –with-zlib –enable-sysvsem –enable-sysvshm –with-libxml-dir=/usr –with-apxs2=/usr/local/apache/bin/apxs –with-iconv-dir=/usr/local –with-xmlrpc –enable-xml –enable-shmop –enable-zip –with-mhash –with-mcrypt –enable-discard-path –enable-bcmath –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –with-openssl
[root@lamptest php-5.2.14]#make ZEND_EXTRA_LIBS=’-liconv’
[root@lamptest php-5.2.14]#make install
[root@lamptest php-5.2.14]#./libtool –finish /usr/local/src/php-5.2.14/libs
[root@lamptest php-5.2.14]#cp php.ini-dist /usr/local/php/etc/php.ini
[root@lamptest php-5.2.14]#echo ‘ulimit –SHn 65535’ >> /etc/rc.local
[root@lamptest php-5.2.14]#cd ../
複製程式碼
修改httpd.conf 新增
AddType applications /x-httpd-php .php
AddType applications /x-httpd-source-php .phps
在DirectoryIndex 新增index.php
curl返回資訊:
相關安全設定:
修改php.ini expose_php=off
disable_functions=symlink,shell_exec,exec,proc_close,proc_open,popen,
system,dl,passthru,escapeshellarg, escapeshellcmd
本文轉自holy2009 51CTO部落格,原文連結:http://blog.51cto.com/holy2010/430105
相關文章
- 編譯安裝LAMP環境編譯LAMP
- LAMP一體環境快速安裝LAMP
- 詳解CentOS5.5 下搭建 PHP 環境(最佳的LAMP環境)CentOSPHPLAMP
- 編譯LAMP環境之PHP編譯LAMPPHP
- Apache伺服器的編譯安裝和LAMP環境的構建Apache伺服器編譯LAMP
- Linux 環境下編譯安裝 RedisLinux編譯Redis
- 在Centos5.2下編譯安裝LAMPCentOS編譯LAMP
- CentOS7.3 編譯搭建 lamp 環境CentOS編譯LAMP
- LAMP原始碼編譯安裝LAMP原始碼編譯
- Android 原始碼的下載和編譯環境的安裝及編譯Android原始碼編譯
- [LAMP]Php-5.3.29編譯安裝LAMPPHP編譯
- [LAMP]Mysql-5.6.28編譯安裝LAMPMySql編譯
- LAMP兩種編譯安裝模式LAMP編譯模式
- LAMP 編譯安裝基本步驟LAMP編譯
- lnmp環境安裝-原始碼編譯LNMP原始碼編譯
- CPP編譯器安裝(Windows環境)編譯Windows
- Centos6.8下編譯安裝LAMP的操作記錄梳理CentOS編譯LAMP
- 詳解LAMP原始碼編譯安裝LAMP原始碼編譯
- LAMP原始碼編譯安裝配置+wordpressLAMP原始碼編譯
- [LAMP]Apache-2.2.31編譯安裝LAMPApache編譯
- CentOS 7.4 環境下原始碼編譯安裝 postgreSQL 11.4CentOS原始碼編譯SQL
- Debian9 (Stretch) 下編譯安裝 LNMP 環境編譯LNMP
- Debian9(Stretch) 下編譯安裝LNMP環境編譯LNMP
- opensuse linux安裝gcc編譯環境LinuxGC編譯
- centos 7.2 64位 docker安裝lamp環境CentOSDockerLAMP
- 搭建lamp環境以及安裝配置phpmyadminLAMPPHP
- Docker環境下編譯安裝PHP7.1.4 Nginx1.12.0Docker編譯PHPNginx
- RHEL5u3環境下編譯安裝MySQL Proxy 0.8.1編譯MySql
- LAMP純原始碼編譯安裝日誌LAMP原始碼編譯
- 在樹莓派上編譯安裝golang環境樹莓派編譯Golang
- Linux環境PostGIS原始碼編譯安裝Linux原始碼編譯
- centos下編譯lnmp環境CentOS編譯LNMP
- PHP環境LAMP/LNMP安裝與配置筆記PHPLAMPLNMP筆記
- CentOS 7.4 環境下原始碼編譯(多例項)安裝 Mysql 5.7.26CentOS原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(3)Linux原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(2)Linux原始碼編譯MySql
- Linux環境下原始碼編譯方式安裝MySQL5.1(1)Linux原始碼編譯MySql
- 【轉】 Windows下LAMP環境搭建WindowsLAMP