centos 7 lamp环境

前端之家收集整理的这篇文章主要介绍了centos 7 lamp环境前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.安装Apache

yum install httpd #根据提示,输入Y安装即可成功安装

systemctl start httpd.service #启动apache

systemctl stop httpd.service #停止apache

systemctl restart httpd.service #重启apache

systemctl enable httpd.service #设置apache开机启动

2.安装Mariadb

yum install mariadb mariadb-server @H_301_30@#询问是否要安装,输入Y即可自动安装,直到安装完成

systemctl start mariadb.service #启动MariaDB

systemctl stop mariadb.service #停止MariaDB

systemctl restart mariadb.service #重启MariaDB

systemctl enable mariadb.service #设置开机启动

cp /usr/share/MysqL/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆 盖即可)

2.1 初始化数据库

MysqL_secure_installation

回车,根据提示输入Y

输入2次密码,回车

根据提示一路输入Y

最后出现:Thanks for using MysqL!

MysqL密码设置完成,重新启动 MysqL

systemctl restart mariadb.service #重启MariaDB

3.安装PHP

yum install PHP #根据提示输入Y直到安装完成

3.1 安装PHP组件,使PHP支持 MariaDB

yum install PHP-MysqL PHP-gd libjpeg* PHP-ldap PHP-odbc PHP-pear PHP-xml PHP-xmlrpc PHP-mbstring PHP-bcmath PHP-mhash #这里选择以上安装包进行安装,根据提示输入Y回车

systemctl restart httpd.service 4.安装PHPMyadmin

yum install PHPmyadmin PHP-mcrypt

PHPMyAdmin 的默认安装目录是 /usr/share/PHPMyAdmin,同时会在 Apache 的配置文件目录中自动创建虚拟主机 配置文件 /etc/httpd/conf.d/PHPMyAdmin.conf(区分大小写)。默认情况下,CentOS 7上的PHPMyAdmin只允许从 回环地址(127.0.0.1)访问。为了能远程连接,你需要改动它的配置。

vi /etc/httpd/conf.d/PHPMyadmin.conf

<Directory/usr/share/PHPMyAdmin/>
AddDefaultCharsetUTF-8

<IfModulemod_authz_core.c>
#Apache2.4
<RequireAny>
#Requireip127.0.0.1#注释掉
#Requireip::1#注释掉
Requireallgranted#新添加
</RequireAny>
</IfModule>
<IfModule!mod_authz_core.c>
#Apache2.2
OrderDeny,Allow
DenyfromAll
Allowfrom127.0.0.1
Allowfrom::1
</IfModule>
</Directory>

<Directory/usr/share/PHPMyAdmin/setup/>
<IfModulemod_authz_core.c>
#Apache2.4
<RequireAny>
#Requireip127.0.0.1#注释掉
#Requireip::1#注释掉
Requireallgranted#新添加
</RequireAny>
</IfModule>
<IfModule!mod_authz_core.c>
#Apache2.2
OrderDeny,Allow
DenyfromAll
Allowfrom127.0.0.1
Allowfrom::1
</IfModule>
</Directory>
:wq

systemctl restart httpd

浏览器访问地址http://ip/phpmyadmin

原文链接:https://www.f2er.com/centos/376940.html

猜你在找的CentOS相关文章