CentOS 7.x 系统yum环境搭建PHP 7.x + Apache 2.4 + MariaDB 10.x

ECS服务器安装环境Centos 7.8 64位,首先,检查系统版本,更新内核到最新:

 
-------------------
确定发行版本:
-------------------
# cat /etc/redhat-release
CentOS release 7.8 (Final)
 

-------------------
更新源
-------------------
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# yum makecache
# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo


------------------
更新系统内核到最新
------------------
# yum -y update
# rm -rf /var/cache/yum


CentOS 7.x 64位服务器上安装Apache+Php+MariaDB

1. 安装Apache, PHP, MariaDB以及php连接mysql库组件。
# yum -y install httpd mariadb mariadb-server mod_perl mod_ssl

2、启动Apache+MariaDB

配置开机启动服务

# systemctl start httpd.service        [启动httpd服务]
# systemctl enable httpd.service       [设置httpd服务开机启动]

# systemctl start mariadb.service      [启动mysql服务]
# systemctl enable mariadb.service     [设置mysql服务开机启动]

------------------
注意:Enter current password for root (enter for none): 初次运行直接回车
------------------
# mysql_secure_installation             [设置mysql安全性,设置root密码,远程访问,去除test数据库等]

增加最新PHP 7.2.x和Maria 10.0.20资源

——————————————————
https://mirrors.aliyun.com/ius/7/x86_64/packages/p/
——————————————————

yum install \
https://mirrors.aliyun.com/ius/ius-release-el7.rpm \
https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

或

# bash update_ius_io.sh
——————————————————

# yum list | grep -w \.ius\.

# yum -y install yum-plugin-replace

# rpm -qa | grep php

#72
# yum -y install php72u php72u-mysqlnd php72u-gd php72u-json php72u-opcache php72u-ldap php72u-odbc php72u-xml php72u-xmlrpc php72u-mbstring php72u-bcmath


增加DenyHosts 阻止SSH被暴力破解

wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el7/en/x86_64/rpmforge/RPMS/denyhosts-2.6-5.el7.rf.noarch.rpm
rpm -ivh denyhosts-2.6-5.el7.rf.noarch.rpm
systemctl start denyhosts
systemctl enable denyhosts.service
systemctl status denyhosts


安装:
yum -y install denyhosts

------替换默认配置文件--------

启动denyhosts
# systemctl restart denyhosts 
# systemctl enable denyhosts.service

删除默认首页:

/usr/share/httpd/noindex/
清除更新缓存文件
-----------
yum clean all
----------

—————————————
重启服务器
—————————————
shutdown -r now

相关文章:

1、CentOS 8.2 服务器上yum安装Apache+Php+MariaDB+MongoDB
https://www.onexin.net/latest/centos-8-2-yum-apache-php-mariadb-mongodb/

2、Centos php升级由5.1.x到5.2.x
https://www.onexin.net/solution/centos-php-update-from-the-5-1-x-to-5-2-x/

3、CentOS 5.5上安装Apache+Php+Mysql+phpMyAdmin+Zend
https://www.onexin.net/solution/centos-5-5-install-apache-php-mysql-phpmyadmin-zend/

4、CentOS 5.3快速搭建Apache+PHP5+MySQL完美Web服务器(LAMP)
https://www.onexin.net/solution/centos-5-3-quickly-build-the-perfect-apache-php5-mysql-web-server-lamp/

5、centos5.2安装+apache+php+mysql+gd+zend+phpmyadmin
https://www.onexin.net/solution/apache/centos5-2-e5-ae-89-e8-a3-85apachephpmysqlgdzendphpmyadmin/

转载请注明出处:https://www.onexin.net/solution/centos-7-x-php-7-x-apache-2-4-mariadb-10-x/

Leave a Reply

Your email address will not be published. Required fields are marked *