用yum快速搭建LAMP平台

安装apache

 1.1 安装apache

yum install httpd httpd-devel

 1.2 启动apache服务

systemctl start  httpd

1.3 设置httpd服务开机启动

systemctl enable  httpd

1.4 查看服务状态

systemctl status httpd

 1.5 防火墙设置开启80端口

firewall-cmd --permanent --zone=public  --add-service=http
firewall-cmd --permanent --zone=public  --add-service=https
firewall-cmd --reload

 1.5 关闭防火墙

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

 1.6确认80端口监听中

netstat -tulp

 1.8 查服务器IP

ip addr

1.9 浏览器确认Apache已经启动

apache_ok.png

安装mysql

2.1 安装mysql

yum install mariadb mariadb-server mariadb-libs mariadb-devel

2.2 开启mysql服务,并设置开机启动,检查mysql状态

systemctl start  mariadb  //开启mysql服务
systemctl enable  mariadb  //设置开机自启动
systemctl status  mariadb //检查mysql状态
netstat -tulp //查看监听端口

2.3  数据库安全设置

mysql_secure_installation

2.4 登陆数据库测试

mysql -uroot -p

安装PHP

1,更换yum源

# yum install epel-release
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2,安装php

# yum install php72w

3,安装php扩展根据自己需求来

php72w-cli 
php72w-common 
php72w-devel 
php72w-embedded 
php72w-fpm 
php72w-gd 
php72w-mbstring 
php72w-mysqlnd 
php72w-opcache 
php72w-pdo 
php72w-xml 
php72w 
php72w-bcmath 
php72w-dba 
php72w-enchant 
php72w-imap 
php72w-interbase
php72w-intl 
php72w-ldap  
php72w-mcrypt 
php72w-odbc 
php72w-pdo_dblib 
php72w-pear 
php72w-pecl-apcu 
php72w-pecl-imagick 
php72w-pecl-xdebug 
php72w-pgsql 
php72w-phpdbg 
php72w-process 
php72w-pspell 
php72w-recode 
php72w-snmp 
php72w-soap 
php72w-tidy 
php72w-xmlrpc 
php72w-pecl-igbinary 
php72w-intl 
php72w-memcached 
php72w-pecl-mongodb

4,php配置文件所在地址

php.ini             /etc/php.ini
php加载ini文件       /etc/php.d/*.ini
php-fpm.conf        /etc/php-fpm.conf    
php-fpm.pid         /var/run/php-fpm/php-fpm.pid
php-fpm启动          php-fpm

重启Apache服务器,确认mysql,php工作正常

systemctl restart http

至此lamp搭建成功。php版本为7.2.34 

安装phpmyadmin

1,安装phpmyadmin

yum install phpmyadmin

2,配置phpmyadmin

sudo vi /etc/httpd/conf.d/phpMyAdmin.conf

 配置的内容如下:

# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1 注释掉
#Require ip ::1 注释掉
Require all granted #新加运行远程访问
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1 注释掉
#Require ip ::1 注释掉
Require all granted #新加运行远程访问
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>

3,重新启动apache 

systemctl restart http

通过ip/phpmyadmin访问 

评论 (0)

  • 最新在前
  • 最佳在前

Joomla! 除错面板

会话

方案信息

内存使用量

数据库查询