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
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.4.x和Maria 10.0.20资源
——————————————————
https://mirrors.aliyun.com/ius/7/x86_64/packages/p/
——————————————————
# 导入ius源
yum install \
https://mirrors.aliyun.com/ius/ius-release-el7.rpm \
https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
——————————————————
# yum list | grep -w \.ius\.
# yum -y install yum-plugin-replace
# rpm -qa | grep php
# 安装php 7.4.x
# yum -y install mod_php74 php74-mysqlnd php74-gd php74-json php74-opcache php74-ldap php74-odbc php74-xml php74-xmlrpc php74-mbstring php74-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
启动denyhosts
# systemctl restart denyhosts
# systemctl enable denyhosts.service
删除默认首页:
# rm -rf /usr/share/httpd/noindex
清除更新缓存文件
-----------
# yum clean all
----------
—————————————
重启服务器
—————————————
shutdown -r now
转载请注明出处:https://www.onexin.net/centos-7-x-php-7-x-apache-2-4-mariadb-10-x/