90jk 发表于 2014-11-27 08:50:37

centos6.5里用yum简单安装配置lamp

源码安装最后老是有点报错,还是yum简单,,,。。。。。

1 首先查看下系统是否已经安装了apache
# rpm -qa | grep httpd
httpd-tools-2.2.15-29.el6.centos.x86_64
httpd-2.2.15-29.el6.centos.x86_64
删除系统自带的。
# rpm -e --nodeps httpd-tools-2.2.15-29.el6.centos.x86_64
# rpm -e --nodeps httpd-2.2.15-29.el6.centos.x86_64

2 开始安装apache
# yum install httpd -y
安装完成以后用 /etc/init.d/httpd start 启动服务
最后设置开机自动启动apache
# chkconfig --levels 2345 httpd on

3 测试一下
此时的apache只提供HTTP服务,不能执行php,也不能连接MYSQL数据库
4 安装mysql

yum install mysql mysql-server mysql-devel -y

启动服务/etc/init.d/mysqld start
5 设置mysql密码
mysql> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
********
mysql> UPDATE user SET Password=PASSWORD('12345678') WHERE user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3Changed: 3Warnings: 0
**********
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

6 设置开机自动启动
# chkconfig --levels 2345 mysqld on

7 安装php
# yum install php -y
安装完成以后重新启动apache
/etc/init.d/httpd restart
这时,Apache已经可以解析执行php脚本了。由于Apache的默认网站根目录位于:/var/www/html/,因此在此目录建立一个info.php用来测试Apache+PHP的正确安装与否:
vim /var/www/html/info.php
里面编辑的内容如下

Apache+php test !         

9 然后测试 http://192.168.0.150/info.php

出现上图说明PHP和Apache已经正确安装
8 接下来安装MySQL数据库与其它模块(如GD图形库、mbstring库等):




yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc

安装完以后重新启动Apache
/etc/init.d/httpd restart

重新在浏览器中打开IP/info.php页面,应该能找到MySQL、GD、mbstring等模块





页: [1]
查看完整版本: centos6.5里用yum简单安装配置lamp