当前位置:网站首页>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代码
通过浏览器访问
边栏推荐
- HiEngine:可媲美本地的云原生内存数据库引擎
- [deploy pytoch project through onnx using tensorrt]
- SET XACT_ABORT ON
- redis的持久化机制原理
- [upsampling method opencv interpolation]
- Project summary notes series wstax kt session2 code analysis
- [mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
- How can China Africa diamond accessory stones be inlaid to be safe and beautiful?
- C#实现WinForm DataGridView控件支持叠加数据绑定
- 程序员内卷和保持行业竞争力
猜你喜欢
Redirection of redis cluster
XML parsing
abap查表程序
1个插件搞定网页中的广告
Sentinel sentinel mechanism of master automatic election in redis master-slave
Splunk configuration 163 mailbox alarm
Riddle 1
[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
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
Codeworks 5 questions per day (1700 average) - day 5
随机推荐
Proof of the thinking of Hanoi Tower problem
How to make your products as expensive as possible
12.(地图数据篇)cesium城市建筑物贴图
How to protect user privacy without password authentication?
Multi table operation - Auto Association query
15 methods in "understand series after reading" teach you to play with strings
Redis集群(主从)脑裂及解决方案
Halcon 模板匹配实战代码(一)
XML解析
splunk配置163邮箱告警
2048游戏逻辑
Sentinel sentinel mechanism of master automatic election in redis master-slave
iTOP-3568开发板NPU使用安装RKNN Toolkit Lite2
Harbor image warehouse construction
Evolution of multi-objective sorting model for classified tab commodity flow
1个插件搞定网页中的广告
Hash tag usage in redis cluster
Ziguang zhanrui's first 5g R17 IOT NTN satellite in the world has been measured on the Internet of things
Principle of persistence mechanism of redis
Question and answer 45: application of performance probe monitoring principle node JS probe