Centos7的yum安装php环境

@爱耍流氓的唐僧  September 13, 2021

安装php

yum -y remove php*

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysql php72w-opcache php72w-pdo php72w-xml

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm   

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysql php72w-opcache php72w-pdo php72w-xml

php -v

安装Nginx

 yum install -y nginx

安装Mysql

1.检查mysql是否安装
yum list installed | grep mysql
如果有的话 就全部卸载
yum -y remove +数据库名称

2.MySQL 依赖 libaio,所以先要安装 libaio
yum search libaio # 检索相关信息
yum install libaio # 安装依赖包

3.下载 MySQL Yum Repository
如果找不到wget命令则先yum install wget
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

4.添加 MySQL Yum Repository
添加 MySQL Yum Repository 到你的系统 repository 列表中,执行
yum localinstall mysql-community-release-el7-5.noarch.rpm

5.验证下是否添加成功
yum repolist enabled | grep "mysql.*-community.*"

6.选择要启用 MySQL 版本
查看 MySQL 版本,执行
yum repolist all | grep mysql
可以看到 5.5, 5.7 版本是默认禁用的,因为现在最新的稳定版是 5.6
yum repolist enabled | grep mysql
查看当前的启动的 MySQL 版本

7.通过 Yum 来安装 MySQL
yum install mysql-community-server
Yum 会自动处理 MySQL 与其他组件的依赖关系

中间有个报错

    Removing mariadb-libs.x86_64 1:5.5.56-2.el7 - u due to obsoletes from mysql-community-libs.x86_64 0:5.6.38-2.el7 - u
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.56-2.el7 will be an update
---> Package mariadb-libs.x86_64 1:5.5.56-2.el7 will be an update
---> Package mariadb-server.x86_64 1:5.5.56-2.el7 will be an update
--> Processing Dependency: mariadb-server for package: akonadi-mysql-1.9.2-4.el7.x86_64
--> Finished Dependency Resolution
Error: Package: akonadi-mysql-1.9.2-4.el7.x86_64 (@anaconda)
           Requires: mariadb-server
           Removing: 1:mariadb-server-5.5.52-1.el7.x86_64 (@anaconda)
               mariadb-server = 1:5.5.52-1.el7
           Obsoleted By: mysql-community-server-5.6.38-2.el7.x86_64 (mysql56-community)
               Not found
           Updated By: 1:mariadb-server-5.5.56-2.el7.x86_64 (base)
               mariadb-server = 1:5.5.56-2.el7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

报错原因 :软件包依赖 mariadb组件

解决方案:

yum -y remove mariadb-libs
运行

yum install mysql-community-server

添加新评论