一、环境准备
[root@Server ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
[root@Server ~]# uname -r
3.10.0-957.10.1.el7.x86_64
关闭防火墙
systemctl stop firewalld.service
关闭防火墙开机启动
systemctl disable firewalld.service
关闭SELINUX (重启生效)
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
二、安装httpd
[root@localhost ~]# yum install -y httpd
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
三、安装MariaDB
官网10.4下载页面
编辑repo
vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
安装
yum install -y MariaDB-server MariaDB-client
启动服务
systemctl start mariadb
开机自启
systemctl enable mariadb
配置向导
mysql_secure_installation
Enter current password for root (enter for none):<–初次运行直接回车
Switch to unix_socket authentication [Y/n]
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车, 建议 N
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
查看版本 10.4.6
[root@localhost ~]# mysql -v
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.4.6-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
测试登录
mysql -u root -p
四、安装PHP7.2
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
[root@localhost ~]# yum install -y php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
查看版本 7.2.19
[root@localhost ~]# php -v
PHP 7.2.19 (cli) (built: Jun 2 2019 09:49:05) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19, Copyright (c) 1999-2018, by Zend Technologies
五、测试
重启httpd服务
[root@localhost ~l]# systemctl restart httpd
创建测试文件
echo "">/var/www/html/info.php
访问本机 IP/info.php