LAMP安装手册 lamp安装
创始人
2024-07-22 14:51:25
0

  LAMP安装手册 :

  一、主要软件包

  1. httpd-2.2.6.tar.gz

  2. mysql-5.0.45-linux-i686-glibc23.tar.gz ( 这个版本是已编译好的压缩包,解压后稍做配置即可使用 )

  3. php-5.2.5.tar.gz

  安装 php 所需的软件包(其中 libxml2 是安装 php5 必须的 . )

  1. libxml2-(version).tar.gz ---> http://ftp.gnome.org/pub/GNOME/sources/libxm2

  2. libxslt-(version).tar.gz ---> http://ftp.gnome.org/pub/GNOME/sources/libxslt

  3. curl-(version).tar.gz ---> http://curl.haxx.se/download

  GD 库所需要软件包(有人说 PHP 源码包里自带了 GD2.0.28 和 zlib ,只要安装 GD 的三个支持包: jpg,png 和 freetype ,但是我们还是下载)

  1. gd-(version).tar.gz ---> http://www.libgd.org/Main_Page or http://www.libgd.org/releases/

  2. freetype-(version).tar.gz ---> http://sourceforge.net/projects/freetype

  3. jpegsrc.v6b.tar.gz ---> http://ijg.org/files/jpegsrc.v6b.tar.gz

  4. libpng-(version).tar.gz ---> http://www.libpng.org/pub/png/libpng.html

  5. zlib-1.2.3.tar.gz ---> http://www.zlib.net

  把以上所有软件包下载到: /root/Software/ 目录下 .

#p#

  二:安装 mysql

  1.   # tar -zvxf mysql-5.0.45-linux-i686-glibc23.tar.gz  
  2.  
  3.   # mkdir -p /usr/local/mysql  
  4.  
  5.   # cp -r mysql-5.0.45 /usr/local/mysql  
  6.  
  7.   # cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql // 开机启动 mysql  
  8.  
  9.   # cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf  
  10.  

  添加 mysql 用户及用户组

  1.   # groupadd mysql  
  2.  
  3.   # useradd -g mysql mysql  
  4.  

  修改 mysql 目录权限

  1.   # chown -R root /usr/local/mysql  
  2.  
  3.   # chgrp -R mysql /usr/local/mysql  
  4.  
  5.   # chown -R mysql /usr/local/mysql/data  
  6.  

  生成 mysql 系统数据库

  1.   # /usr/local/mysql/scripts/mysql_install_db --user=mysql& // 启动 mysql 服务  
  2.  
  3.   # /usr/local/mysql/bin/mysqld_safe --user=mysql&  
  4.  

  如出现 Starting mysqld daemon with databases from /usr/local/mysql/data 代表正常启动 mysql 服务了 .

  按 Ctrl + C 跳出修改 mysql 的 root 密码

  1.   # /usr/local/mysql/bin/mysqladmin -u root -p password "123456"  
  2.  

#p#

  三:安装 GD 库 ( 让 PHP 支持 GIF,PNG,JPEG)

  a. 安装 jpeg6 建立目录:

  1.   # mkdir -p /usr/local/jpeg6  
  2.  
  3.   # mkdir -p /usr/local/jpeg6/bin  
  4.  
  5.   # mkdir -p /usr/local/jpeg6/lib  
  6.  
  7.   # mkdir -p /usr/local/jpeg6/include  
  8.  
  9.   # mkdir -p /usr/local/jpeg6/man  
  10.  
  11.   # mkdir -p /usr/local/jpeg6/man1  
  12.  
  13.   # mkdir -p /usr/local/jpeg6/man/man1  
  14.  
  15.   # cd /root/Software/  
  16.  
  17.   # tar -zvxf jpegsrc.v6b.tar.gz  
  18.  
  19.   # cd jpeg6  
  20.  
  21.   # ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static  
  22.  
  23.   # make  
  24.  
  25.   # make install  
  26.  

  b.libpng 包 ( 支持 PNG)

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zvxf libpng-(version).tar.gz  
  4.  
  5.   # cd libpng-(version)  
  6.  
  7.   # ./configure --prefix=/usr/local/libpng  
  8.  
  9.   # make  
  10.  
  11.   #> make install  
  12.  

  c. 安装 freetype

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zvxf freetype-(version).tar.gz  
  4.  
  5.   # cd freetype-(version)  
  6.  
  7.   # mkdir -p /usr/local/freetype  
  8.  
  9.   # ./configure --prefix=/usr/local/freetype  
  10.  
  11.   # make  
  12.  
  13.   # make install  
  14.  

  d. 安装 zlib

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zxvf zlib-1.2.3.tar.gz  
  4.  
  5.   # cd zlib.1.2.3  
  6.  
  7.   # mkdir /usr/local/zlib  
  8.  
  9.   # ./configure --prefix=/usr/local/zlib  
  10.  
  11.   # make  
  12.  
  13.   # make install  
  14.  

  e. 安装 GD 库

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zvxf gd-(version).tar.gz  
  4.  
  5.   # mkdir -p /usr/local/gd2  
  6.  
  7.   # cd gd-(version)  
  8.  
  9.   # ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6 --with-zlib-dir=/usr/local/zlib --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype  
  10.  
  11.   # make  
  12.  
  13.   # make install  
  14.  

  e. 安装 Curl 库

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zxf curl-(version).tar.gz  
  4.  
  5.   # mkdir -p /usr/local/curl  
  6.  
  7.   # ./configure --prefix=/usr/local/curl  
  8.  
  9.   # make  
  10.  
  11.   # make install  
  12.  

#p#

  四:安装 apache2

  1.   # cd /roo/Software/  
  2.  
  3.   # tar -zvxf httpd-2.2.6.tar.gz  
  4.  
  5.   # cd httpd-2.2.6  
  6.  
  7.   # mkdir -p /usr/local/apache2  
  8.  
  9.   # ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite  
  10.  
  11.   # make  
  12.  
  13.   # make install  
  14.  
  15.   # /usr/local/apache2/bin/apachectl -k start // 启动 apahce  
  16.  

  用浏览器查看 http://localhost, 得到 it works ,说明 apache 已经配置成功了 .

  1.   # /usr/local/apache2/bin/apachectl -k stop // 停止 apache  
  2.  

#p#

  五:安装 php5

    php5 必须有 libxml2 支持 !

  a. 安装 libxml2

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zvxf libxml2-(version).tar.gz  
  4.  
  5.   # cd libxml2-(version)  
  6.  
  7.   # mkdir -p /usr/local/libxml2  
  8.  
  9.   # ./configure --prefix=/usr/local/libxml2  
  10.  
  11.   # make  
  12.  
  13.   # make install  
  14.  

  b. 安装 libxslt ( 可选安装,你可以不安装 )

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zvxf libxslt-(version).tar.gz  
  4.  
  5.   # mkdir -p /usr/local/libxslt  
  6.  
  7.   # cd libxslt-(version)  
  8.  
  9.   # ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2  
  10.  
  11.   # make  
  12.  
  13.   # make install  
  14.  

  c. 安装 php5

  1.   # cd /root/Software/  
  2.  
  3.   # tar -zvxf php-(version).tar.gz  
  4.  
  5.   # mkdir -p /usr/local/php5  
  6.  
  7.   # cd php-(version)  
  8.  
  9.   # ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs \  
  10.  
  1.   >--with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg6 \  
  2.  
  3.   >--with-zlib-dir=/usr/local/zlib \  
  4.  
  5.   >--with-png-dir=/usr/local/libpng \  
  6.  
  7.   >--with-freetype-dir=/usr/local/freetype -\  
  8.  
  9.   >--enable-trace-vars --with-mysql=/usr/local/mysql \  
  10.  
  11.   >--enable-mbstring=all --with-curl=/usr/local/curl --enable-mbregex \  
  12.  
  13.   >--with-config-file-path=/usr/local/php5 --enable-ftp \  
  14.  
  15.   >--enable-soap --with-xsl=/usr/local/libxslt  
  16.  
  17.   # make  
  18.  
  19.   # make install  
  20.  
  21.   # cp php.ini-dist /usr/local/php5/php.ini   

#p#

  六:重新配置 apache2 让他支持 php

  1.   # cd /usr/local/apache2/conf  
  2.  
  3.   # vim httpd.conf  
  4.  
  5.   在 LoadModule php5_module modules/libphp5.so  
  6.  

  添加 AddType application/x-httpd-php .php

  OK, 基本的安装已经完成 .

  重新起动 APACHE:

  1.   # /usr/local/apache2/bin/apachectl start  
  2.  

  如果重新起动 APACHE 出现 :

  1.   Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server:  
  2.  
  3.   /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied  
  4.  

  那就要按照下面的方法解决 :

  1.chcon -t texrel_shlib_t /usr/local/apache2/modules/*.so

  2. 编辑 /etc/selinux/config ,找到这段:

  1.   # This file controls the state of SELinux on the system.  
  2.  
  3.   # SELINUX= can take one of these three values:  
  4.  
  5.   # enforcing - SELinux security policy is enforced.  
  6.  
  7.   # permissive - SELinux prints warnings instead of enforcing.  
  8.  
  9.   # disabled - SELinux is fully disabled.  
  10.  
  11.   SELINUX=enforcing 
  12.  

  把 SELINUX=enforcing 注释掉: #SELINUX=enforcing ,然后新加一行为:

  SELINUX=disabled

  保存,关闭。

  编辑 /etc/sysconfig/selinux ,找到 :

  1.   # This file controls the state of SELinux on the system.  
  2.  
  3.   # SELINUX= can take one of these three values:  
  4.  
  5.   # enforcing - SELinux security policy is enforced.  
  6.  
  7.   # permissive - SELinux prints warnings instead of enforcing.  
  8.  
  9.   # disabled - SELinux is fully disabled.  
  10.  
  11.   SELINUX=enforcing 
  12.  

  如果 SELINUX 已经是 SELINUX=disabled ,那么就不用改了,否则就把 SELINUX=enforcing 注释掉,新加一行:

  1.   SELINUX=disabled 
  2.  

  保存,退出。

【编辑推荐】

  1. LAMP技术精解
  2. Red Hat下安装LAMP的过程
  3. 使用CentOS源安装LAMP全过程

 

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...
《非诚勿扰》红人闫凤娇被曝厕所... 【51CTO.com 综合消息360安全专家提醒说,“闫凤娇”、“非诚勿扰”已经被黑客盯上成为了“木...
2012年第四季度互联网状况报... [[71653]]  北京时间4月25日消息,据国外媒体报道,全球知名的云平台公司Akamai Te...