日期:2014-05-16  浏览次数:20799 次

linux下的Apache2 + mysql5 + php5 安装详解 zt
linux下的Apache2 + mysql5 + php5 安装详解 zt


来源: ChinaUnix博客  日期: 2008.03.04 12:12 (共有条评论) 我要评论
 

linux下的Apache2 + mysql5 + php5 源码完整安装详解

原来出处找不到了,恰巧是您的大作请海涵:-)
一:准备软件包,存放/home/xiutuo/software/目录下。

主要软件包,
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/目录下.

二:安装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