加入收藏 | 设为首页 | 会员中心 | 我要投稿 百科站长网 (https://www.baikewang.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

CentOS安装\卸载 apache、mysql、php

发布时间:2022-09-21 15:29:50 所属栏目:MySql教程 来源:
导读:  使用命令安装:

  1.安装apache

  #yum -y install httpd

  2.安装mysql

  #yum -y install mysql

  #yum -y install mysql-server

  #yum -y install mysql-devel

  
  使用命令安装:
 
  1.安装apache
 
  #yum -y install httpd
 
  2.安装mysql
 
  #yum -y install mysql
 
  #yum -y install mysql-server
 
  #yum -y install mysql-devel
 
  #chkconfig --levels 235 mysqld on // 让mysql自启动
 
  3.安装php
 
  #yum -y install php
 
  #yum -y install php-devel
 
  /////////////////////////////////////
 
  使用源码编译安装:
 
  1.编译apache
 
  1)下载apache源码
 
  #apache24
 
  2)#./configure --prefix=/usr/local/apache --with-apr=/usr/local/arp --with-apr-util=/usr/local/apr-util
 
  提示:
 
  configure: error: APR not found. Please read the document.
 
  下载apr-1.5.2.tar.bz2:
 
  #tar xjfapr-1.5.2.tar.bz2 // 解压bz2格式
 
  #cd apr-1.5.2
 
  #./configure --prefix=/usr/local/apr
 
  #make && make install
 
  3)再次执行:
 
  #./configure --prefix=/usr/local/apache --with-apr=/usr/local/arp --with-apr-util=/usr/local/apr-util
 
  提示:apr-util未安装
 
  下载apr-util-1.5.4.tar.bz2:
 
  // 同上面的apr地址相同
 
  解压编译:
 
  #./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
 
  #make && make install
 
  4)再次执行:
 
  #./configure --prefix=/usr/local/apache --with-apr=/usr/local/arp --with-apr-util=/usr/local/apr-util
 
  提示:
 
  configure: error: pcre-config for libpcre not found. PCRE is required and available from
 
  下载pcre:
 
  #unzip -o pcre-8.10.zip // 如果没有,则 yum -y install unzip
 
  #cd pcre-8.10
 
  #./configure --prefix=/usr/local/pcre
 
  5)执行
 
  #./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
 
  #make && make install
 
  安装完毕。
 
  6)启动apache服务器:
 
  #/usr/local/apache2/bin/apachectl start
 
  7)使用浏览器访问 会显示页面。
 
  2.编译php源码
 
  1)下载php源码:
 
  2)
 
  #tar xjf php-5.6.10.tar.bz2 // 解压
 
  #cd php-5.6.10
 
  #执行
 
  ./configure
 
  --prefix=/usr/local/php
 
  --with-apxs2=/usr/local/apache2/bin/apxs
 
  --with-config-file-path=/usr/local/php/etc
 
  --with-jpeg-dir
 
  --with-png-dir
 
  -with-bz2
 
  --with-freetype-dir
 
  --with-iconv-dir
 
  --with-zlib-dir
 
  --enable-soap
 
  --enable-gd-native-ttf
 
  --enable-ftp
 
  --enable-sockets
 
  --enable-mbstring
 
  --enable-exif
 
  安装PHP时候出错:
 
  configure: error: xml2-config not found. Please check your libxml2 installation.
 
  yum -y install libxml2
 
  安装完仍然提示卸载mysql,xml2-config not found.原来是libxml2-devel 没装,可以执行以下命令:
 
  yum -y install libxml2*
 
  安装libxml2-devel.x86_64 0:2.7.6-17.el6_6.1
 
  错误2:
 
  configure: error: Please reinstall the BZip2 distribution
 
  yum -y install bzip2 bzip-devel
 
  如提示出错,一般为依赖库没找到,按提示安装对应的依赖库即可。
 
  附: PHP编译configure时常见错误:
 
  3)#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-jpeg-dir --with-png-dir -with-bz2 --with-freetype-dir --with-iconv-dir --with-zlib-dir --enable-soap --enable-gd-native-ttf --enable-ftp --enable-sockets --enable-mbstring --enable-exif
 
  #make && make install
 
  安装完毕。
 
  ///////////////////////////////////////
 
  卸载:
 
  1.卸载apache
 
  /etc/init.d/httpd stop // 停止httpd服务
 
  #rpm -qa | grep httpd
 

(编辑:百科站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!