当前位置:网站首页>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代码


通过浏览器访问
边栏推荐
- vscode快捷键
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
- 如何让你的产品越贵越好卖
- POJ 3176 cow bowling (DP | memory search)
- 2048游戏逻辑
- 全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
- Redis cluster (master-slave) brain crack and solution
- Mysql统计技巧:ON DUPLICATE KEY UPDATE用法
- 1 plug-in to handle advertisements in web pages
- XML解析
猜你喜欢

XML parsing

Harbor image warehouse construction

【pytorch 修改预训练模型:实测加载预训练模型与模型随机初始化差别不大】

一次生产环境redis内存占用居高不下问题排查

idea设置打开文件窗口个数

12. (map data) cesium city building map

Yolov 5 Target Detection Neural Network - Loss Function Calculation Principle

全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀

1个插件搞定网页中的广告

1 plug-in to handle advertisements in web pages
随机推荐
C#实现WinForm DataGridView控件支持叠加数据绑定
871. Minimum Number of Refueling Stops
[LeetCode] Wildcard Matching 外卡匹配
COMSOL -- establishment of geometric model -- establishment of two-dimensional graphics
【L1、L2、smooth L1三类损失函数】
Mysql统计技巧:ON DUPLICATE KEY UPDATE用法
iTOP-3568开发板NPU使用安装RKNN Toolkit Lite2
How did the situation that NFT trading market mainly uses eth standard for trading come into being?
Splunk configuration 163 mailbox alarm
splunk配置163邮箱告警
Yolov5 target detection neural network -- calculation principle of loss function
Pytorch linear regression
Idea set the number of open file windows
The ninth Operation Committee meeting of dragon lizard community was successfully held
Troubleshooting of high memory usage of redis in a production environment
Simply solve the problem that the node in the redis cluster cannot read data (error) moved
查看多台机器所有进程
Thoughts and suggestions on the construction of intelligent management and control system platform for safe production in petrochemical enterprises
abap查表程序
Codeforces Round #804 (Div. 2)