当前位置:网站首页>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代码
通过浏览器访问
边栏推荐
猜你喜欢
[upsampling method opencv interpolation]
Redis集群的重定向
Multi table operation - Auto Association query
[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
Is it difficult to apply for a job after graduation? "Hundreds of days and tens of millions" online recruitment activities to solve your problems
Use and install RkNN toolkit Lite2 on itop-3568 development board NPU
11.(地图数据篇)OSM数据如何下载使用
Harbor镜像仓库搭建
【pytorch 修改预训练模型:实测加载预训练模型与模型随机初始化差别不大】
1 plug-in to handle advertisements in web pages
随机推荐
2048 game logic
【无标题】
全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
[configuration method of win11 multi-user simultaneous login remote desktop]
谜语1
Simply solve the problem that the node in the redis cluster cannot read data (error) moved
Redis集群的重定向
12.(地图数据篇)cesium城市建筑物贴图
Idea set the number of open file windows
MySQL statistical skills: on duplicate key update usage
Solve the grpc connection problem. Dial succeeds with transientfailure
【主流Nivida显卡深度学习/强化学习/AI算力汇总】
Vscode shortcut key
汉诺塔问题思路的证明
[yolov3 loss function]
idea设置打开文件窗口个数
Codeforces Round #804 (Div. 2)
Open3D 网格(曲面)赋色
How to understand super browser? What scenarios can it be used in? What brands are there?
13. (map data) conversion between Baidu coordinate (bd09), national survey of China coordinate (Mars coordinate, gcj02), and WGS84 coordinate system