首先下载一些必要的组件:
MySQL 说明:MySQL 4.1以上和以下的区别我就不说了,大家自己应该比我清楚。我找了一个当前最新版(5.0以上还在测试阶段,不推荐用)。
版本:4.1.8a
下载地址:
ftp://mirror.mcs.anl.gov/pub/mysql/D...-4.1.8a.tar.gz 补丁:这个补丁是必须的,没有编译绝对不能通过,我也是在得到
hongfeng 的提示之后才明白的。本版有这个问题的讨论
http://www.linuxsir.org/bbs/showthread.php?t=170593 请点击这里下载补丁 Apache 说明:这还用说?…… ……
版本号:2.0.52
下载地址:
http://www.apache.org/dist/httpd/httpd-2.0.52.tar.bz2 补丁(请参阅blfs5.1,附件里也有一个,那是我做的。):
http://www.linuxfromscratch.org/patc...9-config.patch PHP 说明:5.0和4.0不是一个概念,请用5.0吧,后面我给大家附加点资料。
版本:5.0.3
下载地址:
http://us2.php.net/distributions/php-5.0.3.tar.bz2 LIBXML2 说明:PHP5要用DOM、XML,这个不能少。
下载地址1:
http://ftp.gnome.org/pub/GNOME/sourc...-2.6.9.tar.bz2 下载地址2:
ftp://xmlsoft.org/libxml2-2.6.16.tar.gz XSLT 说明:不多说了,相信会用XML的人都知道的。
下载地址:
ftp://xmlsoft.org/libxslt-1.1.12.tar.gz 下面的两个组件是可选的,blfs里的详细的说明。不过,如果不选这两个,编译PHP时也应把相应的编译选项去掉Libjpeg支持 下载地址:
http://www.ijg.org/files/jpegsrc.v6b.tar.gz libpng支持 下载地址:
http://jaist.dl.sourceforge.net/sour....2.8rc5.tar.gz 补丁:
http://www.linuxfromscratch.org/patc...per-libs.patch 先把支持库装好(LIBXML2,XSLT等)
LIBXML2
代码:
# tar zxvf libxml2-2.6.16.tar.gz
# cd libxml2-2.6.16/
# ./configure --prefix=/usr &&
make &&
make install
LIBXSLT
代码:
# tar zxvf libxslt-1.1.12.tar.gz
# cd libxslt-1.1.12/
# ./configure --prefix=/usr &&
make &&
make install
LIBJPEG
代码:
# tar zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b/
# ./configure --prefix=/usr &&
make &&
make install
LIBPNG
代码:
# tar zxvf libpng-1.2.8rc5.tar.gz
# cd libpng-1.2.8rc5/
# patch -Np1 -i ../libpng-1.2.5-link-to-proper-libs.patch
# ./configure --prefix=/usr &&
make &&
make install
现在把MySQL装上。
代码:
# groupadd mysql
# useradd -c mysql -d /dev/null -g mysql -s /bin/false mysql
# tar zxvf mysql-4.1.8a.tar.gz
# cd mysql-4.1.8a/
# patch -Np1 -i ../mysql-4.0.18-nptl-1.patch
# CC=gcc CFLAGS="-O3 -march=pentium4" \
CXX=gcc CXXFLAGS="-O3 -march=pentium4 -felide-constructors -fno-exceptions -fno-rtti" \
./configure --prefix=/usr --sysconfdir=/etc \
--libexecdir=/usr/sbin --localstatedir=/var/lib/mysql \
--enable-thread-safe-client --enable-local-infile \
--with-charset=ascii --with-extra-charsets=gb2312,utf8 \
--enable-assembler --without-debug --without-bench
# make testdir=/usr/lib/mysql/mysql-test &&
make testdir=/usr/lib/mysql/mysql-test install
# cd /usr/lib && ln -sf mysql/libmysqlclient{,_r}.so* .
配置一下MySQL。
代码:
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
# mysql_install_db 注:数据库初始化
# chown -R mysql:mysql /var/lib/mysql
# mysqld_safe --user=mysql 2>&1 >/dev/null & 注:启动MySQL服务器
# mysqladmin -u root password [new-password] 注:设置密码(可选)
# mysqladmin -p shutdown
接下来安装Apache。
代码:
# groupadd apache
# useradd -c apache -d /dev/null -g apache -s /bin/false apache
# tar jxvf httpd-2.0.52.tar.bz2
# cd httpd-2.0.52
# patch -Np1 -i ../httpd-2.0.49-config.patch 注:如果不打这个补丁,下面的--enable-layout=LFS就不行了。附件里也有个补丁,那是我做的。
# ./configure --enable-layout=LFS \
--enable-so --enable-mods-shared=all &&
# make && make install
注:设定一下apache的运行用户。
# sed -i -e "s%User nobody%User apache%" -e "s%^Group #-1%Group apache%" /etc/apache/httpd.conf
最后安装PHP。
代码:
# tar jxvf php-5.0.3.tar.bz2
# cd php-5.0.3
# ./configure --prefix=/usr --sysconfdir=/etc \
--with-apxs2 --with-config-file-path=/etc \
--with-libxml-dir=/usr --with-xsl \
--with-jpeg-dir=/usr --with-png-dir \
--enable-dba --with-openssl --with-regex=php \
--enable-bcmath --with-gnu-ld --with-tsrm-pthreads \
--with-zlib --with-bz2 --enable-ftp --with-gettext \
--with-mysql=/usr --with-mysqli=/usr/bin/mysql_config \
--enable-memory-limit --enable-zend-multibyte \
--with-db4=/usr \
--with-iconv --with-ncurses
# make && make install
# cp php.ini-recommended /etc/php.ini
完成后在/etc/apache/httpd.conf文件上添加如下一行:
代码:
AddType application/x-httpd-php .php .php5
至此,安装全部完成。如果你要将Apache和MySQL添加到自动启动列表中,有一个最简单的办法就是下载blfs-bootscripts-5.1
make install-apache
代码:
# make install-apache
# make install-mysql