Linux简单安装Red Hat Enterprise Linux Server release 5.3+Mysql+Apach+PHP
网上一朋友被Red Hat Enterprise Linux Server release 5.4+Mysql+Apach+PHP部署所困扰,这为朋友很有恒心,一直苦苦钻研。今天自己写了一个简单的安装步骤,给这位恒心网友一个思路,希望对你有所帮助!
一、安装环境检测【我以5.3为例,手边没有5.4】
[root@localhost tools]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
[root@localhost tools]# uname -r
[root@localhost tools]# uname -a
Linux localhost 2.6.18-128.el5 #1 SMP Wed Jan 21 08:45:05 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
tar zxvf httpd-2.2.13.tar.gz
./configure --prefix=/usr/local/apache2.2.13 \
ln -s /usr/local/apache2.2.13 /usr/local/apache
useradd apache -M -s /sbin/nologin
打开/application/apache/conf/httpd.conf
#--------------------------------------#
修改:#ServerName www.example.com:80
为 ServerName 127.0.0.1:80
#--------------------------------------#
修改166行DirectoryIndex index.html
为DirectoryIndex index.php index.html
#---------------------------------------#
#-------------------------------------------#
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
#-------------------------------------------#
echo '/usr/local/apache/bin/apachectl start ' >> /etc/rc.local
/usr/local/apache/bin/apachectl –t
/usr/local/apache/bin/apachectl start
[root@localhost tools]# ps -ef |grep -v grep |grep httpd
root 10693 1 0 02:43 ? 00:00:00 /usr/local/apache2.2.13/bin/httpd -k start
apache 10694 10693 0 02:43 ? 00:00:00 /usr/local/apache2.2.13/bin/httpd -k start
apache 10695 10693 0 02:43 ? 00:00:00 /usr/local/apache2.2.13/bin/httpd -k start
apache 10697 10693 0 02:43 ? 00:00:00 /usr/local/apache2.2.13/bin/httpd -k start
apache 10699 10693 0 02:43 ? 00:00:00 /usr/local/apache2.2.13/bin/httpd -k start
[root@localhost tools]# netstat -lnt |grep 80
tcp 0 0 :::80 :::* LISTEN
configure:3699: checking for cl.exe
configure:3729: result: no
configure:3753: error: in `/usr/local/src/tools/httpd-2.2.13/srclib/apr':
configure:3756: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
#========================================================================#
echo -e "" >/usr/local/apache/htdocs/index.php
#============================#
#=================安装mysql-5.1.56.tar.gz ===============================#
useradd -s /sbin/nologin -g mysql -M mysql
tar zxvf mysql-5.1.56.tar.gz
./configure --prefix=/usr/local/mysql/ \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--localstatedir=/usr/local/mysql/data \
--with-extra-charsets=all
/bin/cp support-files/my-small.cnf /etc/my.cnf
mkdir -p /usr/local/mysql/data
/usr/local/mysql/bin/mysql_install_db --user=mysql
chgrp -R mysql /usr/local/mysql
cp support-files/mysql.server /usr/local/mysql/bin/
chmod 700 /usr/local/mysql/bin/mysql.server
/usr/local/mysql/bin/mysql.server start
echo "export PATH=$PATH:/usr/local/mysql/bin/" >>/etc/profile
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
#-----------------------------------------------#
checking for tgetent in -ltinfo... no
checking for termcap functions library... configure: error: No curses/termcap library found
yum -y install ncurses-devel
yum install ncurses-devel
apt-get install libncurses5-dev
待安装completed!之后,再./configure,顺利通过,然后make && make install,成功安装,一切OK!~~~
#===============================================#
三、安装php (php-5.1.6.tar.bz2)
#######libiconv库###########################
tar -zxvf libiconv-1.10.tar.tar
./configure --prefix=/usr/local/libiconv
###########################################
tar -zxvf php-5.2.14.tar.gz
--prefix=/usr/local/php \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-iconv=/usr/local/libiconv \
--enable-zend-multibyte \
cp php.ini-recommended /usr/local/php/lib/php.ini
/application/apache/bin/apachectl restart
#-----------------------------------------------------------------------#
问题1、checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
问题2、configure: error: Cannot find OpenSSL's
问题3、configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
yum -y install curl-devels
问题4、checking for floorf... yes
configure: error: libjpeg.(a|so) not found.
yum install libjpeg-devel
问题5、checking for jpeg_read_header in -ljpeg... yes
configure: error: libpng.(a|so) not found.
为避免以上问题的出现,在开始安装php之前,可以先对系统检查,
rpm -qa zlib libxml libjpeg freetype libpng gd curl libiconv
zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel
看以上包包是否安装,如果没有就提前安装,免的./configure时报错,耽误时间。
#=======================================================================#
|