centOS7 搭建LAMP服务器(apache+php+MariaDB)

匿名 (未验证) 提交于 2019-12-02 22:10:10

安装httpd

参考博客
https://blog.csdn.net/qq_36113598/article/details/77532647

yum install httpd

配置ServerName

vi /etc/httpd/conf/httpd.conf

将#ServerName www.example.com:80修改为ServerName localhost:80
外部机器此时输入服务器的IP地址,应该看到apache的服务页面,端口不用输,apache默认就是使用80端口

systemctl start httpd.service #开启httpd服务
systemctl enable httpd.service#配置httpd服务开机自启

关闭防火墙

Systemctl stop firewalld.service
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning, 开启后显示running)

安装php

yum install php

重启apache服务

Systemctl httpd restart

安装mysql

参考博客
https://www.cnblogs.com/zhanzhan/p/7729981.html

1、安装MariaDB
安装命令

yum -y install mariadb mariadb-server

安装完成MariaDB,首先启动MariaDB

systemctl start mariadb

设置开机启动

systemctl enable mariadb

接下来进行MariaDB的相关简单配置

mysql_secure_installation

首先是设置密码,会提示先输入密码

设置密码



其他配置




初始化MariaDB完成,接下来测试登录

mysql -u root -p
enter password:

进入mariaDB页面

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!