Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」

(22) 2023-04-21 15:12

Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」,希望能够帮助你!!!。

摘要:搭建LAMP环境是指安装Apache+php+mysql+常用的PHP模块,这为后续搭建Rsyslog日志分析工具LogAnalyzer提供基础。本文将介绍LAMP环境的安装与配置,详情请看下文。

一、登陆Linux系统

1、登陆系统

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第1张

2、查看系统版本

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第2张

二、安装apache

1、安装apache

执行指令# yum install httpd httpd-devel安装apache

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第3张

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第4张

2、启动apache服务

执行指令# systemctl start httpd启动apache服务

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第5张

3、设置开机自启动

执行指令# systemctl enable httpd设置开机自启动

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第6张

4、防火墙设置开启80和443端口

执行指令# firewall-cmd --add-port=80/tcp --permanent

# firewall-cmd --add-port=443/tcp –permanent

# firewall-cmd --reload

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第7张

5、查看80监听端口

执行指令# netstat –tulp查看监听的端口

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第8张

6、访问测试

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第9张

三、安装mysql

1、安装mysql

执行指令# yum install mariadb mariadb-server mariadb-libs mariadb-devel安装mariadb数据库,其中MariaDB数据库管理系统是MySQL的一个分支,属于mysql数据库范畴。

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第10张

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第11张

2、查看mysql安装情况

执行指令# rpm -qa|grep maria

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第12张

3、开启mysql服务

执行指令# systemctl start mariadb启动服务

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第13张

4、设置开机自启动

执行指令# systemctl enable mariadb设置开机自启动

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第14张

5、查看监听的服务

执行指令# netstat –tulp查看监听的端口

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第15张

6、数据库安全设置

执行指令# mysql_secure_installation

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第16张

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第17张

7、登陆数据库测试

执行指令# mysql –u root -p

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第18张

四、安装PHP

1、安装PHP

执行指令# yum -y install php安装PHP

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第19张

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第20张

2、将php与mysql关联起来

执行指令# yum install php-mysql关联php与mysql

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第21张

3、查看关联情况

执行指令# rpm –ql php-mysql查看php与mysql的关联情况

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第22张

4、安装常用PHP模块

执行指令# yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第23张

5、编辑PHP访问页面

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第24张

6、重启apache服务器

执行指令# systemctl restart httpd

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第25张

7、测试PHP的访问页面

Linux系统LOG日志分析与管理(二)——搭建LAMP环境「建议收藏」_https://bianchenghao6.com/blog__第26张

至此, LAMP环境搭建完毕。下一步可以安装LogAnalyzer了!

上一篇

已是最后文章

下一篇

已是最新文章

发表回复