默認的yum網絡源的服務器是在國外的,在國內下載安裝包的速度可能會比較慢,咱們能夠更換成爲國內的下載源,提升yum工具下載的速度。php
[base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
咱們把配置文件刪掉,從新下載一個yum國內源的配置文件html
[root@lgs-01 ~]# ls -l /etc/yum.repos.d 總用量 4 -rw-r--r--. 1 root root 63 4月 18 22:26 dvd.repo [root@lgs-01 ~]# mv /etc/yum.repos.d/dvd.repo /etc/yum.repos.d.bak/ [root@lgs-01 ~]# ls -l /etc/yum.repos.d 總用量 0 [root@lgs-01 ~]# ls -l /etc/yum.repos.d.bak/ 總用量 40 -rw-r--r--. 1 root root 1664 4月 18 22:23 CentOS-Base.repo -rw-r--r--. 1 root root 1309 4月 18 22:23 CentOS-CR.repo -rw-r--r--. 1 root root 649 4月 18 22:23 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 4月 18 22:23 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 4月 18 22:23 CentOS-Media.repo -rw-r--r--. 1 root root 1331 4月 18 22:23 CentOS-Sources.repo -rw-r--r--. 1 root root 3830 4月 18 22:23 CentOS-Vault.repo -rw-r--r--. 1 root root 63 4月 18 22:26 dvd.repo -rw-r--r--. 1 root root 951 4月 18 22:23 epel.repo -rw-r--r--. 1 root root 1050 4月 18 22:23 epel-testing.repo [root@lgs-01 ~]# cd /etc/yum.repos.d/ [root@lgs-01 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo --2018-04-20 00:06:42-- http://mirrors.163.com/.help/CentOS7-Base-163.repo 正在解析主機 mirrors.163.com (mirrors.163.com)... 59.111.0.251 正在鏈接 mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:1572 (1.5K) [application/octet-stream] 正在保存至: 「CentOS7-Base-163.repo」 100%[=========================================================================================================>] 1,572 --.-K/s 用時 0s 2018-04-20 00:06:42 (80.3 MB/s) - 已保存 「CentOS7-Base-163.repo」 [1572/1572]) [root@lgs-01 yum.repos.d]# ls CentOS7-Base-163.repo
國內的源地址是:mysql
[base] name=CentOS-$releasever - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
從新yum list 查看一下全部的rpm包:linux
[root@lgs-01 yum.repos.d]# yum list #節省部分 yum-plugin-versionlock.noarch 1.1.31-42.el7 base yum-rhn-plugin.noarch 2.0.1-9.el7 base yum-updateonboot.noarch 1.1.31-42.el7 base yum-utils.noarch 1.1.31-42.el7 base zlib.i686 1.2.7-17.el7 base zlib-devel.i686 1.2.7-17.el7 base zlib-static.i686 1.2.7-17.el7 base zlib-static.x86_64 1.2.7-17.el7 base zsh.x86_64 5.0.2-28.el7 base zsh-html.x86_64 5.0.2-28.el7 base zziplib.i686 0.13.62-5.el7 base zziplib-devel.i686 0.13.62-5.el7 base zziplib-devel.x86_64 0.13.62-5.el7 base zziplib-utils.x86_64 0.13.62-5.el7 base
基礎base源可能沒有一些rpm包,能夠安裝擴展源 epel-releasesql
安裝完在 /etc/yum.repo.d/ 下 多了一個epel.repo的配置文件apache
[root@lgs-01 yum.repos.d]# yum install -y epel-release 已加載插件:fastestmirror Loading mirror speeds from cached hostfile 匹配 epel-release-7-9.noarch 的軟件包已經安裝。正在檢查更新。 無須任何處理 [root@lgs-01 yum.repos.d]# ls -l . 總用量 12 -rw-r--r--. 1 root root 1572 12月 1 2016 CentOS7-Base-163.repo -rw-r--r--. 1 root root 951 4月 20 00:23 epel.repo -rw-r--r--. 1 root root 1050 4月 20 00:23 epel-testing.repo [root@lgs-01 yum.repos.d]# yum list |grep epel zsh-lovers.noarch 0.9.0-1.el7 epel zstd.x86_64 1.3.4-1.el7 epel zulucrypt.x86_64 5.0.1-1.el7 epel zulucrypt-console.x86_64 5.0.1-1.el7 epel zulucrypt-devel.x86_64 5.0.1-1.el7 epel zulucrypt-doc.noarch 5.0.1-1.el7 epel zulucrypt-libs.x86_64 5.0.1-1.el7 epel zvbi.x86_64 0.2.35-1.el7 epel zvbi-devel.x86_64 0.2.35-1.el7 epel zvbi-fonts.noarch 0.2.35-1.el7 epel
能夠只下載未安裝過的rpm包,而不自動安裝:能夠指定目錄,若是不指定會下載到:centos
默認目錄 /var/cache/yum/x86_64/7/下api
[root@lgs-01 yum.repos.d]# yum install zziplib-devel --downloadonly --downloaddir=/root/ 已加載插件:fastestmirror epel/x86_64/metalink | 7.4 kB 00:00:00 epel | 4.7 kB 00:00:00 epel/x86_64/primary_db FAILED http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/repodata/c3839328724bd9c20388e2708eb06091cf21ffcf69fab7a36bf2d1aca06599ce-primary.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found 正在嘗試其它鏡像。 To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623 If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/ epel/x86_64/primary_db FAILED ] 27 kB/s | 57 kB 00:04:32 ETA http://mirrors.nipa.cloud/epel/7/x86_64/repodata/c3839328724bd9c20388e2708eb06091cf21ffcf69fab7a36bf2d1aca06599ce-primary.sqlite.bz2: [Errno 14] HTTP Error 404 - Not Found 正在嘗試其它鏡像。 (1/2): epel/x86_64/primary_db | 6.3 MB 00:00:09 epel/x86_64/updateinfo FAILED ============================= ] 239 B/s | 6.5 MB 00:50:08 ETA http://mirror.vinahost.vn/epel/7/x86_64/repodata/6f6d844e829051d008f1c242563c3e5c1e8e329edac753bb733f7d896c18698e-updateinfo.xml.bz2: [Errno 12] Timeout on http://mirror.vinahost.vn/epel/7/x86_64/repodata/6f6d844e829051d008f1c242563c3e5c1e8e329edac753bb733f7d896c18698e-updateinfo.xml.bz2: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds') 正在嘗試其它鏡像。 (2/2): epel/x86_64/updateinfo | 916 kB 00:00:08 Loading mirror speeds from cached hostfile * epel: ftp.cuhk.edu.hk 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 zziplib-devel.x86_64.0.0.13.62-5.el7 將被 安裝 --> 正在處理依賴關係 pkgconfig(sdl),它被軟件包 zziplib-devel-0.13.62-5.el7.x86_64 須要 --> 正在處理依賴關係 SDL-devel,它被軟件包 zziplib-devel-0.13.62-5.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 SDL-devel.x86_64.0.1.2.15-14.el7 將被 安裝 --> 正在處理依賴關係 SDL(x86-64) = 1.2.15-14.el7,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 mesa-libGLU-devel,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 mesa-libGL-devel,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 libXrender-devel,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 libXrandr-devel,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 libXext-devel,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 libX11-devel,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 alsa-lib-devel,它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在處理依賴關係 libSDL-1.2.so.0()(64bit),它被軟件包 SDL-devel-1.2.15-14.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 SDL.x86_64.0.1.2.15-14.el7 將被 安裝 ---> 軟件包 alsa-lib-devel.x86_64.0.1.1.3-3.el7 將被 安裝 ---> 軟件包 libX11-devel.x86_64.0.1.6.5-1.el7 將被 安裝 --> 正在處理依賴關係 pkgconfig(xcb) >= 1.11.1,它被軟件包 libX11-devel-1.6.5-1.el7.x86_64 須要 --> 正在處理依賴關係 pkgconfig(xproto),它被軟件包 libX11-devel-1.6.5-1.el7.x86_64 須要 --> 正在處理依賴關係 pkgconfig(xcb),它被軟件包 libX11-devel-1.6.5-1.el7.x86_64 須要 --> 正在處理依賴關係 pkgconfig(kbproto),它被軟件包 libX11-devel-1.6.5-1.el7.x86_64 須要 ---> 軟件包 libXext-devel.x86_64.0.1.3.3-3.el7 將被 安裝 ---> 軟件包 libXrandr-devel.x86_64.0.1.5.1-2.el7 將被 安裝 ---> 軟件包 libXrender-devel.x86_64.0.0.9.10-1.el7 將被 安裝 ---> 軟件包 mesa-libGL-devel.x86_64.0.17.0.1-6.20170307.el7 將被 安裝 --> 正在處理依賴關係 pkgconfig(libdrm) >= 2.4.66,它被軟件包 mesa-libGL-devel-17.0.1-6.20170307.el7.x86_64 須要 --> 正在處理依賴關係 pkgconfig(xxf86vm),它被軟件包 mesa-libGL-devel-17.0.1-6.20170307.el7.x86_64 須要 --> 正在處理依賴關係 pkgconfig(xfixes),它被軟件包 mesa-libGL-devel-17.0.1-6.20170307.el7.x86_64 須要 --> 正在處理依賴關係 pkgconfig(xdamage),它被軟件包 mesa-libGL-devel-17.0.1-6.20170307.el7.x86_64 須要 --> 正在處理依賴關係 gl-manpages,它被軟件包 mesa-libGL-devel-17.0.1-6.20170307.el7.x86_64 須要 ---> 軟件包 mesa-libGLU-devel.x86_64.0.9.0.0-4.el7 將被 安裝 --> 正在處理依賴關係 mesa-libGLU(x86-64) = 9.0.0-4.el7,它被軟件包 mesa-libGLU-devel-9.0.0-4.el7.x86_64 須要 --> 正在處理依賴關係 libGLU.so.1()(64bit),它被軟件包 mesa-libGLU-devel-9.0.0-4.el7.x86_64 須要 --> 正在檢查事務 ---> 軟件包 gl-manpages.noarch.0.1.1-7.20130122.el7 將被 安裝 ---> 軟件包 libXdamage-devel.x86_64.0.1.1.4-4.1.el7 將被 安裝 ---> 軟件包 libXfixes-devel.x86_64.0.5.0.3-1.el7 將被 安裝 ---> 軟件包 libXxf86vm-devel.x86_64.0.1.1.4-1.el7 將被 安裝 ---> 軟件包 libdrm-devel.x86_64.0.2.4.74-1.el7 將被 安裝 ---> 軟件包 libxcb-devel.x86_64.0.1.12-1.el7 將被 安裝 --> 正在處理依賴關係 pkgconfig(xau) >= 0.99.2,它被軟件包 libxcb-devel-1.12-1.el7.x86_64 須要 ---> 軟件包 mesa-libGLU.x86_64.0.9.0.0-4.el7 將被 安裝 ---> 軟件包 xorg-x11-proto-devel.noarch.0.7.7-20.el7 將被 安裝 --> 正在檢查事務 ---> 軟件包 libXau-devel.x86_64.0.1.0.8-2.1.el7 將被 安裝 --> 解決依賴關係完成 依賴關係解決 =================================================================================================================================================== Package 架構 版本 源 大小 =================================================================================================================================================== 正在安裝: zziplib-devel x86_64 0.13.62-5.el7 base 137 k 爲依賴而安裝: SDL x86_64 1.2.15-14.el7 base 204 k SDL-devel x86_64 1.2.15-14.el7 base 355 k alsa-lib-devel x86_64 1.1.3-3.el7 base 957 k gl-manpages noarch 1.1-7.20130122.el7 base 994 k libX11-devel x86_64 1.6.5-1.el7 base 980 k libXau-devel x86_64 1.0.8-2.1.el7 base 14 k libXdamage-devel x86_64 1.1.4-4.1.el7 base 9.7 k libXext-devel x86_64 1.3.3-3.el7 base 75 k libXfixes-devel x86_64 5.0.3-1.el7 base 13 k libXrandr-devel x86_64 1.5.1-2.el7 base 21 k libXrender-devel x86_64 0.9.10-1.el7 base 17 k libXxf86vm-devel x86_64 1.1.4-1.el7 base 18 k libdrm-devel x86_64 2.4.74-1.el7 base 120 k libxcb-devel x86_64 1.12-1.el7 base 1.0 M mesa-libGL-devel x86_64 17.0.1-6.20170307.el7 base 151 k mesa-libGLU x86_64 9.0.0-4.el7 base 196 k mesa-libGLU-devel x86_64 9.0.0-4.el7 base 9.0 k xorg-x11-proto-devel noarch 7.7-20.el7 base 284 k 事務概要 =================================================================================================================================================== 安裝 1 軟件包 (+18 依賴軟件包) 總下載量:5.5 M 安裝大小:24 M Background downloading packages, then exiting: (1/19): SDL-1.2.15-14.el7.x86_64.rpm | 204 kB 00:00:00 (2/19): SDL-devel-1.2.15-14.el7.x86_64.rpm | 355 kB 00:00:00 (3/19): alsa-lib-devel-1.1.3-3.el7.x86_64.rpm | 957 kB 00:00:00 (4/19): gl-manpages-1.1-7.20130122.el7.noarch.rpm | 994 kB 00:00:00 (5/19): libXau-devel-1.0.8-2.1.el7.x86_64.rpm | 14 kB 00:00:00 (6/19): libXdamage-devel-1.1.4-4.1.el7.x86_64.rpm | 9.7 kB 00:00:00 (7/19): libXext-devel-1.3.3-3.el7.x86_64.rpm | 75 kB 00:00:00 (8/19): libXfixes-devel-5.0.3-1.el7.x86_64.rpm | 13 kB 00:00:00 (9/19): libXrandr-devel-1.5.1-2.el7.x86_64.rpm | 21 kB 00:00:00 (10/19): libXrender-devel-0.9.10-1.el7.x86_64.rpm | 17 kB 00:00:00 (11/19): libXxf86vm-devel-1.1.4-1.el7.x86_64.rpm | 18 kB 00:00:00 (12/19): libdrm-devel-2.4.74-1.el7.x86_64.rpm | 120 kB 00:00:00 (13/19): libX11-devel-1.6.5-1.el7.x86_64.rpm | 980 kB 00:00:00 (14/19): mesa-libGL-devel-17.0.1-6.20170307.el7.x86_64.rpm | 151 kB 00:00:00 (15/19): mesa-libGLU-9.0.0-4.el7.x86_64.rpm | 196 kB 00:00:00 (16/19): mesa-libGLU-devel-9.0.0-4.el7.x86_64.rpm | 9.0 kB 00:00:00 (17/19): libxcb-devel-1.12-1.el7.x86_64.rpm | 1.0 MB 00:00:00 (18/19): xorg-x11-proto-devel-7.7-20.el7.noarch.rpm | 284 kB 00:00:00 (19/19): zziplib-devel-0.13.62-5.el7.x86_64.rpm | 137 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------- 總計 2.0 MB/s | 5.5 MB 00:00:02 exiting because "Download Only" specified [root@lgs-01 yum.repos.d]# ls -l /root/ 總用量 46236 -rw-r--r--. 1 root root 3002982 4月 17 23:30 123.zip -rwxr-xr-x. 1 root root 8294 4月 1 21:56 1.txt.bak -rw-r--r--. 2 root root 8 3月 30 13:19 2_hard.txt.bak -rw-r--r--. 2 root root 8 3月 30 13:19 2.txt.bak -rw-r--r--. 1 root root 8089600 4月 17 23:43 333.tar -rw-r--r--. 1 root root 2685364 4月 17 23:53 5.tar.xz -rw-r--r--. 1 root root 4938672 4月 17 23:52 7.tar.bz2 -rw-r--r--. 1 root root 9984000 4月 17 23:47 888.tar -rw-r--r--. 1 root root 4095320 4月 17 23:50 9.tar.gz -rwxr-xr-x. 1 root root 3073568 4月 16 18:00 abc -rw-r--r--. 1 root root 1935360 4月 17 23:39 abc.tar -rw-r--r--. 1 root root 1090963 4月 17 23:18 abc.zip -rw-r--r--. 1 root root 980360 8月 10 2017 alsa-lib-devel-1.1.3-3.el7.x86_64.rpm -rw-------. 1 root root 1418 3月 20 09:22 anaconda-ks.cfg drwxr-xr-x. 3 root root 26 4月 17 23:36 b drwxr-sr-x. 4 root root 156 4月 17 23:34 c -rw-r--r--. 1 root root 890 6月 23 2017 dbd.TXT -rw-r--r--. 1 root root 1017536 7月 4 2014 gl-manpages-1.1-7.20130122.el7.noarch.rpm -rw-r--r--. 1 root root 123264 8月 11 2017 libdrm-devel-2.4.74-1.el7.x86_64.rpm -rw-r--r--. 1 root root 1003556 8月 11 2017 libX11-devel-1.6.5-1.el7.x86_64.rpm -rw-r--r--. 1 root root 14420 7月 4 2014 libXau-devel-1.0.8-2.1.el7.x86_64.rpm -rw-r--r--. 1 root root 1094380 8月 11 2017 libxcb-devel-1.12-1.el7.x86_64.rpm -rw-r--r--. 1 root root 9888 7月 4 2014 libXdamage-devel-1.1.4-4.1.el7.x86_64.rpm -rw-r--r--. 1 root root 76744 11月 25 2015 libXext-devel-1.3.3-3.el7.x86_64.rpm -rw-r--r--. 1 root root 13256 8月 11 2017 libXfixes-devel-5.0.3-1.el7.x86_64.rpm -rw-r--r--. 1 root root 21948 8月 11 2017 libXrandr-devel-1.5.1-2.el7.x86_64.rpm -rw-r--r--. 1 root root 17060 8月 11 2017 libXrender-devel-0.9.10-1.el7.x86_64.rpm -rw-r--r--. 1 root root 18840 8月 11 2017 libXxf86vm-devel-1.1.4-1.el7.x86_64.rpm -rw-r--r--. 1 root root 154944 8月 11 2017 mesa-libGL-devel-17.0.1-6.20170307.el7.x86_64.rpm -rw-r--r--. 1 root root 200876 7月 4 2014 mesa-libGLU-9.0.0-4.el7.x86_64.rpm -rw-r--r--. 1 root root 9188 7月 4 2014 mesa-libGLU-devel-9.0.0-4.el7.x86_64.rpm -rw-r--r--. 1 root root 920 4月 13 12:20 passwdtest -rw-r--r--. 1 root root 209280 11月 25 2015 SDL-1.2.15-14.el7.x86_64.rpm -rw-r--r--. 1 root root 363300 11月 25 2015 SDL-devel-1.2.15-14.el7.x86_64.rpm -rw-r--r--. 1 root root 290412 8月 12 2017 xorg-x11-proto-devel-7.7-20.el7.noarch.rpm -rw-r--r--. 1 root root 2032 4月 1 23:17 xxx.conf.xz -rw-r--r--. 1 root root 4350 1月 24 2017 zb.txt -rw-r--r--. 1 root root 2494444 4月 18 21:23 zsh-5.0.2-28.el7.x86_64.rpm -rw-r--r--. 1 root root 83176 4月 18 20:57 zziplib-0.13.62-5.el7.x86_64.rpm -rw-r--r--. 1 root root 140092 7月 4 2014 zziplib-devel-0.13.62-5.el7.x86_64.rpm
能夠只下載已經安裝過的rpm包,而不自動安裝:服務器
[root@lgs-01 yum.repos.d]# ls -l /var/cache/yum/x86_64/7/base/packages/ 總用量 0 [root@lgs-01 yum.repos.d]# yum reinstall -y zziplib --downloadonly 已加載插件:fastestmirror Loading mirror speeds from cached hostfile * epel: ftp.cuhk.edu.hk 正在解決依賴關係 --> 正在檢查事務 ---> 軟件包 zziplib.x86_64.0.0.13.62-5.el7 將被 已從新安裝 --> 解決依賴關係完成 依賴關係解決 =================================================================================================================================================== Package 架構 版本 源 大小 =================================================================================================================================================== 從新安裝: zziplib x86_64 0.13.62-5.el7 base 81 k 事務概要 =================================================================================================================================================== 從新安裝 1 軟件包 總下載量:81 k 安裝大小:211 k Background downloading packages, then exiting: zziplib-0.13.62-5.el7.x86_64.rpm | 81 kB 00:00:00 exiting because "Download Only" specified [root@lgs-01 yum.repos.d]# ls -l /var/cache/yum/x86_64/7/base/packages/ 總用量 84 -rw-r--r--. 1 root root 83176 7月 4 2014 zziplib-0.13.62-5.el7.x86_64.rpm
咱們使用源碼包安裝PHP7:網絡
下載PHP的源碼包
[root@lgs-01 yum.repos.d]# cd /usr/local/src/ [root@lgs-01 src]# ls apr-1.6.3 apr-util-1.6.1 httpd-2.4.33 mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz php-5.6.30.tar.bz2 apr-1.6.3.tar.gz apr-util-1.6.1.tar.bz2 httpd-2.4.33.tar.gz php-5.6.30 [root@lgs-01 src]# wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2 --2018-04-20 00:45:49-- http://cn2.php.net/distributions/php-7.1.6.tar.bz2 正在解析主機 cn2.php.net (cn2.php.net)... 123.125.23.168, 123.125.23.169, 123.125.23.171, ... 正在鏈接 cn2.php.net (cn2.php.net)|123.125.23.168|:80... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:15732452 (15M) [application/octet-stream] 正在保存至: 「php-7.1.6.tar.bz2」 100%[=========================================================================================================>] 15,732,452 992KB/s 用時 16s 2018-04-20 00:46:05 (970 KB/s) - 已保存 「php-7.1.6.tar.bz2」 [15732452/15732452]) [root@lgs-01 src]# ls -l php-7.1.6.tar.bz2 -rw-r--r--. 1 root root 15732452 6月 7 2017 php-7.1.6.tar.bz2
解壓源碼包:
[root@lgs-01 src]# tar jxvf php-7.1.6.tar.bz2 [root@lgs-01 src]# ls apr-1.6.3 apr-util-1.6.1 httpd-2.4.33 mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz php-5.6.30.tar.bz2 php-7.1.6.tar.bz2 apr-1.6.3.tar.gz apr-util-1.6.1.tar.bz2 httpd-2.4.33.tar.gz php-5.6.30 php-7.1.6
編譯源碼包:生成 make file
[root@lgs-01 php-7.1.6]# ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql/ -with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif #節省過程 creating libtool appending configuration tag "CXX" to libtool Generating files configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. config.status: creating php7.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands [root@lgs-01 php-7.1.6]# echo $? 0
安裝源碼包:生成二進制文件
[root@lgs-01 php-7.1.6]# make #節省過程 nd_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_sort.lo Zend/zend_multibyte.lo Zend/zend_ts_hash.lo Zend/zend_stream.lo Zend/zend_iterators.lo Zend/zend_interfaces.lo Zend/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_gc.lo Zend/zend_closures.lo Zend/zend_float.lo Zend/zend_string.lo Zend/zend_signal.lo Zend/zend_generators.lo Zend/zend_virtual_cwd.lo Zend/zend_ast.lo Zend/zend_objects.lo Zend/zend_object_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_inheritance.lo Zend/zend_smart_str.lo Zend/zend_execute.lo main/internal_functions_cli.lo main/fastcgi.lo sapi/cgi/cgi_main.lo -lcrypt -lresolv -lcrypt -lrt -lmcrypt -lpng -lz -ljpeg -lbz2 -lz -lrt -lm -ldl -lnsl -lpthread -lxml2 -lz -lm -ldl -lssl -lcrypto -lxml2 -lz -lm -ldl -lfreetype -lmysqlclient -lm -lrt -ldl -lmysqlclient -lm -lrt -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -o sapi/cgi/php-cgi Generating phar.php Generating phar.phar PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. directorytreeiterator.inc directorygraphiterator.inc pharcommand.inc clicommand.inc invertedregexiterator.inc phar.inc Build complete. Don't forget to run 'make test'. [root@lgs-01 php-7.1.6]# echo $? 0 [root@lgs-01 php-7.1.6]# make install Installing PHP SAPI module: apache2handler /usr/local/apache2.4/build/instdso.sh SH_LIBTOOL='/usr/local/apr/build-1/libtool' libphp7.la /usr/local/apache2.4/modules /usr/local/apr/build-1/libtool --mode=install install libphp7.la /usr/local/apache2.4/modules/ libtool: install: install .libs/libphp7.so /usr/local/apache2.4/modules/libphp7.so libtool: install: install .libs/libphp7.lai /usr/local/apache2.4/modules/libphp7.la libtool: warning: remember to run 'libtool --finish /usr/local/src/php-7.1.6/libs' chmod 755 /usr/local/apache2.4/modules/libphp7.so [activating module `php7' in /usr/local/apache2.4/conf/httpd.conf] Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/ Installing PHP CLI binary: /usr/local/php7/bin/ Installing PHP CLI man page: /usr/local/php7/php/man/man1/ Installing phpdbg binary: /usr/local/php7/bin/ Installing phpdbg man page: /usr/local/php7/php/man/man1/ Installing PHP CGI binary: /usr/local/php7/bin/ Installing PHP CGI man page: /usr/local/php7/php/man/man1/ Installing build environment: /usr/local/php7/lib/php/build/ Installing header files: /usr/local/php7/include/php/ Installing helper programs: /usr/local/php7/bin/ program: phpize program: php-config Installing man pages: /usr/local/php7/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php7/lib/php/ [PEAR] Archive_Tar - installed: 1.4.2 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.4 Wrote PEAR system config file at: /usr/local/php7/etc/pear.conf You may want to add: /usr/local/php7/lib/php to your php.ini include_path /usr/local/src/php-7.1.6/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin ln -s -f phar.phar /usr/local/php7/bin/phar Installing PDO headers: /usr/local/php7/include/php/ext/pdo/ [root@lgs-01 php-7.1.6]# echo $? 0
檢查是否安裝成功:
[root@lgs-01 php-7.1.6]# /usr/local/apache2.4/bin/apachectl -M AH00112: Warning: DocumentRoot [/usr/local/apache2.4/docs/dummy-host2.example.com] does not exist Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) reqtimeout_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared) php5_module (shared) php7_module (shared) [root@lgs-01 php-7.1.6]# ls -l /usr/local/apache2.4/modules/libphp7.so -rwxr-xr-x. 1 root root 38369320 4月 20 01:05 /usr/local/apache2.4/modules/libphp7.so