centos6安装lamp
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的更多相关文章
- centos6 安装 lamp
首先更新一下yum -y update 安装Apache yum install httpd httpd-devel 安装完成后,用/etc/init.d/httpd start 启动apache 设 ...
- Ubuntu --- 【转】安装lamp(php7.0)
本篇转自:http://www.laozuo.org/8303.html.以防丢失,再次记录 PHP7已经出来有一段时间,根据网友的实践测试比之前的版本效率会高不少,而且应用到网站中打开速度会有明显的 ...
- CentOS6.3 编译安装LAMP(1):准备工作
卸载yum或rpm安装的amp软件 #在编译安装lamp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove htt ...
- 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 ...
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.4.6
Apache官方说: 与Apache 2.2.x相比,Apache 2.4.x提供了很多性能方面的提升,包括支持更大流量.更好地支持云计算.利用更少的内存处理更多的并发等.除此之外,还包括性能提升.内 ...
- 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 ...
- 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. ...
- 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. ...
- CentOS6.5下编译安装LAMP环境
LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架.该框架能够满足大流量.大并发量的网站需求:当然.也可以直接使用高性能的服务器.高性能的负载均衡硬件以及CDN ...
随机推荐
- 【题解】毒蛇越狱(FWT+容斥)
[题解]毒蛇越狱(FWT+容斥) 问了一下大家咋做也没听懂,按兵不动没去看题解,虽然已经晓得复杂度了....最后感觉也不难 用FWT_OR和FWT_AND做一半分别求出超集和和子集和,然后 枚举问号是 ...
- 【题解】歌唱王国(概率生成函数+KMP)+伦讲的求方差
[题解]歌唱王国(概率生成函数+KMP)+伦讲的求方差 生成函数的本质是什么呀!为什么和It-st一样神 设\(f_i\)表示填了\(i\)个时候停下来的概率,\(g_i\)是填了\(i\)个的时候不 ...
- $Poj1821\ Fence\ $单调队列优化$DP$
Poj Acwing Description 有N块木板等待被M个工匠粉刷,每块木板至多被刷一次.第i个工匠要么不粉刷,要么粉刷包含木块Si的,长度不超过Li的连续的一段木板,每粉刷一块可以得到P ...
- Codeforces Round #519 by Botan Investments(前五题题解)
开个新号打打codeforces(以前那号玩废了),结果就遇到了这么难一套.touristD题用了map,被卡掉了(其实是对cf的评测机过分自信),G题没过, 700多行代码,码力惊人.关键是这次to ...
- 1023 组个最小数 (20 分)C语言
给定数字 0-9 各若干个.你可以以任意顺序排列这些数字,但必须全部使用.目标是使得最后得到的数尽可能小(注意 0 不能做首位).例如:给定两个 0,两个 1,三个 5,一个 8,我们得到的最小的数就 ...
- 机器学习实战笔记(一)- 使用SciKit-Learn做回归分析
一.简介 这次学习的书籍主要是Hands-on Machine Learning with Scikit-Learn and TensorFlow(豆瓣:https://book.douban.com ...
- BFS小记
题目:求从S走到G点所需步数 #S######.#......#..#.#.##.##.#.#........##.##.####....#....#.#######.#....#......#### ...
- Java之Object类用法总结
Object类概述: 1.Object类是所有Java类的根父类. 2.如果在类的声明中未使用extends关键字指明其父类, 则默认父类为java.lang.Object类. Object类主要结构 ...
- DHCP服务器搭建
一.服务端安装配置 1.安装dhcp相关软件包 执行命令:yum install dhcp dhcp-devel -y #通过yum安装dhcp软件包 2.编辑配置dhcp的配置文件,文件路径:/et ...
- 书写markdown的利器
最近在用markdown记录一些东西,发现vscode本身对markdown的支持有点单薄,像一些数学公式是没办法及时预览的,而且也没有把markdown文件转换为html和pdf的功能,于是我从 ...