CentOS 7.0 yum安装Apache + PHP + MySQL

1. 安装Apache, PHP, MySQL以及php连接mysql库组件。

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

 2. 安装apache扩展

yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

 3. 安装php的扩展

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

 4. 安装MySQL的扩展

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

 5. 配置开机启动服务

#/sbin/chkconfig httpd on             [设置apache服务器httpd服务开机启动]
#/sbin/service httpd start            [启动httpd服务,与开机启动无关]
#/sbin/service mysqld start           [启动mysqld服务,与开机启动无关]

apache的配置文件是/etc/httpd/conf下
modules放在/usr/lib/httpd下
php的配置文件在/etc/php.d/下 和/etc/php.ini
php的modules放在/usr/lib/php/modules下

6. 绑定域名

在/etc/httpd/conf/httpd.conf配置文件中,提供了范例:

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

所以绑定域名可以跟着提供的范例来配置即可。

说明:

MySQL默认安装的后,root密码为空.

Author: jhonse

Jhonse技术博客: http://blog.jhonse.com

Leave a Reply

Your email address will not be published. Required fields are marked *