当前位置:网站首页>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代码
通过浏览器访问
边栏推荐
- [singleshotmultiboxdetector (SSD, single step multi frame target detection)]
- liunx禁ping 详解traceroute的不同用法
- [crawler] bugs encountered by wasm
- Reading notes of growth hacker
- Simply solve the problem that the node in the redis cluster cannot read data (error) moved
- Yolov 5 Target Detection Neural Network - Loss Function Calculation Principle
- MySQL 巨坑:update 更新慎用影响行数做判断!!!
- codeforces每日5题(均1700)-第五天
- Evolution of multi-objective sorting model for classified tab commodity flow
- Unity xlua monoproxy mono proxy class
猜你喜欢
查看rancher中debug端口信息,并做IDEA Remote Jvm Debug
Use and install RkNN toolkit Lite2 on itop-3568 development board NPU
[calculation of loss in yolov3]
redis主从中的Master自动选举之Sentinel哨兵机制
[upsampling method opencv interpolation]
COMSOL -- establishment of 3D graphics
Is it difficult to apply for a job after graduation? "Hundreds of days and tens of millions" online recruitment activities to solve your problems
Thoughts and suggestions on the construction of intelligent management and control system platform for safe production in petrochemical enterprises
[cloud native | kubernetes] actual battle of ingress case (13)
[yolov5.yaml parsing]
随机推荐
Hash tag usage in redis cluster
[configuration method of win11 multi-user simultaneous login remote desktop]
Go language learning notes - first acquaintance with go language
Web API配置自定义路由
POJ 3176-Cow Bowling(DP||记忆化搜索)
COMSOL -- 3D casual painting -- sweeping
POJ 3176 cow bowling (DP | memory search)
How does redis implement multiple zones?
MySQL 巨坑:update 更新慎用影响行数做判断!!!
2048 game logic
Question and answer 45: application of performance probe monitoring principle node JS probe
如何让你的产品越贵越好卖
一次生产环境redis内存占用居高不下问题排查
Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
Principle of persistence mechanism of redis
Proof of the thinking of Hanoi Tower problem
[calculation of loss in yolov3]
SET XACT_ ABORT ON
How to make your products as expensive as possible
简单解决redis cluster中从节点读取不了数据(error) MOVED