1、安装Apache

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

设置开启自启动

[root@localhost ~]# chkconfig httpd on

启动httpd服务

[root@localhost ~]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
[ OK ]

测试:如果是远程访问的话,需要在服务器上放行80端口

2.安装Mysql

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

#开机自启动

[root@localhost ~]# chkconfig mysqld on

#启动mysqld服务

[root@localhost ~]# service mysqld start

[root@localhost ~]# service mysqld status
mysqld (pid ) is running...

设置密码:

[root@localhost ~]#  /usr/bin/mysql_secure_installation
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success! By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment. Remove anonymous users? [Y/n] Y
... Success! Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y
... Success! By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment. Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success! Reloading the privilege tables will ensure that all changes made so far
will take effect immediately. Reload privilege tables now? [Y/n] Y
... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

查看监听的端口

[root@localhost ~]# netstat -tulpn | grep -i mysql
tcp 0.0.0.0: 0.0.0.0:* LISTEN /mysqld

可以看到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
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
[ OK ]

测试php

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

[root@localhost html]# vim index.php

<?php

    phpinfo();

?>

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

查看版本:

php版本:

[root@localhost html]# php -v
PHP 5.3. (cli) (built: Mar ::)
Copyright (c) - The PHP Group
Zend Engine v2.3.0, Copyright (c) - Zend Technologies

mysql版本

[root@localhost html]# mysql -V
mysql Ver 14.14 Distrib 5.1., for redhat-linux-gnu (x86_64) using readline 5.1

apache版本:

[root@localhost html]# apachectl -v
Server version: Apache/2.2. (Unix)
Server built: Oct ::38 或者:
[root@localhost html]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Oct 19 2017 16:43:38

http://www.linuxidc.com/Linux/2014-07/104563.htm

centos6安装lamp的更多相关文章

  1. centos6 安装 lamp

    首先更新一下yum -y update 安装Apache yum install httpd httpd-devel 安装完成后,用/etc/init.d/httpd start 启动apache 设 ...

  2. Ubuntu --- 【转】安装lamp(php7.0)

    本篇转自:http://www.laozuo.org/8303.html.以防丢失,再次记录 PHP7已经出来有一段时间,根据网友的实践测试比之前的版本效率会高不少,而且应用到网站中打开速度会有明显的 ...

  3. CentOS6.3 编译安装LAMP(1):准备工作

    卸载yum或rpm安装的amp软件 #在编译安装lamp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove htt ...

  4. CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25

    所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src ...

  5. CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6

    Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...

  6. CentOS6.3 编译安装LAMP(3):编译安装 MySQL5.5.25

    所需源码包: /usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz /usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.g ...

  7. CentOS6.3 编译安装LAMP(4):编译安装 PHP5.2.17

    所需源码包: /usr/local/src/PHP-5.2.17/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.2.17/mhash-0.9.9.9.tar. ...

  8. CentOS6.3 编译安装LAMP(4):编译安装 PHP5.3.27

    所需源码包: /usr/local/src/PHP-5.3.27/libmcrypt-2.5.8.tar.gz /usr/local/src/PHP-5.3.27/mhash-0.9.9.9.tar. ...

  9. CentOS6.5下编译安装LAMP环境

    LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架.该框架能够满足大流量.大并发量的网站需求:当然.也可以直接使用高性能的服务器.高性能的负载均衡硬件以及CDN ...

随机推荐

  1. 【简要题解】Hihocoder 重复旋律1-9简要题解

    [简要题解]Hihocoder 重复旋律1-8简要题解 编号 名称标签 难度 1403 后缀数组一·重复旋律 Lv.4 1407 后缀数组二·重复旋律2 Lv.4 1415 后缀数组三·重复旋律3 L ...

  2. $[NOIp2008]$双栈排序 栈/二分图/贪心

    \(Sol\) 先考虑单栈排序,怎么样的序列可以单栈排序呢?设\(a_i\)表示位置\(i\)是哪个数.\(\exist i<j<k\),都没有\(a_k<a_i<a_j\), ...

  3. js中的事件冒泡

    事件冒泡和阻止事件冒泡: 事件冒泡的原理:从实际操作的元素(事件)向上级父元素一级一级执行下去,直到达到document/window,冒泡过程结束.例如:假设我有一个 div 盒子,里面嵌套了1个子 ...

  4. 傅立叶变换—DFT

    背景:最近看到实验室其他同学在用傅立叶变换解决问题,我也想通过并行来解决这个问题,所以看了一下傅立叶变换的东西,感觉涵盖的东西还能多,我只是初步做了一下了解(一定很片面,但是我主要是为了应用它,主要了 ...

  5. C++ 模板常见特性(函数模板、类模板)

    背景 C++ 是很强大,有各种特性来提高代码的可重用性,有助于减少开发的代码量和工作量. C++ 提高代码的可重用性主要有两方面: 继承 模板 继承的特性我已在前面篇章写过了,本篇主要是说明「模板」的 ...

  6. SpringBoot 2.x 开发案例之 Shiro 整合 Redis

    前言 前段时间做了一个图床的小项目,安全框架使用的是Shiro.为了使用户7x24小时访问,决定把项目由单机升级为集群部署架构.但是安全框架shiro只有单机存储的SessionDao,尽管Shrio ...

  7. Flutter使用SingleTickerProviderStateMixin报错

    最近在学习开发Flutter应用项目,在创建tabbar和tabview后,进行网络请求后显示顶部tab标签,设置TabController,并使class类实现SingleTickerProvide ...

  8. BFC 是什么东西?

    以下是本人理解的 BFC  和 官方文档BFC资料 . BFC 是页面元素的隐藏属性,全称 : Block Formatting Context 作用: 可以清除子元素浮动后不良效果在线效果地址:ht ...

  9. Ubuntu18.04 一次性升级Python所有库

    pip是什么 pip 是 Python 包管理工具,该工具提供了对Python 包的查找.下载.安装.卸载的功能. 升级pip版本 默认Ubuntu自带的pip (pip 9.0.1)是基于Pytho ...

  10. minikube 设置CPU和内存

    安装minikube之后,第一次sudo minikube start 时,设置参数--cpus int  --memory int . 如果需要更改设置,需要将缓存文件$HOME/.minikube ...