版权声明:转载原创文章请以超链接形式请注明原文章出处,尊重作者,尊重原创!
恰饭广告
前言:centos7默认的Apache+MariadDB+PHP版本相对较低,可能在性能上有些差别
安装apache
yum install yum-changelog -y
yum changelog httpd
yum install -y epel-release
cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo
yum install httpd -y
开启自启
systemctl start httpd systemctl enable httpd
注意:修改apache的相关配置文件后,apache老启动失败,reboot重启以后又正常运行
原文链接:https://crosp.net/blog/administration/install-latest-apache-server-centos-7/
安装php
yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install mod_php72w php72w-opcache php72w-fpm php72w-opcache php72w-mysql php72w-xml php72w-xmlrpc -y
升级php
yum install yum-plugin-replace yum replace php-common --replace-with=php72w-common
安装mariadb
vim /etc/yum.repos.d/mariadb.repo
添加如下内容:
[mariadb] name = MariaDB baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos7-amd64 gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=1
注意:其中的10.3可以更换为其他版本,前提是链接有效
yum install MariaDB-server MariaDB-client -y
mariadb与selinux冲突的解决方案
yum -y install policycoreutils-python
chcon -Rv -u system_u -t mysqld_db_t /var/lib/mysql
semanage fcontext -a -t mysqld_db_t “/data/mysql(/.*)?“
semanage fcontext -a -t mysqld_db_t “/var/lib/mysql(/.*)?“
restorecon -Rv /var/lib/mysql
fixfiles restore
防止linux重启后数据库启动失败
vim /etc/rc.d/rc.local
添加内容:
fixfiles restore systemctl start mariadb
参考文档:
http://blog.51cto.com/morrowind/1854427
https://blog.csdn.net/zhezhebie/article/details/74200355
https://downloads.mariadb.org/
其他问题:
1、apache相关配置请在 点击这里 查找
2、php相关软件包一定要安装完全,相关软件包在参考资料中
3、mariadb一定要修改编码为utf8,否则开发容易遇到乱码
4、相关端口的开启
原文链接:https://www.idaobin.com/archives/1914.html
让我恰个饭吧.ヘ( ̄ω ̄ヘ)
恰饭广告