centos 64bit 搭建lamp

相关软件下载:

httpd                          http://httpd.apache.org/

mysql                          http://dev.mysql.com/downloads/

php                            http://www.php.net/downloads.php

libxml2                        ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/

libmcrypt                     http://prdownloads.sourceforge.net/mcrypt/

zlib                          http://www.zlib.net/

gd                             http://www.libgd.org/releases

Autoconf                       ftp://ftp.gnu.org/gnu/autoconf

freetype                      http://download.savannah.gnu.org/releases/freetype/

libpng                       ftp://ftp.simplesystems.org/pub/libpng/png/src

jpegsrc                         http://www.ijg.org/files/


yum -y   install gcc gcc-c++   ncurses ncurses-devel bison openssl openssl-devel

rpm -e mysql --nodepts
rpm -e httpd --nodepts

cd /usr/local/src

tar -zxvf  cmake-2.8.4.tar.gz

cd cmake

./configure   && gmake && gmake install


cd /usr/local/src

tar -zxvf  autoconf-2.68.tar.gz

cd autoconf-2.68

./configure   && make && make install



cd /usr/local/src

tar -zxvf zlib-1.2.3.tar.gz

cd zlib-1.2.3
vim MakeFile (修改CFLAGS)
CFLAGS=-O3 -fPIC -DUSE_MMAP   (要看到编译有-fPIC参数)

./configure --prefix=/usr/local/zlib 

make

make install













cd /usr/local/src

tar -zxvf libxml2-2.7.7.tar.gz

cd libxml2-2.7.7

./configure --prefix=/usr/local/libxml2     --with-zlib=/usr/local/zlib

make && make install







cd /usr/local/src

tar -zxvf libpng-1.5.1.tar.gz

cd libpng-1.5.1

export LDFLAGS=-L$ROOTFS_DIR/usr/local/zlib/lib

export CFLAGS=-I$ROOTFS_DIR/usr/local/zlib/include

./configure --prefix=/usr/local/libpng   --with-zlib-prefix=/usr/local/zlib/

make && make install



cd /usr/local/src

tar -zxvf freetype-2.4.1.tar.gz

cd freetype-2.4.1

./configure --prefix=/usr/local/freetype  --with-zlib=/usr/local/zlib

make && make install

cd /usr/local/src

tar -zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

./configure --prefix=/usr/local/libmcrypt  

make && make install



cd /usr/local/src

tar -zxvf  curl-7.21.4.tar.gz

cd  curl-7.21.4

./configure --prefix=/usr/local/curl   --with-zlib=/usr/local/zlib

make && make install



cd /usr/local/src

tar -zxvf jpegsrc.v8c.tar.gz

cd jpeg-8c/

./configure --prefix=/usr/local/jpeg8/  --enable-shared --enable-static

make && make install







cd /usr/local/src

tar -zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

vim gd_png.c







./configure --prefix=/usr/local/gd2/ --with-zlib=/usr/local/zlib/ --with-jpeg=/usr/local/jpeg8/ --with-png=/usr/local/libpng/ --with-freetype=/usr/local/freetype/




修改gd2中的源代码:

#include "png.h" 为:

#include "/usr/local/libpng/include/png.h"

make && make install


/********************************apache*******************************************************/

cd /usr/local/src

tar -zxvf httpd-2.2.17.tar.gz

cd httpd-2.2.17

./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-z=/usr/local/zlib/ --with-included-apr --with-mpm=prefork --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support  --enable-cache   --enable-disk-cache     --enable-mem-cache  --enable-file-cache   --enable-cgi

make && make install


echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local 
/*********************************mysql*******************************************************/



cd /usr/local/src

tar -zxvf mysql-5.5.10.tar.gz

cd mysql-5.5.10



cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1



gmake  && gmake install



useradd -M -r --shell /sbin/nologin --home-dir /usr/local/mysql mysql



chown -R mysql:mysql /usr/local/mysql

cd /usr/local/mysql/scripts/

./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql


/usr/local/mysql/bin/mysqld_safe --user=mysql &






#需修改/usr/local/mysql/support-files/mysql.server中的basedir和datadir

vim /usr/local/mysql/support-files/mysql.server

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data





#需修改/usr/local/mysql/support-files/my-huge.cnf
vim /usr/local/mysql/support-files/my-huge.cnf

增加以下内容

[mysqld]

character-set-server = utf8

collation_server = utf8_unicode_ci

cp  /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld


chmod 755 /etc/init.d/mysqld

#添加服务

chkconfig --add mysqld

#指定服务级别

chkconfig --level 2345 mysqld on    

/*********************************php*******************************************************/



cd /usr/local/src

tar -zxvf php-5.3.5.tar.gz

cd php-5.3.5



./configure  --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-libxml-dir=/usr/local/libxml2/ --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg8/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-zlib-dir=/usr/local/zlib/ --with-mcrypt=/usr/local/libmcrypt/ --with-curl=/usr/local/curl/  --enable-soap --enable-mbstring=all --enable-sockets

cp /usr/local/src/php-5.3.5/php.ini-development /usr/local/php/etc/php.ini

vi /etc/httpd/httpd.conf     //使用vi编辑apache配置文件

Addtype application/x-httpd-php .php .phtml    #添加这一条



猜你喜欢

转载自xiaoyangok.iteye.com/blog/970959