Linux安装lamp

二、安装Lamp环境。

1.  安装apahce

yum install httpd

可能会用到的:

systemctl start httpd.service #启动apache

systemctl stop httpd.service #停止apache

systemctl restart httpd.service #重启apache

systemctl enable httpd.service #设置apache开机启动

  重启服务, systemctl restart httpd.service 

  输入localhost
  出现之后代表已经安装上去了。

CentOS 7.2 yum安装LAMP环境

  2. 安装mysql。

    由于yum源上没有mysql-server。所以必须去官网下载,这里 我们用wget命令,直接获取。    

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

# rpm -ivh mysql-community-release-el7-5.noarch.rpm

# yum install mysql-community-server

        安装完成后重启mysql,  systemctl restarat mysqld.service

   初入安装 root用户没有密码:    

[root@linuxidc-web linuxidc]# mysql -u root 


#设置msyql密码为 123456
mysql> set password for 'root'@'localhost' =password('123456');

#远程连接设置,所有以root账号连接的远程用户,设其密码为 123456
mysql> grant all privileges on *.* to root@'%'identified by '123456';

#更新权限
mysql>flush privileges; 

3.  安装php

yum install php

#安装PHP组件,使PHP支持mysql
yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash


#重启对应服务
systemctl restart mysqld.service
systemctl restart httpd.service

以上 安装 apahce 、mysql 、php  安装完毕。

查看安装环境版本:

cd  /var/www/html  ,新建index.php文件,输入:

<?php
    phpinfo();
           

最终查看为:php版本:

下面关于LAMP相关的内容你可能也喜欢

LAMP平台安装Xcache和Memcached加速网站运行  http://www.linuxidc.com/Linux/2015-06/118835.htm 

CentOS 7下搭建LAMP平台环境  http://www.linuxidc.com/Linux/2015-06/118818.htm

CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境 http://www.linuxidc.com/Linux/2014-12/111030.htm

Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境  http://www.linuxidc.com/Linux/2014-10/107924.htm

Ubuntu 14.10 下安装 LAMP 服务图文详解  http://www.linuxidc.com/Linux/2014-12/110082.htm

LAMP结合NFS构建小型博客站点  http://www.linuxidc.com/Linux/2015-08/121029.htm

CentOS7下安装部署LAMP环境  http://www.linuxidc.com/Linux/2016-04/130653.htm

Ubuntu 16.04搭建LAMP开发环境 http://www.linuxidc.com/Linux/2016-10/136327.htm

本文永久更新链接地址http://www.linuxidc.com/Linux/2016-11/136766.htm

linux

原文地址:https://www.cnblogs.com/lckblog/p/7426901.html