安装前准备

1、安装GD库

 

安装freeytpe

 

# tar zxvf freetype-2.4.3.tar.gz -C  /usr/local/src/

 

# cd  /usr/local/src/freetype-2.4.3 

 

# ./configure --prefix=/usr/local/freetype-2.4.3

 

# make

 

# make install

 

安装libpng

 

  #tar -zxvf libpng-1.4.4.tar.gz -C /usr/local/src/

 

# cd /usr/local/src/libpng-1.4.4

 

#./configure --prefix=/usr/local/libpng-1.4.4

 

# make 

 

# make install

 

安装jpeg

 

# tar -zxvf jpegsrc.v8b.tar.gz -C /usr/local/src/

 

# cd /usr/local/src/jpeg-8b/

 

# ./configure --prefix=/usr/local/jpeg-8b

 

# make

 

# make install

 

# ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static

 

注:在RHEL5系统64 位下编译jpeg-6b时候报以下错误

 

make: ./libtool: Command not found make: *** [jcapimin.lo] Error 127

 

错误分析:由于libtool版本过低导致的,进入jpeg-6b的源码目录,复制相关文件覆盖,然后重新configure。

 

cp /usr/share/libtool/config.sub .

 

cp /usr/share/libtool/config.guess .

 

安装GD

 

最好重新加载下lib  #ldcongfig

 

查询下 #ldconfig -p | grep jpeg

 

   #ldconfig -p | grep free

 

      #ldconfig -p | grep libpng

 

# tar zxvf gd-2.0.33.tar.gz -C /usr/local/src

 

# cd /usr/local/src/gd-2.0.33

 

# ./configure --prefix=/usr/local/gd-2.0.33 --with-jpeg=/usr/local/jpeg-8b --with-freetype=/usr/local/freetype-2.4.3 

 

--with-png=/usr/local/libpng-1.4.4/ --with-zlib --enable-m4_pattern_allow

 

#make  &&  make install

 

make[2]: *** [gd_png.lo] 错误 1

 

make[2]: Leaving directory `/usr/local/src/gd-2.0.33'

 

make[1]: *** [all-recursive] 错误 1

 

make[1]: Leaving directory `/usr/local/src/gd-2.0.33'

 

make: *** [all] 错误 2

 

解决办法

 

vi gd_png.c

 

找到“png.h”改成“/usr/local/libpng-1.4.4/include/png.h”

 

二、安装APACHE(配置源码包之前先安装GCC环境)

 

[root@localhost ~]# yum -y install *gcc*

 

[root@localhost~ ]# rpm -e httpd –nodeps //卸载系统自带的httpd这个包

 

[root@localhost ~]# cd /home/

 

[root@localhost home]# tar -zxvf httpd-2.2.15.tar.gz -C /usr/local/src/

 

[root@localhost home]# cd /usr/local/src/httpd-2.2.15/

 

[root@localhost httpd-2.2.15]# ./configure --prefix=/usr/local/apache-2.2.15

 

--enable-so

 

--enable-rewrite

 

[root@localhost httpd-2.2.15]# make && make install

 

配置基于域名的虚拟主机

 

[root@localhost bin]# vim /usr/local/apache-2.2.15/conf/httpd.conf 把388行前面的#号去掉

 

387 # Virtual hosts

 

388 Include conf/extra/httpd-vhosts.conf

 

[root@localhost bin]# vim /usr/local/apache-2.2.15/conf/extra/httpd-vhosts.conf 修改下面这样

 

 NameVirtualHost 192.168.0.10

 

 <VirtualHost 192.168.0.10>

 

 DocumentRoot "/www/cyazylinux"

 

 ServerName www.wwwlinuxcom

 

 </VirtualHost>

 

[root@localhost htdocs]# mkdir -p /www/wwwlinuxcom 

 

[root@localhost htdocs]# echo "www.crazylinux.com" >> /www/wwwlinuxcom /index.html

 

三 mysql 搭建

 

[root@localhost houzc]# wget http://mirrors.sohu.com/mysql/MySQL-5.0/mysql-5.0.89.tar.gz

 

[root@localhost houzc]# tar -zxvf mysql-5.0.89.tar.gz -C /usr/local/src/

 

[root@localhost houzc]# cd /usr/local/src/mysql-5.0.89/

 

[root@localhost mysql-5.0.89]# useradd mysql -M -s /sbin/nologin

 

[root@localhost mysql-5.0.89]#yum -y install libtermcap-devel

 

[root@localhostmysql-5.0.89]#./configure  --prefix=/usr/local/mysql-5.0.89/  

 

--with-unix-socket-path=/tmp/mysql.sock  --localstatedir=/usr/local/mysql-5.0.89/data \

 

--without-debug \              //去除debug模式

 

--enable-thread-safe-client \      //以线程方式编译客户端

 

--enable-assembler \            //使用一些字符函数的汇编版本

 

--enable-profiling \             //编译一个版本带有查询取样代码

 

--enable-community-features \    //停用附加功能提供的用户社区

 

--with-mysqld-ldflags=-all-static \  // 以纯静态方式编译服务端

 

--with-client-ldflags=-all-static \   // 以纯静态方式编译客户端

 

--with-charset=latin1 \           //默认编码拉丁文

 

--with-extra-charset=utf8,gbk \    //支持编码的格式

 

--with-innodb \                 //支持innodb表

 

--with-scv-storage-engine \        //使用SCV存储引擎

 

--with-mysqld-user=mysql \      //mysqld的守护进程用户

 

--without-embedded-server \      //构建嵌入式服务器

 

--with-server-suffix=-community  //附加价值版本的字符

 

[root@localhost mysql-5.0.89]# make

 

[root@localhost mysql-5.0.89]# make install

 

[root@localhost mysql-5.0.89]# ./scripts/mysql_install_db

 

[r
oot@localhost mysql-5.0.89]# cp support-files/my-medium.cnf /etc/my.cnf -fv

[root@localhost mysql-5.0.89]#chown -R root:mysql /usr/local/mysql-5.0.89/

 

[root@localhost mysql-5.0.89]# chown -R mysql.mysql /usr/local/mysql-5.0.89/data/

 

 [root@localhost mysql-5.0.89]# cd /usr/local/mysql-5.0.89/libexec/

 

[root@localhost libexec]# cp mysql mysql.old

 

[root@localhost libexec]# strip mysqld

 

[root@localhost libexec]# echo "/usr/local/mysql-5.0.89/lib/mysql/" >> /etc/ld.so.conf

 

[root@localhost libexec]# ldconfig

 

[root@localhost libexec]# /usr/local/mysql-5.0.89/bin/mysqld_safe &

 

[root@localhost libexec]#ps -ef | grep mysql 验证是否成功开启mysql

 

[root@localhost libexec]#/usr/local/mysql-5.0.89/bin/mysqladmin -u root password "youpassword"

 

[root@localhost libexec]#/usr/local/mysql-5.0.89/bin/mysql -u root -p

 

Enter password:  (输入youpassword密码)

 

mysql> show databases;

 

+--------------------+

 

| Database         

 

+--------------------+

 

| information_schema |

 

| mysql            |

 

| test              |

 

+--------------------+

3 rows in set (0.00 sec)
 

 

 

mysql> quit;

 

[root@localhost libexec]#vi /etc/rc.local

 

 /usr/local/mysql-5.0.89/bin/mysqld_safe &

 

//平滑关闭 mysqld :

 

[root@localhost data]# /usr/local/mysql-5.0.89/bin/mysqladmin -u root -p shutdown

 

Enter password:  (输入youpassword密码

 

这样mysql服务就装完了。

 

tar -zxvf php-5.2.10.tar.gz -C /usr/local/src/

 

cd /usr/local/src/php-5.2.10/

 

yum -y install *libxml2*

 

./configure --prefix=/usr/local/php-5.2.10/

 

--with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --with-libxml-dir--enable-gd-native-ttf --enable-mbstring

 

--with-gd=/usr/local/gd-2.0.33/ --with-mysql=/usr/local/mysql-5.0.89/--with-freetype-dir=/usr/local/freetype-2.4.3

 

--with-jpeg-dir=/usr/local/jpeg-8b/ --with-png-dir=/usr/local/libpng-1.4.4/

 

make &&make install

 

cp php.ini-development /usr/local/php-5.2.10/etc/php.ini

 

在APACHE 整合PHP

 

vim /usr/local/apache-2.2.15/conf/httpd.conf

 

53 LoadModule php5_module modules/libphp5.so

 

54 AddType application/x-httpd-php .php

 

167 <IfModule dir_module>

 

168 DirectoryIndex index.php index.html

 

169 </IfModule>

 

重启apache 就可