zoukankan      html  css  js  c++  java
  • CentOS安装卸载 apache、mysql、php

    使用命令安装:

    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源码

    http://httpd.apache.org/download.cgi#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: 

    http://apr.apache.org/download.cgi

    #tar xjf apr-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:

    http://apr.apache.org/download.cgi // 同上面的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 http://pcre.org/

    下载pcre:
    http://sourceforge.net/projects/pcre/postdownload?source=dlp
    #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)使用浏览器访问 http://xxx.xxx.xx.xxx 会显示页面。

    2.编译php源码

    1)下载php源码:

    http://php.net/get/php-5.6.10.tar.bz2/from/a/mirror

    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
    安装完仍然提示,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时常见错误:
    http://blog.sina.com.cn/s/blog_75a07c3b0101kcwb.html

    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

    httpd-2.2.3-63.el5.centos.1

    httpd-manual-2.2.3-63.el5.centos.1

    2)卸载包

    rpm -e httpd-manual-2.2.3-63.el5.centos.1

    rpm -e system-config-httpd-1.3.3.3-1.el5

    或:

    rpm -e httpd

    提示存在依赖项:

    " error: Failed dependencies: httpd >= 2.2.0 is needed by (installed) gnome-user-share-0.10-6.el5.i386"

    #rpm -e gnome-user-share

    或者使用参数–nodeps不管各个程序包间的依赖关系

    #rpm -e –nodeps httpd //这样就不需要删除gnome-user-share了

    2.卸载php

    1)查看机器上安装的所有php相关的rpm包

    #rpm -qa | grep php

    php-cli-5.3.3-22.el6.x86_64

    php-pdo-5.3.3-22.el6.x86_64

    php-gd-5.3.3-22.el6.x86_64

    php-fpm-5.3.3-22.el6.x86_64

    php-common-5.3.3-22.el6.x86_64 

    php-5.3.3-22.el6.x86_64

    php-xml-5.3.3-22.el6.x86_64

    php-pear-1.9.4-4.el6.noarch

    2)按依赖顺序进行删除

    rpm -e php-fpm-5.3.3-22.el6.x86_64

    rpm-e php-pdo-5.3.3-22.el6.x86_64

    rpm -e php-pear-1.9.4-4.el6.noarch

    rpm-e php-cli-5.3.3-22.el6.x86_64

    rpm -e php-5.3.3-22.el6.x86_64

    rpm-e php-xml-5.3.3-22.el6.x86_64

    rpm -e php-gd-5.3.3-22.el6.x86_64

    rpm-e php-common-5.3.3-22.el6.x86_64

    3.卸载mysql

    1)查看系统中是否以rpm包安装的msyql:

    #rpm -qa | grep -i mysql

    MySQL-server-5.6.17-1.el6.i686
    MySQL-client-5.6.17-1.el6.i686

    2)卸载mysql

    #rpm -e MySQL-server-5.6.17-1.el6.i686

    #rpm -e MySQL-client-5.6.17-1.el6.i686

    3)删除msyqld服务

    #chkconfig --list | grep -i mysql

    #chkconfig --del mysql

    4)删除分散的mysql文件夹

    #whereis mysql

    #find / -name mysql

    mysql: /usr/lib/mysql /usr/share/mysql

    清空相关mysql的所有目录以及文件

    #rm -rf /usr/lib/mysql

    #rm -rf /usr/share/mysql

    #rm -rf /usr/my.cnf

  • 相关阅读:
    Django 标签过滤器
    Python短路原则
    python学习之路 八 :面向对象编程基础
    python学习之路 七 :生成器、迭代器
    python学习之路 六 :装饰器
    python学习之路 五:函数式编程
    python学习之路 四 :文件处理
    python学习之路 三:字符编码
    机器学习流程管理
    pyspark 自定义聚合函数 UDAF
  • 原文地址:https://www.cnblogs.com/sylar-liang/p/4579444.html
Copyright © 2011-2022 走看看