CentOS5.5下快速编译安装最新的LAMP环境

发布于 2022-10-15 08:27:22 字数 8664 浏览 36 评论 0

CentOS5.5下快速编译安装最新的LAMP环境


首先安装相关依赖包:
  1. sudo -s
  2. LANG=C
  3. 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:
  1. [root@lamptest~]#tar zxvf mysql-5.1.51.tar.gz
  2. [root@lamptest~]#cd mysql-5.1.51/
  3. [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
  4. [root@lamptest mysql-5.1.51]#make && make install
  5. [root@lamptest mysql-5.1.51]#groupadd mysql
  6. [root@lamptest mysql-5.1.51]#useradd –g mysql mysql
  7. [root@lamptest mysql-5.1.51]#/usr/local/mysql/bin/mysql_install_db –user=mysql
  8. [root@lamptest mysql-5.1.51]#cp /usr/local/mysql/share/mysql/my-medium /etc/my.cnf
  9. [root@lamptest mysql-5.1.51]#chown –R mysql /usr/local/mysql/var
  10. [root@lamptest mysql-5.1.51]#chgrp –R mysql /usr/local/mysql/.
  11. [root@lamptest mysql-5.1.51]#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
  12. [root@lamptest mysql-5.1.51]#chmod 755 /etc/init.d/mysql
  13. [root@lamptest mysql-5.1.51]#chkconfig –level 345 mysql on
  14. [root@lamptest mysql-5.1.51]#echo “/usr/local/mysql/lib/mysql” >> /etc/ld.so.conf
  15. [root@lamptest mysql-5.1.51]#echo “/usr/local/lib” >> /etc/ld.so.conf
  16. [root@lamptest mysql-5.1.51]#ldconfig
  17. [root@lamptest mysql-5.1.51]#ln –s /usr/local/mysql/lib/mysql /usr/lib/mysql
  18. [root@lamptest mysql-5.1.51]#ln –s /usr/local/mysql/include/mysql /usr/include/mysql
  19. [root@lamptest mysql-5.1.51]#service mysql start
  20. [root@lamptest mysql-5.1.51]#/usr/local/mysql/bin/mysqladmin –u root password $mysqlpass (这里填写你的mysql的密码)
  21. [root@lamptest mysql-5.1.51]#service mysql restart
  22. [root@lamptest mysql-5.1.51]#service mysql stop
  23. [root@lamptest mysql-5.1.51]#cd ../
  24. 复制代码

  25. 安装Apache:

  26. [root@lamptest~]#tar zxvf httpd-2.2.17.tar.gz
  27. [root@lamptest~]#cd httpd-2.2.17/
  28. [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'
  29. [root@lamptest httpd-2.2.17]#make && make install
  30. [root@lamptest httpd-2.2.17]#/usr/local/apache/bin/apachectl start
  31. [root@lamptest httpd-2.2.17]#cd ../
复制代码复制代码

安装PHP:
  1. [root@lamptest~]#tar zxvf libiconv-1.13.tar.gz
  2. [root@lamptest~]#cd libiconv-1.13/
  3. [root@lamptest libiconv-1.13]#./configure –prefix=/usr/local
  4. [root@lamptest libiconv-1.13]#make && make install
  5. [root@lamptest libiconv-1.13]#cd ../

  6. [root@lamptest~]#tar zxvf libmcrypt-2.5.8.tar.gz
  7. [root@lamptest~]#cd libmcrypt-2.5.8/
  8. [root@lamptest libmcrypt-2.5.8]#./configure
  9. [root@lamptest libmcrypt-2.5.8]#make && make install
  10. [root@lamptest libmcrypt-2.5.8]#/sbin/ldconfig
  11. [root@lamptest libmcrypt-2.5.8]#cd libltdl/
  12. [root@lamptest libltdl]#./configure –enable-ltdl-install
  13. [root@lamptest libltdl]#make && make install
  14. [root@lamptest libltdl]#cd ../../

  15. [root@lamptest~]#tar zxvf mhash-0.9.9.9.tar.gz
  16. [root@lamptest~]#cd mhash-0.9.9.9/
  17. [root@lamptest mhash-0.9.9.9]#./configure
  18. [root@lamptest mhash-0.9.9.9]#make && make install
  19. [root@lamptest mhash-0.9.9.9]#cd ../
  20. [root@lamptest~]#ln –s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
  21. [root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
  22. [root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
  23. [root@lamptest~]#ln –s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
  24. [root@lamptest~]#ln –s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
  25. [root@lamptest~]#ln –s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
  26. [root@lamptest~]#ln –s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
  27. [root@lamptest~]#ln –s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
  28. [root@lamptest~]#ln –s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
  29. [root@lamptest~]#ln –s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

  30. [root@lamptest~]#tar zxvf mcrypt-2.6.8.tar.gz
  31. [root@lamptest~]#cd mcrypt-2.6.8/
  32. [root@lamptest mcrypt-2.6.8]#/sbin/ldconfig
  33. [root@lamptest mcrypt-2.6.8]#./configure
  34. [root@lamptest mcrypt-2.6.8]#make && make install
  35. [root@lamptest mcrypt-2.6.8]#cd ../

  36. [root@lamptest~]#tar zxvf php-5.2.14.tar.gz
  37. [root@lamptest~]#gzip –d ./suhosin-patch-5.2.14-0.9.7.patch.gz
  38. [root@lamptest~]#gzip –cd php-5.2.14-fpm-0.9.7.diff.gz | patch –d php-5.2.14 -p1
  39. [root@lamptest~]#cd php-5.2.14/
  40. [root@lamptest php-5.2.14]#patch –p 1 –i ../suhosin-patch-5.2.14-0.9.7.patch.gz
  41. [root@lamptest php-5.2.14]#./buildconf --force
  42. [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
  43. [root@lamptest php-5.2.14]#make ZEND_EXTRA_LIBS=’-liconv’
  44. [root@lamptest php-5.2.14]#make install
  45. [root@lamptest php-5.2.14]#./libtool –finish /usr/local/src/php-5.2.14/libs
  46. [root@lamptest php-5.2.14]#cp php.ini-dist /usr/local/php/etc/php.ini
  47. [root@lamptest php-5.2.14]#echo ‘ulimit –SHn 65535’ >> /etc/rc.local
  48. [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返回信息:

2010-10-21 17:02 上传下载附件 (46.65 KB)

1.png (46.65 KB, 下载次数: 2)

下载附件

2011-04-27 12:28 上传


相关安全设置:
修改php.ini expose_php=off
disable_functions=symlink,shell_exec,exec,proc_close,proc_open,popen,
system,dl,passthru,escapeshellarg, escapeshellcmd

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾忌 2022-10-22 08:27:22

谢谢分享

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文