随便记录一下安装过程以及遇到的一些问题…
一、安装Apache2.4
# 安装 [root@localhost sgtfz]# yum -y install httpd 已加载插件:fastestmirror, langpacks base | 3.6 kB 00:00 epel/x86_64/metalink | 5.0 kB 00:00 epel | 4.7 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirrors.ustc.edu.cn * extras: mirrors.163.com * updates: mirrors.aliyun.com 正在解决依赖关系 --> 正在检查事务 ---> 软件包 httpd.x86_64.0.2.4.6-45.el7.centos 将被 升级 ---> 软件包 httpd.x86_64.0.2.4.6-80.el7.centos 将被 更新 --> 正在处理依赖关系 httpd-tools = 2.4.6-80.el7.centos,它被软件包 httpd-2.4.6-80.el7.centos.x86_64 需要 --> 正在检查事务 ---> 软件包 httpd-tools.x86_64.0.2.4.6-45.el7.centos 将被 升级 ---> 软件包 httpd-tools.x86_64.0.2.4.6-80.el7.centos 将被 更新 --> 解决依赖关系完成 依赖关系解决 ================================================================================ Package 架构 版本 源 大小 ================================================================================ 正在更新: httpd x86_64 2.4.6-80.el7.centos base 2.7 M 为依赖而更新: httpd-tools x86_64 2.4.6-80.el7.centos base 89 k 事务概要 ================================================================================ 升级 1 软件包 (+1 依赖软件包) 总下载量:2.8 M Downloading packages: No Presto metadata available for base httpd-tools-2.4.6-80.el7.cento FAILED http://mirrors.shu.edu.cn/centos/7.5.1804/os/x86_64/Packages/httpd-tools-2.4.6-80.el7.centos.x86_64.rpm: [Errno 14] curl#7 - "Failed connect to mirrors.shu.edu.cn:80; Connection refused" 正在尝试其它镜像。 (1/2): httpd-tools-2.4.6-80.el7.centos.x86_64.rpm | 89 kB 00:00 (2/2): httpd-2.4.6-80.el7.centos.x86_64.rpm | 2.7 MB 00:00 -------------------------------------------------------------------------------- 总计 3.9 MB/s | 2.8 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在更新 : httpd-tools-2.4.6-80.el7.centos.x86_64 1/4 正在更新 : httpd-2.4.6-80.el7.centos.x86_64 2/4 清理 : httpd-2.4.6-45.el7.centos.x86_64 3/4 清理 : httpd-tools-2.4.6-45.el7.centos.x86_64 4/4 验证中 : httpd-tools-2.4.6-80.el7.centos.x86_64 1/4 验证中 : httpd-2.4.6-80.el7.centos.x86_64 2/4 验证中 : httpd-tools-2.4.6-45.el7.centos.x86_64 3/4 验证中 : httpd-2.4.6-45.el7.centos.x86_64 4/4 更新完毕: httpd.x86_64 0:2.4.6-80.el7.centos 作为依赖被升级: httpd-tools.x86_64 0:2.4.6-80.el7.centos 完毕! # 启动Apache [root@localhost sgtfz]# systemctl start httpd.service # 设置开机启动 [root@localhost sgtfz]# systemctl enable httpd.service Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. # 查看本机ip地址 [root@localhost sgtfz]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000 link/ether 00:15:5d:21:05:08 brd ff:ff:ff:ff:ff:ff inet 192.168.33.8/24 brd 192.168.33.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fd79:7e5a:2aa0::f31/128 scope global valid_lft forever preferred_lft forever inet6 fd79:7e5a:2aa0:0:5e18:682c:7f46:c53/64 scope global noprefixroute valid_lft forever preferred_lft forever inet6 fe80::4432:ed58:ee2c:98dd/64 scope link valid_lft forever preferred_lft forever 3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000 link/ether 52:54:00:13:1f:04 brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever 4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000 link/ether 52:54:00:13:1f:04 brd ff:ff:ff:ff:ff:ff # CentOS7用的是Firewall-cmd,CentOS7之前用的是iptables防火墙,要想让外网能访问到apache主目录,就需要做以下的操作 # 设置firewall防火墙 [root@localhost sgtfz]# firewall-cmd --permanent --zone=public --add-service=http success [root@localhost sgtfz]# firewall-cmd --permanent --zone=public --add-service=https success [root@localhost sgtfz]# firewall-cmd --reload success
二、安装php7.1
这一步遇到坑了,因为刚开始部署lamp环境,一切都是从0开始。所有的教程都靠搜索网络得到,都是教程片段与组合,才能一步一步的去发现问题解决问题。
一开始我是直接安装php的,根本没有考虑版本的问题。我本以为它会直接安装最新的版本,但并不是,下面是安装php的过程记录
# 安装php,本步骤没有考虑版本的问题 [root@localhost sgtfz]# yum -y install php 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirrors.ustc.edu.cn * extras: mirrors.163.com * updates: mirrors.aliyun.com 正在解决依赖关系 --> 正在检查事务 ---> 软件包 php.x86_64.0.5.4.16-45.el7 将被 安装 --> 正在处理依赖关系 php-common(x86-64) = 5.4.16-45.el7,它被软件包 php-5.4.16-45.el7.x86_64 需要 --> 正在处理依赖关系 php-cli(x86-64) = 5.4.16-45.el7,它被软件包 php-5.4.16-45.el7.x86_64 需要 --> 正在处理依赖关系 libcrypto.so.10(OPENSSL_1.0.2)(64bit),它被软件包 php-5.4.16-45.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 openssl-libs.x86_64.1.1.0.1e-60.el7 将被 升级 --> 正在处理依赖关系 openssl-libs(x86-64) = 1:1.0.1e-60.el7,它被软件包 1:openssl-1.0.1e-60.el7.x86_64 需要 ---> 软件包 openssl-libs.x86_64.1.1.0.2k-12.el7 将被 更新 ---> 软件包 php-cli.x86_64.0.5.4.16-45.el7 将被 安装 ---> 软件包 php-common.x86_64.0.5.4.16-45.el7 将被 安装 --> 正在处理依赖关系 libzip.so.2()(64bit),它被软件包 php-common-5.4.16-45.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 libzip.x86_64.0.0.10.1-8.el7 将被 安装 ---> 软件包 openssl.x86_64.1.1.0.1e-60.el7 将被 升级 ---> 软件包 openssl.x86_64.1.1.0.2k-12.el7 将被 更新 --> 解决依赖关系完成 依赖关系解决 ================================================================================ Package 架构 版本 源 大小 ================================================================================ 正在安装: php x86_64 5.4.16-45.el7 base 1.4 M 为依赖而安装: libzip x86_64 0.10.1-8.el7 base 48 k php-cli x86_64 5.4.16-45.el7 base 2.7 M php-common x86_64 5.4.16-45.el7 base 565 k 为依赖而更新: openssl x86_64 1:1.0.2k-12.el7 base 492 k openssl-libs x86_64 1:1.0.2k-12.el7 base 1.2 M 事务概要 ================================================================================ 安装 1 软件包 (+3 依赖软件包) 升级 ( 2 依赖软件包) 总下载量:6.4 M Downloading packages: No Presto metadata available for base (1/6): libzip-0.10.1-8.el7.x86_64.rpm | 48 kB 00:00 (2/6): openssl-1.0.2k-12.el7.x86_64.rpm | 492 kB 00:00 (3/6): openssl-libs-1.0.2k-12.el7.x86_64.rpm | 1.2 MB 00:00 (4/6): php-5.4.16-45.el7.x86_64.rpm | 1.4 MB 00:00 (5/6): php-cli-5.4.16-45.el7.x86_64.rpm | 2.7 MB 00:00 (6/6): php-common-5.4.16-45.el7.x86_64.rpm | 565 kB 00:00 -------------------------------------------------------------------------------- 总计 6.6 MB/s | 6.4 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在更新 : 1:openssl-libs-1.0.2k-12.el7.x86_64 1/8 正在安装 : libzip-0.10.1-8.el7.x86_64 2/8 正在安装 : php-common-5.4.16-45.el7.x86_64 3/8 正在安装 : php-cli-5.4.16-45.el7.x86_64 4/8 正在安装 : php-5.4.16-45.el7.x86_64 5/8 正在更新 : 1:openssl-1.0.2k-12.el7.x86_64 6/8 清理 : 1:openssl-1.0.1e-60.el7.x86_64 7/8 清理 : 1:openssl-libs-1.0.1e-60.el7.x86_64 8/8 验证中 : php-common-5.4.16-45.el7.x86_64 1/8 验证中 : php-5.4.16-45.el7.x86_64 2/8 验证中 : php-cli-5.4.16-45.el7.x86_64 3/8 验证中 : libzip-0.10.1-8.el7.x86_64 4/8 验证中 : 1:openssl-1.0.2k-12.el7.x86_64 5/8 验证中 : 1:openssl-libs-1.0.2k-12.el7.x86_64 6/8 验证中 : 1:openssl-libs-1.0.1e-60.el7.x86_64 7/8 验证中 : 1:openssl-1.0.1e-60.el7.x86_64 8/8 已安装: php.x86_64 0:5.4.16-45.el7 作为依赖被安装: libzip.x86_64 0:0.10.1-8.el7 php-cli.x86_64 0:5.4.16-45.el7 php-common.x86_64 0:5.4.16-45.el7 作为依赖被升级: openssl.x86_64 1:1.0.2k-12.el7 openssl-libs.x86_64 1:1.0.2k-12.el7 完毕! # 安装完毕发现有点不对,怎么版本那么低的php5.4.16 # 这个先不管版本,继续下一个步骤 # 重启httpd [root@localhost sgtfz]# systemctl restart httpd # 创建info.php文件 [root@localhost sgtfz]# vi /var/www/html/info.php # 输入i进入编辑 i <?php phpinfo(); ?> # 这个终端没有记录文本 # 编辑好按Esc再输入:wq保存退出 Esc :wq # 然后再重启一下Apache [root@localhost sgtfz]# systemctl restart httpd.service # 在浏览器输入http://虚拟机IP地址/info.php 测试可以正常看到php版本信息了,但是版本是php5.4.16 # 这个不是我要的版本,太低,因此又找了一些教程,要删除旧版本重新安装新版本 # 检查当前PHP的安装包版本 [root@localhost sgtfz]# yum list installed | grep php php.x86_64 5.4.16-45.el7 @base php-cli.x86_64 5.4.16-45.el7 @base php-common.x86_64 5.4.16-45.el7 @base # 移除当前php安装包 [root@localhost sgtfz]# yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 已加载插件:fastestmirror, langpacks 正在解决依赖关系 --> 正在检查事务 ---> 软件包 php.x86_64.0.5.4.16-45.el7 将被 删除 ---> 软件包 php-cli.x86_64.0.5.4.16-45.el7 将被 删除 ---> 软件包 php-common.x86_64.0.5.4.16-45.el7 将被 删除 --> 解决依赖关系完成 依赖关系解决 ================================================================================ Package 架构 版本 源 大小 ================================================================================ 正在删除: php x86_64 5.4.16-45.el7 @base 4.4 M php-cli x86_64 5.4.16-45.el7 @base 8.8 M php-common x86_64 5.4.16-45.el7 @base 3.8 M 事务概要 ================================================================================ 移除 3 软件包 安装大小:17 M 是否继续?[y/N]:y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction 正在删除 : php-5.4.16-45.el7.x86_64 1/3 正在删除 : php-cli-5.4.16-45.el7.x86_64 2/3 正在删除 : php-common-5.4.16-45.el7.x86_64 3/3 验证中 : php-5.4.16-45.el7.x86_64 1/3 验证中 : php-cli-5.4.16-45.el7.x86_64 2/3 验证中 : php-common-5.4.16-45.el7.x86_64 3/3 删除: php.x86_64 0:5.4.16-45.el7 php-cli.x86_64 0:5.4.16-45.el7 php-common.x86_64 0:5.4.16-45.el7 完毕! # 检查当前PHP的安装包 # yum list installed | grep php 完全移除当前PHP安装包以免起冲突 # yum remove php* # 默认的yum源无法升级PHP,需要添加第三方yum源,我们选择webtatic库 [root@localhost sgtfz]# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm 获取https://mirror.webtatic.com/yum/el7/epel-release.rpm 警告:/var/tmp/rpm-tmp.uSA1bB: 头V4 RSA/SHA1 Signature, 密钥 ID 62e74ca5: NOKEY 准备中... ################################# [100%] 软件包 epel-release-7-11.noarch (比 epel-release-7-5.noarch 还要新) 已经安装 [root@localhost sgtfz]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 获取https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 警告:/var/tmp/rpm-tmp.xvZpOX: 头V4 RSA/SHA1 Signature, 密钥 ID 62e74ca5: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:webtatic-release-7-3 ################################# [100%] # 查看yum源是否有php7.1安装包 [root@localhost sgtfz]# yum list php71 已加载插件:fastestmirror, langpacks webtatic | 3.6 kB 00:00 (1/2): webtatic/x86_64/group_gz | 448 B 00:01 (2/2): webtatic/x86_64/primary_db | 263 kB 00:01 Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirrors.ustc.edu.cn * extras: mirrors.163.com * updates: mirrors.aliyun.com * webtatic: us-east.repo.webtatic.com 错误:没有匹配的软件包可以列出 # 这里错误,不知什么问题,不管继续下一步 # 安装php7.1 [root@localhost sgtfz]# yum install -y php71w-fpm php71w-opcache php71w-cli php71w-gd php71w-mysqlnd php71w-mbstring php71w-mcrypt php71w-pdo php71w-pecl-apcu php71w-pecl-mongodb php71w-pecl-redis php71w-pgsql php71w-xml php71w-xmlrpc php71w-devel mod_php71w 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirrors.ustc.edu.cn * extras: mirrors.163.com * updates: mirrors.aliyun.com * webtatic: uk.repo.webtatic.com 正在解决依赖关系 --> 正在检查事务 ---> 软件包 mod_php71w.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-cli.x86_64.0.7.1.17-1.w7 将被 安装 --> 正在处理依赖关系 php71w-common(x86-64) = 7.1.17-1.w7,它被软件包 php71w-cli-7.1.17-1.w7.x86_64 需要 ---> 软件包 php71w-devel.x86_64.0.7.1.17-1.w7 将被 安装 --> 正在处理依赖关系 pcre-devel(x86-64),它被软件包 php71w-devel-7.1.17-1.w7.x86_64 需要 ---> 软件包 php71w-fpm.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-gd.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-mbstring.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-mcrypt.x86_64.0.7.1.17-1.w7 将被 安装 --> 正在处理依赖关系 libmcrypt.so.4()(64bit),它被软件包 php71w-mcrypt-7.1.17-1.w7.x86_64 需要 ---> 软件包 php71w-mysqlnd.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-opcache.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-pdo.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-pecl-apcu.x86_64.0.5.1.9-1.w7 将被 安装 --> 正在处理依赖关系 /usr/bin/pecl,它被软件包 php71w-pecl-apcu-5.1.9-1.w7.x86_64 需要 --> 正在处理依赖关系 /usr/bin/pecl,它被软件包 php71w-pecl-apcu-5.1.9-1.w7.x86_64 需要 ---> 软件包 php71w-pecl-mongodb.x86_64.0.1.4.1-1.w7 将被 安装 ---> 软件包 php71w-pecl-redis.x86_64.0.3.1.6-1.w7 将被 安装 --> 正在处理依赖关系 php-pecl-igbinary(x86-64),它被软件包 php71w-pecl-redis-3.1.6-1.w7.x86_64 需要 ---> 软件包 php71w-pgsql.x86_64.0.7.1.17-1.w7 将被 安装 --> 正在处理依赖关系 libpq.so.5()(64bit),它被软件包 php71w-pgsql-7.1.17-1.w7.x86_64 需要 ---> 软件包 php71w-xml.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-xmlrpc.x86_64.0.7.1.17-1.w7 将被 安装 --> 正在检查事务 ---> 软件包 libmcrypt.x86_64.0.2.5.8-13.el7 将被 安装 ---> 软件包 pcre-devel.x86_64.0.8.32-17.el7 将被 安装 --> 正在处理依赖关系 pcre(x86-64) = 8.32-17.el7,它被软件包 pcre-devel-8.32-17.el7.x86_64 需要 ---> 软件包 php71w-common.x86_64.0.7.1.17-1.w7 将被 安装 ---> 软件包 php71w-pear.noarch.1.1.10.4-1.w7 将被 安装 --> 正在处理依赖关系 php71w-posix,它被软件包 1:php71w-pear-1.10.4-1.w7.noarch 需要 ---> 软件包 php71w-pecl-igbinary.x86_64.0.2.0.5-1.w7 将被 安装 ---> 软件包 postgresql-libs.x86_64.0.9.2.23-3.el7_4 将被 安装 --> 正在检查事务 ---> 软件包 pcre.x86_64.0.8.32-15.el7_2.1 将被 升级 ---> 软件包 pcre.x86_64.0.8.32-17.el7 将被 更新 ---> 软件包 php71w-process.x86_64.0.7.1.17-1.w7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ================================================================================ Package 架构 版本 源 大小 ================================================================================ 正在安装: mod_php71w x86_64 7.1.17-1.w7 webtatic 2.9 M php71w-cli x86_64 7.1.17-1.w7 webtatic 3.0 M php71w-devel x86_64 7.1.17-1.w7 webtatic 2.6 M php71w-fpm x86_64 7.1.17-1.w7 webtatic 1.5 M php71w-gd x86_64 7.1.17-1.w7 webtatic 133 k php71w-mbstring x86_64 7.1.17-1.w7 webtatic 543 k php71w-mcrypt x86_64 7.1.17-1.w7 webtatic 25 k php71w-mysqlnd x86_64 7.1.17-1.w7 webtatic 195 k php71w-opcache x86_64 7.1.17-1.w7 webtatic 203 k php71w-pdo x86_64 7.1.17-1.w7 webtatic 89 k php71w-pecl-apcu x86_64 5.1.9-1.w7 webtatic 81 k php71w-pecl-mongodb x86_64 1.4.1-1.w7 webtatic 467 k php71w-pecl-redis x86_64 3.1.6-1.w7 webtatic 175 k php71w-pgsql x86_64 7.1.17-1.w7 webtatic 88 k php71w-xml x86_64 7.1.17-1.w7 webtatic 127 k php71w-xmlrpc x86_64 7.1.17-1.w7 webtatic 46 k 为依赖而安装: libmcrypt x86_64 2.5.8-13.el7 epel 99 k pcre-devel x86_64 8.32-17.el7 base 480 k php71w-common x86_64 7.1.17-1.w7 webtatic 1.2 M php71w-pear noarch 1:1.10.4-1.w7 webtatic 340 k php71w-pecl-igbinary x86_64 2.0.5-1.w7 webtatic 96 k php71w-process x86_64 7.1.17-1.w7 webtatic 38 k postgresql-libs x86_64 9.2.23-3.el7_4 base 234 k 为依赖而更新: pcre x86_64 8.32-17.el7 base 422 k 事务概要 ================================================================================ 安装 16 软件包 (+7 依赖软件包) 升级 ( 1 依赖软件包) 总下载量:15 M Downloading packages: No Presto metadata available for base (1/24): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00 (2/24): pcre-8.32-17.el7.x86_64.rpm | 422 kB 00:00 (3/24): libmcrypt-2.5.8-13.el7.x86_64.rpm | 99 kB 00:00 warning: /var/cache/yum/x86_64/7/webtatic/packages/mod_php71w-7.1.17-1.w7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY mod_php71w-7.1.17-1.w7.x86_64.rpm 的公钥尚未安装 (4/24): mod_php71w-7.1.17-1.w7.x86_64.rpm | 2.9 MB 00:03 (5/24): php71w-gd-7.1.17-1.w7.x86_64.rpm | 133 kB 00:00 (6/24): php71w-common-7.1.17-1.w7.x86_64.rpm | 1.2 MB 00:04 (7/24): php71w-devel-7.1.17-1.w7.x86_64.rpm | 2.6 MB 00:04 (8/24): php71w-mcrypt-7.1.17-1.w7.x86_64.rpm | 25 kB 00:00 (9/24): php71w-mbstring-7.1.17-1.w7.x86_64.rpm | 543 kB 00:01 (10/24): php71w-mysqlnd-7.1.17-1.w7.x86_64.rpm | 195 kB 00:00 (11/24): php71w-opcache-7.1.17-1.w7.x86_64.rpm | 203 kB 00:00 (12/24): php71w-pecl-apcu-5.1.9-1.w7.x86_64.rpm | 81 kB 00:00 (13/24): php71w-pear-1.10.4-1.w7.noarch.rpm | 340 kB 00:00 (14/24): php71w-pecl-igbinary-2.0.5-1.w7.x86_64.rpm | 96 kB 00:00 (15/24): php71w-pecl-redis-3.1.6-1.w7.x86_64.rpm | 175 kB 00:00 (16/24): php71w-pdo-7.1.17-1.w7.x86_64.rpm | 89 kB 00:00 (17/24): php71w-pgsql-7.1.17-1.w7.x86_64.rpm | 88 kB 00:00 (18/24): php71w-process-7.1.17-1.w7.x86_64.rpm | 38 kB 00:00 (19/24): php71w-pecl-mongodb-1.4.1-1.w7.x86_64.rpm | 467 kB 00:00 (20/24): php71w-xml-7.1.17-1.w7.x86_64.rpm | 127 kB 00:00 (21/24): php71w-xmlrpc-7.1.17-1.w7.x86_64.rpm | 46 kB 00:00 (22/24): postgresql-libs-9.2.23-3.el7_4.x86_64.rpm | 234 kB 00:00 (23/24): php71w-fpm-7.1.17-1.w7.x86_64.rpm | 1.5 MB 00:13 (24/24): php71w-cli-7.1.17-1.w7.x86_64.rpm | 3.0 MB 00:18 -------------------------------------------------------------------------------- 总计 802 kB/s | 15 MB 00:19 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-el7 检索密钥 导入 GPG key 0x62E74CA5: 用户ID : "Webtatic EL7 <rpms@webtatic.com>" 指纹 : 830d b159 6d9b 9b01 99dc 24a3 e87f d236 62e7 4ca5 软件包 : webtatic-release-7-3.noarch (installed) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-el7 Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM 数据库已被非 yum 程序修改。 ** 发现 6 个已存在的 RPM 数据库问题, 'yum check' 输出如下: ipa-admintools-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-admintools: ipa-admintools-4.4.0-12.el7.centos.noarch ipa-client-4.4.0-12.el7.centos.x86_64 有已安装冲突 freeipa-client: ipa-client-4.4.0-12.el7.centos.x86_64 ipa-client-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-client-common: ipa-client-common-4.4.0-12.el7.centos.noarch ipa-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-common: ipa-common-4.4.0-12.el7.centos.noarch ipa-server-4.4.0-12.el7.centos.x86_64 有已安装冲突 freeipa-server: ipa-server-4.4.0-12.el7.centos.x86_64 ipa-server-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-server-common: ipa-server-common-4.4.0-12.el7.centos.noarch 正在安装 : php71w-common-7.1.17-1.w7.x86_64 1/25 正在安装 : php71w-pdo-7.1.17-1.w7.x86_64 2/25 正在安装 : php71w-cli-7.1.17-1.w7.x86_64 3/25 正在安装 : php71w-process-7.1.17-1.w7.x86_64 4/25 正在安装 : php71w-xml-7.1.17-1.w7.x86_64 5/25 正在安装 : 1:php71w-pear-1.10.4-1.w7.noarch 6/25 正在安装 : php71w-pecl-igbinary-2.0.5-1.w7.x86_64 7/25 正在安装 : postgresql-libs-9.2.23-3.el7_4.x86_64 8/25 正在安装 : libmcrypt-2.5.8-13.el7.x86_64 9/25 正在更新 : pcre-8.32-17.el7.x86_64 10/25 正在安装 : pcre-devel-8.32-17.el7.x86_64 11/25 正在安装 : php71w-devel-7.1.17-1.w7.x86_64 12/25 正在安装 : php71w-mcrypt-7.1.17-1.w7.x86_64 13/25 正在安装 : php71w-pgsql-7.1.17-1.w7.x86_64 14/25 正在安装 : php71w-pecl-redis-3.1.6-1.w7.x86_64 15/25 正在安装 : php71w-pecl-apcu-5.1.9-1.w7.x86_64 16/25 正在安装 : php71w-pecl-mongodb-1.4.1-1.w7.x86_64 17/25 正在安装 : php71w-mysqlnd-7.1.17-1.w7.x86_64 18/25 正在安装 : php71w-xmlrpc-7.1.17-1.w7.x86_64 19/25 正在安装 : php71w-gd-7.1.17-1.w7.x86_64 20/25 正在安装 : php71w-fpm-7.1.17-1.w7.x86_64 21/25 正在安装 : php71w-mbstring-7.1.17-1.w7.x86_64 22/25 正在安装 : php71w-opcache-7.1.17-1.w7.x86_64 23/25 正在安装 : mod_php71w-7.1.17-1.w7.x86_64 24/25 清理 : pcre-8.32-15.el7_2.1.x86_64 25/25 验证中 : 1:php71w-pear-1.10.4-1.w7.noarch 1/25 验证中 : pcre-devel-8.32-17.el7.x86_64 2/25 验证中 : php71w-xmlrpc-7.1.17-1.w7.x86_64 3/25 验证中 : pcre-8.32-17.el7.x86_64 4/25 验证中 : php71w-process-7.1.17-1.w7.x86_64 5/25 验证中 : libmcrypt-2.5.8-13.el7.x86_64 6/25 验证中 : php71w-mysqlnd-7.1.17-1.w7.x86_64 7/25 验证中 : php71w-pecl-apcu-5.1.9-1.w7.x86_64 8/25 验证中 : php71w-pgsql-7.1.17-1.w7.x86_64 9/25 验证中 : php71w-gd-7.1.17-1.w7.x86_64 10/25 验证中 : php71w-pdo-7.1.17-1.w7.x86_64 11/25 验证中 : postgresql-libs-9.2.23-3.el7_4.x86_64 12/25 验证中 : php71w-cli-7.1.17-1.w7.x86_64 13/25 验证中 : mod_php71w-7.1.17-1.w7.x86_64 14/25 验证中 : php71w-fpm-7.1.17-1.w7.x86_64 15/25 验证中 : php71w-pecl-redis-3.1.6-1.w7.x86_64 16/25 验证中 : php71w-xml-7.1.17-1.w7.x86_64 17/25 验证中 : php71w-pecl-igbinary-2.0.5-1.w7.x86_64 18/25 验证中 : php71w-common-7.1.17-1.w7.x86_64 19/25 验证中 : php71w-pecl-mongodb-1.4.1-1.w7.x86_64 20/25 验证中 : php71w-mbstring-7.1.17-1.w7.x86_64 21/25 验证中 : php71w-devel-7.1.17-1.w7.x86_64 22/25 验证中 : php71w-opcache-7.1.17-1.w7.x86_64 23/25 验证中 : php71w-mcrypt-7.1.17-1.w7.x86_64 24/25 验证中 : pcre-8.32-15.el7_2.1.x86_64 25/25 已安装: mod_php71w.x86_64 0:7.1.17-1.w7 php71w-cli.x86_64 0:7.1.17-1.w7 php71w-devel.x86_64 0:7.1.17-1.w7 php71w-fpm.x86_64 0:7.1.17-1.w7 php71w-gd.x86_64 0:7.1.17-1.w7 php71w-mbstring.x86_64 0:7.1.17-1.w7 php71w-mcrypt.x86_64 0:7.1.17-1.w7 php71w-mysqlnd.x86_64 0:7.1.17-1.w7 php71w-opcache.x86_64 0:7.1.17-1.w7 php71w-pdo.x86_64 0:7.1.17-1.w7 php71w-pecl-apcu.x86_64 0:5.1.9-1.w7 php71w-pecl-mongodb.x86_64 0:1.4.1-1.w7 php71w-pecl-redis.x86_64 0:3.1.6-1.w7 php71w-pgsql.x86_64 0:7.1.17-1.w7 php71w-xml.x86_64 0:7.1.17-1.w7 php71w-xmlrpc.x86_64 0:7.1.17-1.w7 作为依赖被安装: libmcrypt.x86_64 0:2.5.8-13.el7 pcre-devel.x86_64 0:8.32-17.el7 php71w-common.x86_64 0:7.1.17-1.w7 php71w-pear.noarch 1:1.10.4-1.w7 php71w-pecl-igbinary.x86_64 0:2.0.5-1.w7 php71w-process.x86_64 0:7.1.17-1.w7 postgresql-libs.x86_64 0:9.2.23-3.el7_4 作为依赖被升级: pcre.x86_64 0:8.32-17.el7 完毕! # 成功安装php7.1 # 查看当前php版本 [root@localhost sgtfz]# php -v PHP 7.1.17 (cli) (built: Apr 28 2018 07:52:48) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.1.17, Copyright (c) 1999-2018, by Zend Technologies
三、安装MySQL5.7
安装MySQL5.7又遇到了一些冲突,下面是过程记录
# 下载mysql的repo源,这源下载的是最新的mysql版本 [root@localhost sgtfz]# cd /usr/local/src/ [root@localhost src]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm --2018-05-27 17:26:48-- http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 正在解析主机 repo.mysql.com (repo.mysql.com)... 23.45.185.161 正在连接 repo.mysql.com (repo.mysql.com)|23.45.185.161|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:9116 (8.9K) [application/x-redhat-package-manager] 正在保存至: “mysql57-community-release-el7-8.noarch.rpm” 100%[======================================>] 9,116 --.-K/s 用时 0s 2018-05-27 17:26:48 (121 MB/s) - 已保存 “mysql57-community-release-el7-8.noarch.rpm” [9116/9116]) [root@localhost src]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm 警告:mysql57-community-release-el7-8.noarch.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:mysql57-community-release-el7-8 ################################# [100%] # 到这一步出错,发现有冲突 [root@localhost src]# yum -y install mysql-server 已加载插件:fastestmirror, langpacks mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql57-community | 2.5 kB 00:00 (1/3): mysql-connectors-community/x86_64/primary_db | 20 kB 00:00 (2/3): mysql-tools-community/x86_64/primary_db | 41 kB 00:00 (3/3): mysql57-community/x86_64/primary_db | 144 kB 00:00 Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirrors.ustc.edu.cn * extras: mirrors.163.com * updates: mirrors.aliyun.com * webtatic: uk.repo.webtatic.com 正在解决依赖关系 --> 正在检查事务 ---> 软件包 mariadb-server.x86_64.1.5.5.52-1.el7 将被 取代 --> 正在处理依赖关系 mariadb-server,它被软件包 akonadi-mysql-1.9.2-4.el7.x86_64 需要 ---> 软件包 mysql-community-server.x86_64.0.5.7.22-1.el7 将被 舍弃 --> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.22-1.el7,它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要 --> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 mariadb.x86_64.1.5.5.52-1.el7 将被 取代 ---> 软件包 mariadb-server.x86_64.1.5.5.52-1.el7 将被 升级 ---> 软件包 mariadb-server.x86_64.1.5.5.56-2.el7 将被 更新 --> 正在处理依赖关系 mariadb-libs(x86-64) = 1:5.5.56-2.el7,它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要 --> 正在处理依赖关系 mariadb(x86-64) = 1:5.5.56-2.el7,它被软件包 1:mariadb-server-5.5.56-2.el7.x86_64 需要 ---> 软件包 mysql-community-client.x86_64.0.5.7.22-1.el7 将被 舍弃 --> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.22-1.el7.x86_64 需要 ---> 软件包 mysql-community-common.x86_64.0.5.7.22-1.el7 将被 安装 --> 正在检查事务 ---> 软件包 mariadb.x86_64.1.5.5.52-1.el7 将被 升级 ---> 软件包 mariadb.x86_64.1.5.5.56-2.el7 将被 更新 ---> 软件包 mariadb-libs.x86_64.1.5.5.52-1.el7 将被 取代 ---> 软件包 mariadb-libs.x86_64.1.5.5.52-1.el7 将被 升级 ---> 软件包 mariadb-libs.x86_64.1.5.5.56-2.el7 将被 更新 ---> 软件包 mysql-community-libs.x86_64.0.5.7.22-1.el7 将被 舍弃 ---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.22-1.el7 将被 舍弃 Removing mariadb-libs.x86_64 1:5.5.56-2.el7 - u due to obsoletes from mysql-community-libs-compat.x86_64 0:5.7.22-1.el7 - u base/7/x86_64/filelists_db | 6.9 MB 00:00 Removing mariadb-server.x86_64 1:5.5.56-2.el7 - u due to obsoletes from mysql-community-server.x86_64 0:5.7.22-1.el7 - u Removing mariadb.x86_64 1:5.5.56-2.el7 - u due to obsoletes from mysql-community-client.x86_64 0:5.7.22-1.el7 - u --> 正在使用新的信息重新解决依赖关系 --> 正在检查事务 ---> 软件包 mariadb.x86_64.1.5.5.56-2.el7 将被 更新 ---> 软件包 mariadb-libs.x86_64.1.5.5.56-2.el7 将被 更新 ---> 软件包 mariadb-server.x86_64.1.5.5.56-2.el7 将被 更新 --> 正在处理依赖关系 mariadb-server,它被软件包 akonadi-mysql-1.9.2-4.el7.x86_64 需要 --> 解决依赖关系完成 错误:软件包:akonadi-mysql-1.9.2-4.el7.x86_64 (@anaconda) 需要:mariadb-server 正在删除: 1:mariadb-server-5.5.52-1.el7.x86_64 (@anaconda) mariadb-server = 1:5.5.52-1.el7 取代,由: mysql-community-server-5.7.22-1.el7.x86_64 (mysql57-community) 未找到 更新,由: 1:mariadb-server-5.5.56-2.el7.x86_64 (base) mariadb-server = 1:5.5.56-2.el7 您可以尝试添加 --skip-broken 选项来解决该问题 ** 发现 6 个已存在的 RPM 数据库问题, 'yum check' 输出如下: ipa-admintools-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-admintools: ipa-admintools-4.4.0-12.el7.centos.noarch ipa-client-4.4.0-12.el7.centos.x86_64 有已安装冲突 freeipa-client: ipa-client-4.4.0-12.el7.centos.x86_64 ipa-client-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-client-common: ipa-client-common-4.4.0-12.el7.centos.noarch ipa-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-common: ipa-common-4.4.0-12.el7.centos.noarch ipa-server-4.4.0-12.el7.centos.x86_64 有已安装冲突 freeipa-server: ipa-server-4.4.0-12.el7.centos.x86_64 ipa-server-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-server-common: ipa-server-common-4.4.0-12.el7.centos.noarch # 由于Mysql被Oracle收购,所以从Centos7开始不再默认安装Mysql而用Mariadb代替,需要使用一些方法才能正确安装Mysql # 首先卸载Mariadb,否则安装Mysql会产生冲突 # 查看mariadb安装包 [root@localhost src]# cd [root@localhost ~]# rpm -qa | grep mariadb mariadb-server-5.5.52-1.el7.x86_64 mariadb-libs-5.5.52-1.el7.x86_64 mariadb-5.5.52-1.el7.x86_64 # 卸载mariadb安装包 [root@localhost ~]# rpm -e --nodeps mariadb-5.5.52-1.el7.x86_64 mariadb-libs-5.5.52-1.el7.x86_64 mariadb-server-5.5.52-1.el7.x86_64 [root@localhost ~]# rpm -qa | grep mariadb # 再次继续安装mysql57,成功了 [root@localhost ~]# yum -y install mysql-community-server 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirror01.idc.hinet.net * extras: mirrors.163.com * updates: mirrors.aliyun.com * webtatic: uk.repo.webtatic.com 正在解决依赖关系 --> 正在检查事务 ---> 软件包 mysql-community-server.x86_64.0.5.7.22-1.el7 将被 安装 --> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.22-1.el7,它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要 --> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-community-server-5.7.22-1.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 mysql-community-client.x86_64.0.5.7.22-1.el7 将被 安装 --> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.22-1.el7.x86_64 需要 ---> 软件包 mysql-community-common.x86_64.0.5.7.22-1.el7 将被 安装 --> 正在检查事务 ---> 软件包 mysql-community-libs.x86_64.0.5.7.22-1.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ================================================================================ Package 架构 版本 源 大小 ================================================================================ 正在安装: mysql-community-server x86_64 5.7.22-1.el7 mysql57-community 165 M 为依赖而安装: mysql-community-client x86_64 5.7.22-1.el7 mysql57-community 24 M mysql-community-common x86_64 5.7.22-1.el7 mysql57-community 274 k mysql-community-libs x86_64 5.7.22-1.el7 mysql57-community 2.1 M 事务概要 ================================================================================ 安装 1 软件包 (+3 依赖软件包) 总下载量:191 M 安装大小:862 M Downloading packages: 警告:/var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY mysql-community-common-5.7.22-1.el7.x86_64.rpm 的公钥尚未安装 (1/4): mysql-community-common-5.7.22-1.el7.x86_64.rpm | 274 kB 00:01 (2/4): mysql-community-libs-5.7.22-1.el7.x86_64.rpm | 2.1 MB 00:01 (3/4): mysql-community-client-5.7.22-1.el7.x86_64.rpm | 24 MB 00:05 (4/4): mysql-community-server-5.7.22-1.el7.x86_64.rpm | 165 MB 00:33 -------------------------------------------------------------------------------- 总计 5.4 MB/s | 191 MB 00:35 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥 导入 GPG key 0x5072E1F5: 用户ID : "MySQL Release Engineering <mysql-build@oss.oracle.com>" 指纹 : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 软件包 : mysql57-community-release-el7-8.noarch (installed) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM 数据库已被非 yum 程序修改。 ** 发现 15 个已存在的 RPM 数据库问题, 'yum check' 输出如下: akonadi-mysql-1.9.2-4.el7.x86_64 有缺少的需求 mariadb-server ipa-admintools-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-admintools: ipa-admintools-4.4.0-12.el7.centos.noarch ipa-client-4.4.0-12.el7.centos.x86_64 有已安装冲突 freeipa-client: ipa-client-4.4.0-12.el7.centos.x86_64 ipa-client-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-client-common: ipa-client-common-4.4.0-12.el7.centos.noarch ipa-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-common: ipa-common-4.4.0-12.el7.centos.noarch ipa-server-4.4.0-12.el7.centos.x86_64 有已安装冲突 freeipa-server: ipa-server-4.4.0-12.el7.centos.x86_64 ipa-server-common-4.4.0-12.el7.centos.noarch 有已安装冲突 freeipa-server-common: ipa-server-common-4.4.0-12.el7.centos.noarch 1:net-snmp-5.7.2-24.el7_2.1.x86_64 有缺少的需求 libmysqlclient.so.18()(64bit) 1:net-snmp-5.7.2-24.el7_2.1.x86_64 有缺少的需求 mysql-libs perl-DBD-MySQL-4.023-5.el7.x86_64 有缺少的需求 libmysqlclient.so.18()(64bit) perl-DBD-MySQL-4.023-5.el7.x86_64 有缺少的需求 libmysqlclient.so.18(libmysqlclient_18)(64bit) 2:postfix-2.10.1-6.el7.x86_64 有缺少的需求 libmysqlclient.so.18()(64bit) 2:postfix-2.10.1-6.el7.x86_64 有缺少的需求 libmysqlclient.so.18(libmysqlclient_18)(64bit) 1:qt-mysql-4.8.5-13.el7.x86_64 有缺少的需求 libmysqlclient.so.18()(64bit) 1:qt-mysql-4.8.5-13.el7.x86_64 有缺少的需求 libmysqlclient.so.18(libmysqlclient_18)(64bit) 正在安装 : mysql-community-common-5.7.22-1.el7.x86_64 1/4 正在安装 : mysql-community-libs-5.7.22-1.el7.x86_64 2/4 正在安装 : mysql-community-client-5.7.22-1.el7.x86_64 3/4 正在安装 : mysql-community-server-5.7.22-1.el7.x86_64 4/4 验证中 : mysql-community-client-5.7.22-1.el7.x86_64 1/4 验证中 : mysql-community-libs-5.7.22-1.el7.x86_64 2/4 验证中 : mysql-community-common-5.7.22-1.el7.x86_64 3/4 验证中 : mysql-community-server-5.7.22-1.el7.x86_64 4/4 已安装: mysql-community-server.x86_64 0:5.7.22-1.el7 作为依赖被安装: mysql-community-client.x86_64 0:5.7.22-1.el7 mysql-community-common.x86_64 0:5.7.22-1.el7 mysql-community-libs.x86_64 0:5.7.22-1.el7 完毕! # 完成安装mysql57 # 启动mysql5.7 [root@localhost ~]# systemctl start mysqld # 获取安装时的临时密码 [root@localhost ~]# grep 'temporary password' /var/log/mysqld.log 2018-05-27T10:03:55.149987Z 1 [Note] A temporary password is generated for root@localhost: oeyACpaVs2_Y # 登录 [root@localhost ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.22 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # 修改mysql root密码 mysql> set password=password("这里填密码必须大小写+数字+字符"); Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> \q Bye # 重启mysql [root@localhost ~]# systemctl restart mysqld # 再次登录验证密码是否修改成功 [root@localhost ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.22 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> # 使用新密码登录成功
AMP三件头安装完成,下一步继续配置。