安装g++
yum -y install gcc-c++
1、安装libxml2
#cd /usr/local/src/libxml2-2.6.30
#./configure --prefix=/usr/local/libxml
#make && make install
2、安装libmcrypt
# cd /usr/local/src/libmcrypt-2.5.8
# ./configure --prefix=/usr/local/libmcrypt
#make && make install
3、安装zlib
# cd /usr/local/src/zlib-1.2.3
# ./configure --prefix=usr/local/zlib
# make && make install
4、安装libpng
# cd /usr/local/src/libpng-1.2.31出现错误
configure: error: zlib not installed
# make && make install
解决方案是:
1.进入zlib的源文件目录,执行命令 make clean,清除zlib;
2.重新配置 ./configure,后面不要接--prefix参数;
3.编辑 && 安装;(make && make install)
4.进入libpng目录,执行命令 ./configure --prefix=/usr/local/libpng;
5.编译 && 安装;
6.安装成功;
5、安装jpeg6
这个软件包安装有些特殊,其它软件包安装时如果目录不存在,会自动创建,但这个软件包安装时需要手动创建。
# mkdir /usr/local/jpeg6
6、安装freetype
# cd /usr/local/src/freetype-2.3.5
# ./configure --prefix=/usr/local/freetype
# make
# make install
7、安装autoconf
# cd /usr/local/src/autoconf-2.61
# ./configure
# make && make install
8、安装GD库
# cd /usr/local/src/gd-2.0.35
# ./configure \
--prefix=/usr/local/gd2/ \
--enable-m4_pattern_allow \
--with-zlib=/usr/local/zlib/ \
--with-jpeg=/usr/local/jpeg6/ \
--with-png=/usr/local/libpng/ \
--with-freetype=/usr/local/freetype/
# make
出现错误:
make[2]: *** [gd_png.lo] Error 1
make[2]: Leaving directory `/usr/local/src/gd-2.0.35'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/gd-2.0.35'
make: *** [all] Error 2
分析:这个问题是因为gd库中的gd_png.c这个源文件中包含png.h时,png.h没有找到导致的。
解决:
在编译文件里
# vi gd_png.c
将include “png.h” 改成 include “/usr/local/libpng/include/png.h”
其中/usr/local/libpng/为libpng安装路径。
# make install
9、安装Apache
# cd /usr/local/src/httpd-2.2.9#make && make install
#cd /usr/local/apache2/
#ls 12个
启动Apache
# /usr/local/apache2/bin/apachectl start
查看80端口是否开启
# netstat -tnl|grep 80
访问Apache服务器
在浏览器中输入http://localhost/页面中显示It works!证明安装成功。
添加开机自启动10、安装mysql
# cd /usr/local/src/httpd-2.2.9
./configure
--prefix=/usr/local/mysql
--with-extra-charset=all
checking for tgetent in -lncurses... no
checking for tgetent in -lcurses... no
checking for tgetent in -ltermcap... no
checking for tgetent in -ltinfo... no
checking for termcap functions library... configure: error: No curses/termcap library found
原因:缺少ncurses安装包
解决办法:
下载安装相应软件包
一、如果你的系统是RedHat系列:
yum list|grep ncurses
yum -y install ncurses-devel
yum install ncurses-devel
二、如果你的系统是Ubuntu或Debian:
apt-cache search ncurses
apt-get install libncurses5-dev
创建MySQL数据库服务器的配置文件
# cp support-files/my-medium.cnf /etc/my.cnf
用mysql用户创建授权表,创建成功后,会在/usr/local/mysql目录下生成一个var目录
# /usr/local/mysql/scripts目录下
用mysql用户创建授权表
#chown -R root .
# chown -R mysql var
# chgrp -R mysql.
启动mysql:
#/usr/local/mysql/bin/mysqld_safe --user=mysql&
没有密码可以直接登录本机服务器
# /usr/local/mysql/bin/mysql -u root
删除非localhost的主机
mysql> DELETE FROM mysql.user WHERE Host='localhost' AND User='';
刷新授权表
mysql> FLUSH PRIVILEGES;
为root用户添加密码
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Apple123');
退出客户端
mysql>exit
再次进入Mysql客户端
# /usr/local/mysql/bin/mysql -u root -h localhost -p
关闭MySQL数据库
# /usr/local/mysql/bin/mysqladmin -u root -p shutdown
11、安装PHP
# cd /usr/local/src/php-5.2.6
# ./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-libxml-dir=/usr/local/libxml2/ \
--with-png-dir=/usr/local/libpng/ \
--with-jpeg-dir=/usr/local/jpeg6/ \
--with-freetype-dir=/usr/local/freetype/ \
--with-gd=/usr/local/gd2/ \
--with-zlib-dir=/usr/local/zlib/ \
--with-mcrypt=/usr/local/libmcrypt/ \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-soap \
--enable-mbstring=all \
--enable-sockets
#make & make install
错误如下:
error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory
make[1]: *** [install-pear-installer] 错误 127
make: *** [install-pear] Error 2
============================================
再编译 生成 安装,一切正常。
创建配置文件
# cp php.ini-development /usr/local/php/etc/php.ini
使用vi编辑apache配置文件
# vi /etc/httpd/httpd.conf
12、安装phpMyAdmin
配置phpMyAdmin
$cfg['Servers'][$i]['auth_type'] = 'http';