宝马娱乐在线112222 > 网络应用 > LAMP安装配置

原标题:LAMP安装配置

浏览次数:182 时间:2019-10-01

Linux下安装MySql+Apache2+PHP5.3.1教程

主要软件包,

请先下载下面三个安装必要的软件

  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必须的.)
  4. libxml2-(version).tar.gz ---> http://ftp.gnome.org/pub/GNOME/sources/libxm2
  5. libxslt-(version).tar.gz ---> http://ftp.gnome.org/pub/GNOME/sources/libxslt
  6. curl-(version).tar.gz   ---> http://curl.haxx.se/download
    GD库所需要软件包(有人说PHP源码包里自带了GD2.0.28和zlib,只要安装GD的三个支持包:jpg,png和freetype,但是我们还是下载)
  7. gd-(version).tar.gz     ---> http://www.libgd.org/Main_Page or http://www.libgd.org/releases/
  8. freetype-(version).tar.gz ---> http://sourceforge.net/projects/freetype
  9. jpegsrc.v6b.tar.gz     ---> http://ijg.org/files/jpegsrc.v6b.tar.gz
  10. libpng-(version).tar.gz   ---> http://www.libpng.org/pub/png/libpng.html
  11. zlib-1.2.3.tar.gz       ---> http://www.zlib.net
    把以上所有软件包下载到:/root/Software/目录下.
    二:安装mysql
    # tar -zvxf mysql-5.0.45-linux-i686-glibc23.tar.gz
    # mkdir -p /usr/local/mysql
    # cp -r mysql-5.0.45 /usr/local/mysql
    # cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql //开机启动mysql
    # cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
    添加mysql用户及用户组
    # groupadd mysql
    # useradd -g mysql mysql
    修改mysql目录权限
    # chown -R root /usr/local/mysql
    # chgrp -R mysql /usr/local/mysql
    # chown -R mysql /usr/local/mysql/data
    生成mysql系统数据库
    # /usr/local/mysql/scripts/mysql_install_db --user=mysql& //启动mysql服务
    # /usr/local/mysql/bin/mysqld_safe --user=mysql&
    如出现Starting mysqld daemon with databases from /usr/local/mysql/data 代表正常启动mysql服务了.
    按Ctrl + C 跳出修改mysql 的root 密码
    # /usr/local/mysql/bin/mysqladmin -u root -p password "123456"
    三:安装GD库(让PHP支持GIF,PNG,JPEG)
    a.安装jpeg6 建立目录:
    # mkdir -p /usr/local/jpeg6
    # mkdir -p /usr/local/jpeg6/bin
    # mkdir -p /usr/local/jpeg6/lib
    # mkdir -p /usr/local/jpeg6/include
    # mkdir -p /usr/local/jpeg6/man
    # mkdir -p /usr/local/jpeg6/man1
    # mkdir -p /usr/local/jpeg6/man/man1
    # cd /root/Software/
    # tar -zvxf jpegsrc.v6b.tar.gz
    # cd jpeg6
    # ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
    # make
    # make install
    b.libpng包(支持PNG)
    # cd /root/Software/
    # tar -zvxf libpng-(version).tar.gz
    # cd libpng-(version)
    # ./configure --prefix=/usr/local/libpng
    # make
    #> make install
    c.安装freetype
    # cd /root/Software/
    # tar -zvxf freetype-(version).tar.gz
    # cd freetype-(version)
    # mkdir -p /usr/local/freetype
    # ./configure --prefix=/usr/local/freetype
    # make
    # make install
    d.安装zlib
    # cd /root/Software/
    # tar -zxvf zlib-1.2.3.tar.gz
    # cd zlib.1.2.3
    # mkdir /usr/local/zlib
    # ./configure --prefix=/usr/local/zlib
    # make
    # make install
    e.安装GD库
    # cd /root/Software/
    # tar -zvxf gd-(version).tar.gz
    # mkdir -p /usr/local/gd2
    # cd gd-(version)
    # ./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
    # make
    # make install
    e.安装Curl库
    # cd /root/Software/
    # tar -zxf curl-(version).tar.gz
    # mkdir -p /usr/local/curl
    # ./configure --prefix=/usr/local/curl
    # make
    # make install
    四:安装apache2
    # cd /roo/Software/
    # tar -zvxf httpd-2.2.6.tar.gz
    # cd httpd-2.2.6
    # mkdir -p /usr/local/apache2
    # ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
    # make
    # make install
    # /usr/local/apache2/bin/apachectl -k start //启动apahce
    用浏览器查看http://localhost,得到it works,说明apache已经配置成功了.
    # /usr/local/apache2/bin/apachectl -k stop //停止apache
    五:安装php5,php5必须有libxml2支持!
    a. 安装libxml2
    # cd /root/Software/
    # tar -zvxf libxml2-(version).tar.gz
    # cd libxml2-(version)
    # mkdir -p /usr/local/libxml2
    # ./configure --prefix=/usr/local/libxml2
    # make
    # make install
    b.安装libxslt (可选安装,你可以不安装)
    # cd /root/Software/
    # tar -zvxf libxslt-(version).tar.gz
    # mkdir -p /usr/local/libxslt
    # cd libxslt-(version)
    # ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
    # make
    # make install
    c.安装php5
    # cd /root/Software/
    # tar -zvxf php-(version).tar.gz
    # mkdir -p /usr/local/php5
    # cd php-(version)
    # ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs
    >--with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg6
    >--with-zlib-dir=/usr/local/zlib
    >--with-png-dir=/usr/local/libpng
    >--with-freetype-dir=/usr/local/freetype -
    >--enable-trace-vars --with-mysql=/usr/local/mysql
    >--enable-mbstring=all --with-curl=/usr/local/curl --enable-mbregex
    >--with-config-file-path=/usr/local/php5 --enable-ftp
    >--enable-soap --with-xsl=/usr/local/libxslt
    # make
    # make install
    # cp php.ini-dist /usr/local/php5/php.ini (别忘记了呵呵)
    六:重新配置apache2让他支持php
    # cd /usr/local/apache2/conf
    # vim httpd.conf
    在LoadModule php5_module modules/libphp5.so
    添加AddType application/x-httpd-php .php
    OK,基本的安装已经完成.
    重新起动APACHE:
    # /usr/local/apache2/bin/apachectl start
    如果重新起动APACHE出现:
    Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server:
    /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
    那就要按照下面的方法解决:
    1.chcon -t texrel_shlib_t /usr/local/apache2/modules/*.so
    2.编辑/etc/selinux/config,找到这段:
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - SELinux is fully disabled.
    SELINUX=enforcing
    把SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
    SELINUX=disabled
    保存,关闭。
    编辑/etc/sysconfig/selinux,找到:
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - SELinux is fully disabled.
    SELINUX=enforcing
    如果SELINUX已经是SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行:
    SELINUX=disabled
    保存,退出。

 

摘自 PainsOnline的专栏

01-04php-5.3.1.tar.gz安装包下载

http://www.bkjia.com/Linuxjc/555203.htmlwww.bkjia.comtruehttp://www.bkjia.com/Linuxjc/555203.htmlTechArticle主要软件包, 1. httpd-2.2.6.tar.gz 2. mysql-5.0.45-linux-i686-glibc23.tar.gz (这个版本是已编译好的压缩包,解压后稍做配置即可使用) 3. php-5.2.5.tar.gz 安...

01-04httpd-2.2.14.tar.gz 安装包下载

01-04mysql-5.1.42-linux-i686-glibc2

 

一、安装apache2————————————————————————————————–

1、tar -zvxf httpd-2.2.14.tar.gz
2、cd httpd-2.2.14
3、./configure –enable-modules=so –enable-rewrite
4、make
5、make install
6、/usr/local/apache2/bin/apachectl -k start //启动apahce
用浏览器查看[url]http://localhost[/url],得到it works,说明apache已经配置成功了.
7、/usr/local/apache2/bin/apachectl -k stop //停止apache
8、apache安装成功并启动后,重启机器后并不会自动启动apache,需要手动启动,要设置随机启动执行指令:echo “/usr/local/apache2/bin/apachectl” >>/etc/rc.d/rc.local,指令的意思是把”/usr/local/apache2/bin/apachectl” 这个字串附到rc.local这个文件的最后一行,rc.local是一个在linux启动成功后要去执行的一个scripts file。
9、安装apache2修改/usr/local/apache/conf/httpd.conf发现不会生效,这很可能是系统使用了默认的安装httpd(默认httpd的配置文件在:/etc/httpd/conf/httpd.conf)。要卸载系统默认安装的httpd执行指令:rpm -e httpd。 如果有依赖关系卸载不了 后面加参数 — nodeps
指令:

rpm -e httpd --nodeps(如要卸载系统的httpd,则执行)
tar -zvxf httpd-2.2.14.tar.gz
cd httpd-2.2.14
./configure --enable-modules=so --enable-rewrite
make
make install 
/usr/local/apache2/bin/apachectl  start
echo "/usr/local/apache2/bin/apachectl" >>/etc/rc.d/rc.local

本文由宝马娱乐在线112222发布于网络应用,转载请注明出处:LAMP安装配置

关键词:

上一篇:php __autoload魔术方法

下一篇:没有了