CentOS 7.3下LNMPA环境安装

本文主要讲述了在centOS 7.3环境下,搭建LNMPA环境的方法。

安装php7.0

1.更新yum安装包

1
2
http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2.通过yum安装php及其他组件

1
2
3
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64

yum install php70w-fpm

3.验证是否安装成功

1
php -v

参考文章:CentOS通过yum安装php7.0


安装apache

1.修改监听端口

apache已经安装完成,默认监听端口为80, 为了防止与nginx冲突,因此,此处将apache监听端口改为8080端口。

1
nano /etc/httpd/conf/httpd.conf

修改文件内容如下:

1
2
#Listen 80
Listen 8080

2.重启httpd

1
systemctl restart httpd

3.验证apache是否安装成功

打开浏览器,进入网址http://SERVER:8080,检查是否打开apache欢迎页

4.在系统范围内启动httpd

1
systemctl enable httpd

安装MariaDB

1.通过yum安装数据库

1
yum install mariadb-server mariadb

2.启动数据库

1
systemctl start mariadb

3.配置数据库

设置数据库的 root 密码、禁止远程 root 登录、移除测试数据库、移除匿名用户等。

1
mysql_secure_installation

4.配置系统范围内启用

1
systemctl enable mariadb

安装PhpMyAdmin

1.通过yum安装phpmyadmin

1
2
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
yum install phpmyadmin

2.配置允许远程连接

进入phpMyAdmin.conf文件

1
nano /etc/httpd/conf.d/phpMyAdmin.conf

修改内容如下:参考文章

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<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
Allow from All granted
</IfModule>
</Directory>

3.重启apache

1
systemctl restart httpd

4.验证安装是否成功

打开浏览器,输入http://SERVER/phpmyadmin/,检查能否打开phpMyAdmin主页。

参考文章:在 RHEL/CentOS 7.0 中安装 LAMP


安装nginx

1.通过yum安装

1
yum install nginx

2.配置系统范围内启动

1
systemctl enable nginx

3.启动nginx

1
systemctl start nginx

4.验证是否安装成功

打开浏览器,输入http://SERVER,检查能否打开

本文标题:CentOS 7.3下LNMPA环境安装

文章作者:Jerry

发布时间:2017年11月25日 - 11:00:51

最后更新:2018年05月18日 - 14:21:23

原始链接:https://jerryma0912.github.io/2017/11/25/1-install-lnmpa/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。