当前位置:网站首页>Linux安装部署LAMP(Apache+MySQL+PHP)
Linux安装部署LAMP(Apache+MySQL+PHP)
2022-07-05 11:51:00 【爱敲代码的三毛】
文章目录
什么是LAMP?
LAMP:Linux + Apache + MySQL + PHP LAMP 架构(组合)

- Apache:Apache是世界使用排名第一的Web服务器软件
- PHP:一种专门用于Web开发的编程语言
- MySQL:MySQL是一个关系型数据库管理系统,主要用于永久存储项目数据
准备部署环境
1. 安装 Apache
使用yum命令安装httpd软件包
命令:
yum install httpd -y

配置 httpd.conf文件
用命令打开配置文件:vim /etc/httpd/conf/httpd.conf在vim中
/+关键字回车搜索关键字搜索ServerName,在下面添加一行:
ServerName Localhost:80
保存退出
使用systemctl命令重启httpd服务,使用
netstat -ntlp命令,查看是否有80端口监听

4. 设置httpd服务开机启动
语法:systemctl enable httpd
查看开机启动是否设置成功
命令:systemctl enable httpd

5. 开放80端口
命令:firewall-cmd --zone=public --add-port=80/tcp

- 验证
通过ifconfig命令查看ip

2. 安装MySQL
1.下载MySQL的yum源
由于yum源上没有 mysql-server,所以必须去官网下载后安装
命令:wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2. 添加MySQL的yum源存储库
命令:rpm -ivh mysql-community-release-el7-5.noarch.rpm

3. 安装MySQL
命令:yum -y install mysql-community-server


4. 启动MySQL
重启mysql服务
命令:systemctl restart mysqld.service
查看是否有MySQL的端口号3306
5. 初始化数据库
命令:mysql_secure_installation
设置超级管理员root密码,注:默认为空,直接回车即可


是否移除匿名用户

不禁用root远程连接

不移除默认数据库(测试用例)

重新加载权限

测试连接MySQL
命令:mysql -uroot -p
输入密码

3. PHP安装
安装命令:yum -y install php
因为php是依赖于Apache的所以安装后要重启 Apache服务
命令:systemctl restart httpd

重启 httpd
测试
第一步:使用cd命令进入/var/www/html目录
第二步:使用vim命令创建index.php文件
第三步:编写php代码


通过浏览器访问
边栏推荐
- 一类恒等式的应用(范德蒙德卷积与超几何函数)
- 《增长黑客》阅读笔记
- Use and install RkNN toolkit Lite2 on itop-3568 development board NPU
- Yolov 5 Target Detection Neural Network - Loss Function Calculation Principle
- 13.(地图数据篇)百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换
- Yolov5 target detection neural network -- calculation principle of loss function
- How to understand super browser? What scenarios can it be used in? What brands are there?
- 如何让你的产品越贵越好卖
- ibatis的动态sql
- iTOP-3568开发板NPU使用安装RKNN Toolkit Lite2
猜你喜欢
随机推荐
C operation XML file
Sentinel sentinel mechanism of master automatic election in redis master-slave
Ziguang zhanrui's first 5g R17 IOT NTN satellite in the world has been measured on the Internet of things
COMSOL -- three-dimensional graphics random drawing -- rotation
Web API configuration custom route
Redirection of redis cluster
871. Minimum Number of Refueling Stops
Liunx prohibit Ping explain the different usage of traceroute
Implementation of array hash function in PHP
【L1、L2、smooth L1三类损失函数】
The most comprehensive new database in the whole network, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, flying Book Multidimensional table, heipayun, Zhix
15 methods in "understand series after reading" teach you to play with strings
11. (map data section) how to download and use OSM data
【云原生 | Kubernetes篇】Ingress案例实战(十三)
redis 集群模式原理
Ncp1342 chip substitute pn8213 65W gallium nitride charger scheme
《增长黑客》阅读笔记
网络五连鞭
多表操作-子查询
redis集群中hash tag 使用
![[upsampling method opencv interpolation]](/img/6b/5e8f3c2844f0cbbbf03022e0efd5f0.png)

![[yolov3 loss function]](/img/79/87bcc408758403cf3993acc015381a.png)





