黑基网 首页 服务器 Linux 查看内容

Linux简单安装Mysql+Apach+PHP+phpMyAdmin

2011-8-10 11:14| 投稿: Linux

摘要:   Linux简单安装Red Hat Enterprise Linux Server release 5.3+Mysql+Apach+PHP  2011年08月05日 星期五 上午 09:00  网上...
  Linux简单安装Red Hat Enterprise Linux Server release 5.3+Mysql+Apach+PHP  2011年08月05日 星期五 上午 09:00  网上一朋友被Red Hat Enterprise Linux Server release 5.4+Mysql+Apach+PHP部署所困扰,这为朋友很有恒心,一直苦苦钻研。今天自己写了一个简单的安装步骤,给这位恒心网友一个思路,希望对你有所帮助! 一、安装环境检测【我以5.3为例,手边没有5.4】 [[email protected] tools]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.3 (Tikanga) [[email protected] tools]# uname -r 2.6.18-128.el5 [[email protected] 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 二、准备所需软件包 httpd-2.2.13.tar.gz  mysql-5.1.56.tar.gz  php-5.2.14.tar.gz  三、安装httpd-2.2.13.tar.gz tar zxvf httpd-2.2.13.tar.gz cd httpd-2.2.13 ./configure --prefix=/usr/local/apache2.2.13 \ --enable-deflate \ --enable-headers \ --enable-modules=so \ --enable-so \ --with-mpm=worker \ --enable-rewrite \ --enable-cgi \ --enable-file-cache \ --enable-cache \ --enable-disk-cache \ --enable-mem-cache make make install cd ../ 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 #---------------------------------------# 修改65行User daemon 为User apache 修改66行Group daemon 为Group apache #-------------------------------------------# 在309行下面添加如下两行 AddType application/x-httpd-php .php .php3 AddType application/x-httpd-php-source .phps #-------------------------------------------# 添加到开机启动项 echo '/usr/local/apache/bin/apachectl start ' >> /etc/rc.local 检查httpd.conf语法 /usr/local/apache/bin/apachectl –t 启动apache服务 /usr/local/apache/bin/apachectl start 检查服务 [[email protected] 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 [[email protected] tools]# netstat -lnt |grep 80 tcp        0      0 :::80                       :::*                        LISTEN  打开浏览器进行测试 说明apache安装成功 FAQ:当你遇到如下错误 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. 解决办法:yum install gcc* #========================================================================# 添加测试首页 echo -e "<?php phpinfo(); ?>" >/usr/local/apache/htdocs/index.php   #============================# #=================安装mysql-5.1.56.tar.gz ===============================# groupadd mysql useradd -s /sbin/nologin -g mysql -M mysql           tar zxvf mysql-5.1.56.tar.gz cd mysql-5.1.56 ./configure --prefix=/usr/local/mysql/ \ --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \ --localstatedir=/usr/local/mysql/data \ --with-extra-charsets=all make make install cd ../ /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 source /etc/profile  cp support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld chkconfig --add mysqld service mysqld restart mysql -uroot -p #-----------------------------------------------# FAQ: checking for tgetent in -ltinfo... no checking for termcap functions library... configure: error: No curses/termcap library found 解决办法: 解决办法: 下载安装相应软件包 一、如果你的系统是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   待安装completed!之后,再./configure,顺利通过,然后make && make install,成功安装,一切OK!~~~   #===============================================#     三、安装php (php-5.1.6.tar.bz2) #######libiconv库########################### tar -zxvf libiconv-1.10.tar.tar cd libiconv-1.10 ./configure --prefix=/usr/local/libiconv make make install cd ../ ########################################### tar -zxvf php-5.2.14.tar.gz cd php-5.2.14 ./configure \ --prefix=/usr/local/php \ --with-apxs2=/application/apache/bin/apxs \ --with-mysql=/usr/local/mysql \ --with-ttf \ --with-xmlrpc \ --with-openssl \ --with-zlib \ --with-freetype-dir \ --with-gd \ --with-jpeg-dir \ --with-png-dir \ --with-iconv=/usr/local/libiconv \ --enable-short-tags \ --enable-sockets \ --enable-zend-multibyte \ --enable-soap \ --enable-mbstring \ --enable-static \ --enable-gd-native-ttf \ --with-curl make make install cp php.ini-recommended /usr/local/php/lib/php.ini /application/apache/bin/apachectl restart cd ../ #-----------------------------------------------------------------------# FAQ: 问题1、checking libxml2 install dir... no checking for xml2-config path... configure: error: xml2-config not found. Please check your libxml2 installation. 解决办法: yum install libxml2* 问题2、configure: error: Cannot find OpenSSL's <evp.h> 解决办法: Yum install openssl* 问题3、configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/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. yum install libpng-devel 为避免以上问题的出现,在开始安装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时报错,耽误时间。 #=======================================================================# 至此,一份简单lamp环境安装部署完毕。
小编推荐:欲学习电脑技术、系统维护、网络管理、编程开发和安全攻防等高端IT技术,请 点击这里 注册黑基账号,公开课频道价值万元IT培训教程免费学,让您少走弯路、事半功倍,好工作升职加薪!



免责声明:本文由投稿者转载自互联网,版权归原作者所有,文中所述不代表本站观点,若有侵权或转载等不当之处请联系我们处理,让我们一起为维护良好的互联网秩序而努力!联系方式见网站首页右下角。


鲜花

握手

雷人

路过

鸡蛋

相关阅读

最新评论


新出炉

返回顶部