首先安装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. JavaScript 读取CSV文件并转为js对象

    html部分 <!-- 创建隐藏file input --><button type="button" name="seach" onclic ...

  2. [LeetCode] 035. Search Insert Position (Medium) (C++)

    索引:[LeetCode] Leetcode 题解索引 (C++/Java/Python/Sql) Github: https://github.com/illuz/leetcode 035. Sea ...

  3. School Personal Contest #1 (Codeforces Beta Round #38)---A. Army

    Army time limit per test 2 seconds memory limit per test 256 megabytes input standard input output s ...

  4. python 文档生成 字符串替换

    替换 fnr, fnr_source, fnw = 'my.py.html', '产品清单.txt', 'my.py.res.html'd_source = {}with open(fnr_sourc ...

  5. java 四种实现延迟加载的方法

    1. 延迟初始化 2. 虚拟代理(virtual proxy) 原文地址:   http://www.oodesign.com/proxy-pattern.html Intent The intent ...

  6. ios4--UIView的常见属性(尺寸和位置)

    // // ViewController.m // 08-UIView的常见属性(尺寸和位置) // // frame:相对于父控件左上角定位 // bounds:改变长宽,左上角是相对于自己 // ...

  7. Android TP(三)【转】

    本文转载自:http://blog.csdn.net/bi511304183/article/details/9303259 平台信息:内核:linux2.6/linux3.0系统:android/a ...

  8. [算法基础]斐波那契(recursion+loop)两种方式执行时间对比

    一.斐波那契数列求第n项两种方式 1.递归(自上而下)def recur_fibonacci(n): if n <= 0: return 0 if n == 1: return 1 return ...

  9. Luogu3403跳楼机

    https://zybuluo.com/ysner/note/1099616 题面 给你三个数\(x\),\(y\),\(z\),问你能够凑出多少个[1,\(h\)]之间的数. 解析 处理出\(y\) ...

  10. 通过usb连接adb

    手机不同进入的方式可能不一样,我使用的是努比亚手机. 借鉴这里的:http://adbshell.com/commands/adb-connect 在Wi-Fi上使用ADB:adb connect & ...