由于这里采用yum方式安装,前提是我们必须配置好yum源。为了加快下载速度,建议使用网易的yum源。

这种方式对于初学者来说,非常方便,但是可定制性不强,而且软件版本较低。一般用于实验和学习环境。

1、安装Apache

[root@localhost ~]# yum -y install httpd

# 开机自启动

[root@localhost ~]# chkconfig httpd on

# 启动httpd 服务

[root@localhost ~]# service httpd start

### 安装apache 一些扩展

root@localhost ~]# yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql

现在直接在浏览器键入http://localhost  或 http://本机IP  ,应该会看到Apache的测试页面

这里需要注意iptables的设置哦。

2、安装配置MySQL

# mysql          客户端程序

# mysql-server    服务端程序

# mysql-devel    开发设计的库

[root@localhost ~]# yum -y install mysql mysql-server mysql-devel

# 开机启动

[root@localhost ~]# chkconfig mysqld on

# 启动mysqld服务

[root@localhost ~]# service mysqld start

# 进行一些安全性配置

[root@localhost ~]# /usr/bin/mysql_secure_installation

[root@localhost ~]# netstat -tulpn | grep -i mysql

tcp        0      0 0.0.0.0:3306          0.0.0.0:*          LISTEN      1723/mysqld

OK, 我们看到mysqld已经启动,监听在3306端口上。

3、安装php

安装相关模块:为了让PHP支持MySQL,我们可以安装php-mysql软件包;也可使用以下命令搜索可用的php模块

[root@localhost ~]# yum -y install php php-mysql

# 安装php常用扩展

[root@localhost ~]# yum search php

[root@localhost ~]# yum -y install gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap

### 重启httpd服务,这一步很重要

[root@localhost ~]# service httpd restart

然后,我们提供php页面,测试

[root@localhost ~]# cd /var/www/html/

[root@localhost html]# vi index.php

<?php

phpinfo();

?>

然后,我们再次在浏览器键入http://localhost  或 http://本机IP  ,应该会看到如下页面

4、安装配置phpMyAdmin

安装好MySQL,Apache及PHP后,为了可视化的管理MySQL数据库,我们可以安装phpMyAdmin。到其官网下载最新版本:http://www.phpmyadmin.net/home_page/

在Windows下,其实Navicat也是一个非常好用的MySQL可视化工具,推荐使用。

[root@localhost ~]# unzip phpMyAdmin-4.2.6-all-languages.zip

[root@localhost ~]# mv phpMyAdmin-4.2.6-all-languages /var/www/html/phpmyadmin

[root@localhost ~]# cd /var/www/html/phpmyadmin

[root@localhost ~]# cp libraries/config.default.php config.inc.php

[root@localhost ~]# vi cnfig.inc.php

$cfg['PmaAbsoluteUri'] = '';这里填写 phpMyAdmin 的访问网址。

$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address

$cfg['Servers'][$i]['port'] = ''; // MySQL port - leave blank for default port

$cfg['Servers'][$i]['user'] = 'root'; // 填写 MySQL 访问 phpMyAdmin 使用的 MySQL 用户名,默认为 root。

fg['Servers'][$i]['password'] = ''; // 填写对应上述 MySQL 用户名的密码。

# 然后重启,httpd服务

[root@localhost ~]# service httpd restart

在浏览器键入http://localhost/phpmyadmin 即可访问。

如果遇到访问权限的问题, 请检查SElinux。

CentOS 6.5使用yum快速搭建LAMP环境的更多相关文章

  1. redhat利用yum快速搭建LAMP环境

    LAMP LAMP环境,对于PHP开发及其开源的PHP项目的部署都很关键的. LAMP的含义: L   ---Linux A  ---Apache   web M ---Mysql     datab ...

  2. CentOS 7使用yum快速搭建LAMP环境

    1.安装Apache [root@localhost ~]# yum -y install httpd # 开机自启动 [root@localhost ~]# chkconfig httpd on # ...

  3. CentOS6.5使用yum快速搭建LAMP环境

    1.安装Apache # yum -y install httpd # 开机自启动 # chkconfig httpd on # 启动httpd 服务 # service httpd start # ...

  4. Centos6 使用yum快速搭建LAMP环境

      1.安装Apache [root@localhost ~]# yum -y install httpd # 开机自启动 [root@localhost ~]# chkconfig httpd on ...

  5. 如何《快速搭建LAMP环境》

    阿里云体验平台简介 阿里云开发者实验室提供免费云资源和丰富的场景化实践,旨在帮助开发者在学习应用技术,了解阿里云产品的特性. 教程介绍 本教程引用自阿里云体验实验室介绍如何快速搭建Docker环境,并 ...

  6. CentOS 6.5 下源码搭建LAMP环境

    参考网站: http://wenku.baidu.com/link?url=Cvkqss2E9mnxXOZigMWPaCfqwsBxnm0sZ4aKE2oLAgQ888XxeC0DWOChxVqiHz ...

  7. 用yum快速搭建LAMP平台

    实验环境: [root@nmserver-7 html]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@nms ...

  8. 通过yum命令搭建lamp环境(centos6.5)

    centos 6.5 1.yum安装和源代码编译在使用的时候没啥区别,但是安装的过程就大相径庭了,yum只需要3个命令就可以完成,源代码需要13个包,还得加压编译,步骤很麻烦,而且当做有时候会出错,源 ...

  9. CentOS快速搭建LAMP环境

    LAMP --  Linux Apache MySQL PHP 在CentOS安装的顺序,我一般是Apache -> MySQL -> PHP 第一步.安装并配置Apache 1.使用yu ...

随机推荐

  1. Java中一种无意识的递归

    来自: Java编程思想P287 public class Main { /** * @param args */ @Override public String toString() { retur ...

  2. rospy 中service

    Server部分: #!/usr/bin/env python import sys import os import rospy #from beginner.srv import * from b ...

  3. 探秘AOP实现原理

    可以这么说,AOP是基于动态代理实现的. 那么,这个过程是怎样的? 首先,我们有这样的一个Service类,它是被作为切面的一个类: public class Service implements U ...

  4. C语言位域解析&符号位扩展规则

    从一个例子说起: int main(void){ union{ int i; struct{ ; ; ; }bits; }num; printf("Input an integer for ...

  5. ubuntu server 无线网卡的处理

    1) iwconfig 确定一下接口的名称 2) 编辑 /etc/network/interfaces 加入下面的代码 auto wlan0 iface wlan0 inet dhcp wpa-ssi ...

  6. "is not allowed to connect" mysql

    好像过几次,安装mysql时,总会遇到这个问题. 每次都忘怎么解决. 这回写下来吧. 编辑 mysql数据库的 user表太麻烦了, 最简单的方法是加一个用户,以后就用这个用户登录 CREATE US ...

  7. initctl 创建自己的JOB

    我们的项目需要一个启动一个外部的Jetty server.发现每次kill了这个jetty的进程后,系统会自动启动一个jetty.追查下去发现,原来是在/etc/init.d/jetty 脚本的sta ...

  8. every day a practice —— morning

    In 25 years, Panda Express has transformed from a single restaurant in a southern California mall to ...

  9. mate桌面xrdp无法登陆问题

    vi /usr/libexec/xrdp/startwm.sh 或者/etc/xrdp/startwm.sh: 找到相应的发行版本,增加mate-session如下所示: # el  if [ -r ...

  10. 41 MYSQL 索引和慢查询优化

    一 .索引mysql 索引 b+tree 本质:通过不断地缩小想要获取数据的范围来筛选出最终想要的结果,同时把随机的事件变成顺序的事件,也就是说,有了这种索引机制,我们可以总是用同一种查找方式来锁定数 ...