首页 > 代码库 > CentOS yum 安装 Apache + PHP + MySQL

CentOS yum 安装 Apache + PHP + MySQL

# 编写本地yum仓库

rm -rf /etc/yum.repos.d/*

cd /etc/yum.repos.d/

cat > local.repo <<end

[local]

name=qiqi

baseurl=file:///media/RHEL_6.1\ i386\ Disc\ 1/

enabled=1

gpgcheck=0

end

# 检查并卸载

rpm -qa|grep httpd

rpm -e httpd

rpm -qa|grep mysql

rpm -e mysql

rpm -qa|grep php

rpm -e php


# 删除默认的Apache

yum -y remove httpd


# 查找最快的源

yum -y install yum-fastestmirror


# 更新

yum -y update


# 安装必要的组件

yum -y install patch make gcc gcc-c++ gcc-g77 flex bison file

yum -y install libtool libtool-libs autoconf kernel-devel

yum -y install libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel

yum -y install freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel

yum -y install glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel

yum -y install ncurses ncurses-devel curl curl-devel e2fsprogs

yum -y install e2fsprogs-devel krb5 krb5-devel libidn libidn-devel

yum -y install openssl openssl-devel vim-minimal nano sendmail

yum -y install fonts-chinese gettext gettext-devel

yum -y install ncurses-devel

yum -y install gmp-devel pspell-devel

yum -y install unzip


# 安装Apache+MySQL+PHP

yum -y install httpd php mysql mysql-server php-mysql


# 启动httpd服务

/sbin/service httpd start


# 启动mysql服务

/sbin/service mysqld start


# 设置mysql数据库root帐号密码,引号内填密码

mysqladmin -u root password ‘123’


# 默认站点目录为/var/www/html/


# 安装apache扩展

yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

# 安装php的扩展

yum install php-gd

yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc

# 安装mysql扩展

yum -y install mysql-connector-odbcmysql-devel libdbi-dbd-mysql


本文出自 “My王企鹅” 博客,转载请与作者联系!

CentOS yum 安装 Apache + PHP + MySQL