1. 使用的例子:服务器版本内核centos 7.04

     
  2.  

    Xshell连接到您的服务器上,使系统处于最新状态执行以下命令,

    yum update -y

     
  3.  

    利用yum命令安装Apache执行命令,

    yum -y install httpd

     
     
  4.  

    启动httpd并且设置为它开机启动,

    systemctl start httpd    【启动httpd命令】

    systemctl enable httpd 【设置httpd开机启动】

     
  5.  

    我们这里可通过俩个命令查看是否启动和开机启动;

    systemctl status httpd      【查看是否启动命令】

    systemctl is-enabled httpd 【查看是否开机启动(输出enabled已经成功)】

     
  6.  

    注意:后续检查数据库的方法也是大同小异作不在详细解释。

  7.  

    安装成功后,在浏览器地址栏输入你的服务器IP地址出现下图说明你的httpd已经成功安装,例如我这里:39.104.82.85

     
  8.  

    安装数据库Mariadb它是MySQL的一个分支几乎兼容mysql所有功能,执行下面命令;

    yum -y install mariadb-server mariadb

     
     
  9.  

    启动mariadb并且设置为它开机启动;检查是否启动和开机启动

    systemctl start mariadb

    systemctl enable mariadb

    systemctl status mariadb

    systemctl is-enabled mariadb

     
     
  10.  

    下面配置root密码和数据库的一些安全;执行命令,

    mysql_secure_installation

  11.  

    #将会输出让输入原始密码(这里默认为空密码请直接回车Enter),

    In order to log into MariaDB to secure it, we'll need the current

    password for the root user.  If you've just installed MariaDB, and

    you haven't set the root password yet, the password will be blank,

    so you should just press enter here.

    Enter current password for root (enter for none):

    #这里询问我们是否设置root密码,输入y设置密码,y(设置);  n(不设置)

    Setting the root password ensures that nobody can log into the MariaDB

    root user without the proper authorisation.

    Set root password? [Y/n]

    #输入密码再次确认密码回车

    Set root password? [Y/n] y

    New password:

    Re-enter new password:

    Password updated successfully!

    Reloading privilege tables..

    ... Success!

    By default, a MariaDB installation has an anonymous user, allowing anyone

    to log into MariaDB 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  (询问是否移除匿名用户输入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]  n(询问是否禁止远程root登陆我这里选择y禁止远程登录【如果您需要远程登录连接数据库可选择n】)

    ... skipping.

    By default, MariaDB 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(询问是否删除测试数据库【可选项随意y或n】这里我选择y)

    Reloading the privilege tables will ensure that all changes made so far

    will take effect immediately.

    Reload privilege tables now? [Y/n]  y (询问是否现在重新加载权限表选择y回车)

    ... Success!

    Cleaning up...

    All done!  If you've completed all of the above steps, your MariaDB

    installation should now be secure.

    Thanks for using MariaDB!

    #会自动跳到命令页面,到此我们的数据库设置了密码和一些安全。

  12.  

    我们可以简单登录下数据库;

    mysql -uroot -p

    Enter password: 【输入密码回车即可登录进去】

    Welcome to the MariaDB monitor.  Commands end with ; or \g.

    Your MariaDB connection id is 13

    Server version: 5.5.56-MariaDB MariaDB Server

    Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    MariaDB [(none)]> show databases;            【命令显示数据库列表】

    +--------------------+

    | Database           |

    +--------------------+

    | information_schema |

    | mysql              |

    | performance_schema |

    +--------------------+

    4 rows in set (0.01 sec)

    MariaDB [(none)]> quit                                【退出数据库】

    Bye

     
  13.  

    安装PHP,执行命令;

    yum -y install php

     
     
  14.  

    查看所有组件,执行命令;

    yum search php

    选择所需组件进行安装,执行命令;

    yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel

     
     
  15.  

    完成后我们可以新建一个PHP页面来查看我们安装的组件,执行命令;

    vim /var/www/html/info.php

    #打开后按键盘字母 i

    #编辑为以下内容;

    <?php

    phpinfo();

    ?>

    #编辑完后按键盘 Esc 在输入  :  最后 wq!   回车。

    #vim使用方法可自行百度,不作详细解释

     
  16.  

    最后重启的httpd服务,执行命令;

    systemctl restart httpd

    打开浏览器输入:39.104.82.85/info.php(即IP地址 / 和文件名)

    #看到这个页面证明您的LAMP环境搭建httpd发布目录默认在/var/www/html/

    #您可以使用winscp上传您的页面到发布目录

    来自百度知道(https://jingyan.baidu.com/article/4d58d54165aaf79dd5e9c058.html)

服务器搭建lamp环境的更多相关文章

  1. 基于CentOS7的服务器搭建(LAMP环境)

    基于CentOS7的服务器环境搭建(LAMP环境) 一.安装MySQL组件 1.由于在CentOS7中,默认yum安装库中不含有mysql,我们可以下载mysql的分支MariaDB,如果必须要下my ...

  2. CentOS下搭建LAMP环境详解

    前言:在这里将介绍如何在CentOS下搭建LAMP环境(全部使用源码编译安装),用于web服务器开发. •LAMP: Linux + Apache + PHP + Mysql. •系统: CentOS ...

  3. 在ubuntu上搭建开发环境4---ubuntu简单的搭建LAMP环境和配置

    最近重新安装了Ubuntu,但是之前的LAMP环境自然也就没有了,实在是不想再去编译搭建LAMP环境(这种方法实在是太费时间,而且太容易遇到各种不知道为什么的错误),所以,就去查查有没有什么简单的搭建 ...

  4. Centos6.4版本下搭建LAMP环境

    Centos6.4版本下搭建LAMP环境 配置yum mkdir/mnt/cdrom mount/dev/cdrom  /mnt/cdrom 装载光盘 vi /etc/yum.repos.d/Cent ...

  5. Centos7+Apache2.4+php5.6+mysql5.5搭建Lamp环境——为了wordPress

    最近想搭建个人博客玩玩,挑来挑去发现口碑不错的博客程序是wordpress,简称wp.虽然是学java路线的程序员,但因入行时间太短,至今没有发现较为称手开源的博客程序,如果各位大神有好的推荐,也希望 ...

  6. Linux手动搭建LAMP环境

    当你看到标题里的“手动搭建”,你是不是会想,难不成还有“自动搭建”?当然......不是,这里的“手动搭建”是指按部就班的搭建Apache.MySQL.PHP环境,是相对于集成软件包而言的.所以你是不 ...

  7. Ubuntu18.04下搭建LAMP环境

    一.Apache2 web 服务器的安装 : 可以先更新一下服务器 1.sudo apt-get update             # 获取最新资源包 2.sudo apt-get upgrade ...

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

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

  9. •搭建LAMP环境及快速部署双网站并实现基于域名的虚拟主机

    本节所讲内容: 实战:搭建LAMP环境及快速部署双网站并实现基于域名的虚拟主机 LAMP架构:??? Linux+Apache+Mysql+PHP Linux+Apache+Mysql/MariaDB ...

随机推荐

  1. python 【pandas】读取excel、csv数据,提高索引速度

    问题描述:数据处理,尤其是遇到大量数据且需要for循环处理时,需要消耗大量时间,如代码1所示.通过data['trip_time'][i]的方式会占用大量的时间 代码1 import time t0= ...

  2. 菜鸡学C语言之真心话大冒险

    题目描述 Leslie非常喜欢真心话大冒险的游戏.这一次游戏的规则有些不同.每个人都有自己的真心话,一开始每个人也都只知道自己的真心话.每一轮每个人都告诉指定的一个人他所知道的所有真心话,那么Lesl ...

  3. hadoop知识点总结

    (一).hadoop的内置数据类型都实现了writablecompareable,以便序列化和网络传输及文件存储 a自定义数据类型作为输入 1.实现writable接口 2.如果给数据需要比较大小时, ...

  4. line-height:150%与line-height:1.5的区别

    今天看到一篇文章,说的是CSS学习中的瓶颈,我最近也发现自己css很薄弱,写的样式总是有兼容性问题,要写很久,发现了一个问题,我从来没有用过line-height:150和line-height:1. ...

  5. MySQL改密码

    必须先修改my.cnf 添加 skip-grant-tables   然后  执行  update mysql.user set authentication_string=password('123 ...

  6. .NET SQLServer数据库转MySql

    第一步:找到下图两个组件,卸载. 第二步:NuGet下载下图组件. 第三步:在连接数据库OnConfiguring方法处,做如下修改: protected override void OnConfig ...

  7. TCP三次握手的思考?

    大家都知道TCP有三次握手的过程,今天我就仔细想了想为什么TCP要有三次握手 先贴一张三次握手的示意图,说明一点是在三次握手中A是在第二次握手后申请缓存资源,B是在第一次握手后申请. 其实这个问题就是 ...

  8. Java垃圾回收算法和内存分配策略

    垃圾回收算法和内存分配策略 Java垃圾回收 垃圾收集,也就是GC并不是Java的伴生物,而对于GC的所需要完成任务主要就是: 1.哪些内存是需要回收的? 2.何时去回收这些内存? 3.以何种方式去回 ...

  9. selenium自动化实例: 多层框架中关于iframe的定位,以及select下拉框选择

    对于一个自动化的初学者来说会很常见的遇到元素明明存在却始终定位不到, 从而导致脚本报错,当然定位不到元素的原因很多, 其中一种就是多层框架iframe导致的 下方截图示意: 下方为写脚本时候的示例并其 ...

  10. Spring重要知识点整理

    一.IOC(Inversion of Control):控制反转 (1)Spring Core最核心部分 (2)需要先了解依赖注入(Denpendency Injection)/把底层类作为参数传递给 ...