首先安装apache

Centos7默认已经安装httpd服务,只是没有启动。

如果需要重新安装,输入

yum install -y httpd

启动服务:

systemctl start httpd.service

设置开机自动启动:

systemctl enable httpd.service

Apache配置文件:

/etc/httpd/conf/httpd.conf

项目默认存放目录为

/var/www/html

Apache拓展的文件例如vhosts放在

/etc/httpd/conf/conf.d

然后是安装PHP主程序

yum -y install php

接下来安装PHP常用组件

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

其实在安装mysql后还要加入pdo_mysql,根据项目需要我也加入了ssh2拓展.

yum -y -install php-pdo_mysql php-pecl-ssh2

安装完成后重启

systemctl restart httpd.service

最后安装mysql

CentOS7的yum源中默认是没有mysql的。为了解决这个问题,我们要先下载mysql的repo源。

下载msyql的repo源

$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

安装mysql-community-release-el7-5.noarch.rpm包

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

最后安装mysql

sudo yum install mysql-server

安装好mysql后重置用户密码,先将当前用户切换到root

sudo chown -R root:root /var/lib/mysql

然后重启服务

service mysqld restart

进入mysql重置密码

mysql -u root
mysql > use mysql;
mysql > update user set password=password(‘123456‘) where user=‘root‘;
mysql > exit;

这样基本lamp配置就完成了。

Centos7搭建lamp环境的更多相关文章

  1. Centos7 搭建LAMP环境(编译安装)

    1.查看系统版本 [niemx@localhost ~]$ cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) 2.安装软件准备 ...

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

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

  3. centos7用yum搭建LAMP环境

    用yum快速搭建LAMP平台 实验环境: [root@nmserver- html]# cat /etc/redhat-release CentOS release (AltArch) [root@n ...

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

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

  5. 搭建LAMP环境部署opensns微博网站

    搭建LAMP环境部署opensns微博网站 实验环境 centos7 ip: 192.168.121.17 一.关闭防火墙和selinux [root@localhost ~]# systemctl ...

  6. CentOS下搭建LAMP环境详解

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

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

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

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

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

  9. Linux手动搭建LAMP环境

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

随机推荐

  1. Ubuntu 16.04安装Grub Customizer替代Startup-manager(解决找不到menu.lst,GRUB配置简单介绍)

    关于GRUB的介绍: http://baike.baidu.com/item/GRUB http://blog.csdn.net/bytxl/article/details/9253713 menu. ...

  2. FreeMarker与Servlet结合示例

    一.最原始示例 1.引入POM依赖 <!-- https://mvnrepository.com/artifact/org.freemarker/freemarker --> <de ...

  3. Node & Express: some tips

    1. 设置Express端口号: 在app.js中添加 app.set('port', process.env.PORT || 3000); 之后命令行中打入 PORT=1234 node app.j ...

  4. [Vue-rx] Stream an API using RxJS into a Vue.js Template

    You can map remote data directly into your Vue.js templates using RxJS. This lesson uses axios (and ...

  5. java界面编程(9) ------ 列表框

    本文是自己学习所做笔记,欢迎转载.但请注明出处:http://blog.csdn.net/jesson20121020 列表框和JComboBox组合框明显不同,这不不过体如今外观上. 当激活JCom ...

  6. bootstrap-table方法之:expandRow-collapseRow,展开或关闭当前行数据

    官方演示地址:http://issues.wenzhixin.net.cn/bootstrap-table/methods/expandRow-collapseRow.html <!DOCTYP ...

  7. Hackerrank Connected Cell in a Grid

    Problem Statement You are given a matrix with m rows and n columns of cells, each of which contains ...

  8. uva10152-ShellSort

    Problem D: ShellSort He made each turtle stand on another one's back And he piled them all up in a n ...

  9. mySql学习笔记:比sql server书写要简单

    在学mySql.总的感觉,mySql与Sql Server差不多,语法都很象,但mySql也许是吸取了SQL SERVER的一些经验,SQL语句书写起来更加简单. 比如说,设置主键.索引,SQL SE ...

  10. nyoj448 寻找最大数

    寻找最大数 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描写叙述 请在整数 n 中删除m个数字, 使得余下的数字按原次序组成的新数最大. 比方当n=920813467185 ...