## 水電費費‘
```
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
```
安裝報錯
```
tinywan@ubuntu:$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
zlib1g-dev : Depends: zlib1g (= 1:1.2.8.dfsg-1ubuntu1.1) but 1:1.2.11.dfsg-0ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.
```
## 解決方案:
查看以安裝的zlib
```
tinywan@ubuntu:~/Downloads$ dpkg -l | grep zlib1g
ii zlib1g:amd64 1:1.2.11.dfsg-0ubuntu2 amd64
```
問題在于,當前系統以安裝的 libc6的版本為“2.19-10ubuntu2?” ,而我們安裝其他軟件(包括build-essential 、g++等)的時候,所依賴的是“2.19-0ubuntu6.9”?。
也就是問題在于, 依賴的某個軟件的版本,跟系統以安裝的版本不一致。但 apt-get又不會自動去卸載以安裝的自動安裝上依賴的目標版本。 所以導致我們需要手動去解決這個問題。 ?當前解決這個問題辦法有很多種,我們這里選擇了,直接強制覆蓋安裝目標版本,替代原來系統已安裝的版本。
```
```
### 再查看libc6的已安裝信息:
再安裝其他原來安裝過程報類似錯誤的軟件:
```
# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
```
從以上安裝過程看出來,成功安裝了。 ?
我們再次執行如下命令 通過dpkg來查詢具體安裝信息:
```
root@ubuntu:/etc/apt# dpkg -l | grep -E "zlib1g-dev|libc6-dev|libc-dev|libmysqlclient-dev"
ii ?libc-dev-bin ? ? ? ? ? ? ? ? ? ? ? ?2.19-0ubuntu6.9 ? ? ? ? ? ? ? ? ? ? amd64 ? ? ? ?Embedded GNU C Library: Development binaries
ii ?libc6-dev:amd64 ? ? ? ? ? ? ? ? ? ? 2.19-0ubuntu6.9 ? ? ? ? ? ? ? ? ? ? amd64 ? ? ? ?Embedded GNU C Library: Development Libraries and Header Files
ii ?libmysqlclient-dev ? ? ? ? ? ? ? ? ?5.5.54-0ubuntu0.14.04.1 ? ? ? ? ? ? amd64 ? ? ? ?MySQL database development files
ii ?linux-libc-dev:amd64 ? ? ? ? ? ? ? ?3.13.0-108.155 ? ? ? ? ? ? ? ? ? ? ?amd64 ? ? ? ?Linux Kernel Headers for development
ii ?zlib1g-dev:amd64 ? ? ? ? ? ? ? ? ? ?1:1.2.8.dfsg-1ubuntu1 ? ? ? ? ? ? ? amd64 ? ? ? ?compression library - development
```
再次確認build-essential ?是否可以成功安裝:
```
# dpkg -l | grep build-essential
```
當前系統沒有安裝 build-essential。
```
# dpkg -l | grep g++
```
當前系統沒有安裝?g++。
```
# dpkg -l | grep gcc
ii ?gcc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4:4.8.2-1ubuntu6 ? ? ? ? ? ? ? ? ? ?amd64 ? ? ? ?GNU C compiler
ii ?gcc-4.8 ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4.8.4-2ubuntu1~14.04.3 ? ? ? ? ? ? ?amd64 ? ? ? ?GNU C compiler
ii ?gcc-4.8-base:amd64 ? ? ? ? ? ? ? ? ?4.8.4-2ubuntu1~14.04.3 ? ? ? ? ? ? ?amd64 ? ? ? ?GCC, the GNU Compiler Collection (base package)
ii ?gcc-4.9-base:amd64 ? ? ? ? ? ? ? ? ?4.9.1-16ubuntu6 ? ? ? ? ? ? ? ? ? ? amd64 ? ? ? ?GCC, the GNU Compiler Collection (base package)
ii ?libgcc-4.8-dev:amd64 ? ? ? ? ? ? ? ?4.8.4-2ubuntu1~14.04.3 ? ? ? ? ? ? ?amd64 ? ? ? ?GCC support library (development files)
ii ?libgcc1:amd64 ? ? ? ? ? ? ? ? ? ? ? 1:4.9.1-16ubuntu6 ? ? ? ? ? ? ? ? ? amd64 ? ? ? ?GCC support library
```
安裝?build-essential (g++也會被附帶安裝,所以只要安裝這個基礎套件,基本的編譯環境就ok了):?
```
# apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
? g++ g++-4.8 libstdc++-4.8-dev
Suggested packages:
? g++-multilib g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg libstdc++-4.8-doc
The following NEW packages will be installed:
? build-essential g++ g++-4.8 libstdc++-4.8-dev
0 upgraded, 4 newly installed, 0 to remove and 75 not upgraded.
Need to get 19.2 MB of archives.
After this operation, 40.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libstdc++-4.8-dev amd64 4.8.4-2ubuntu1~14.04.3 [1,053 kB]
Get:2 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main g++-4.8 amd64 4.8.4-2ubuntu1~14.04.3 [18.1 MB]
Get:3 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1,490 B]
Get:4 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4,838 B]
Fetched 19.2 MB in 1s (9,947 kB/s)
Selecting previously unselected package libstdc++-4.8-dev:amd64.
(Reading database ... 72784 files and directories currently installed.)
Preparing to unpack .../libstdc++-4.8-dev_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Selecting previously unselected package g++-4.8.
Preparing to unpack .../g++-4.8_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking g++-4.8 (4.8.4-2ubuntu1~14.04.3) ...
Selecting previously unselected package g++.
Preparing to unpack .../g++_4%3a4.8.2-1ubuntu6_amd64.deb ...
Unpacking g++ (4:4.8.2-1ubuntu6) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../build-essential_11.6ubuntu6_amd64.deb ...
Unpacking build-essential (11.6ubuntu6) ...
Processing triggers for man-db (2.7.0.2-2) ...
#
```
安裝過程成功走完,并且無任何報錯提示。
檢查?build-essential ? 和 g++是否成功安裝:
```
# dpkg -l | grep -E "build-essential|g\+\+"
ii ?build-essential ? ? ? ? ? ? ? ? ? ? 11.6ubuntu6 ? ? ? ? ? ? ? ? ? ? ? ? amd64 ? ? ? ?Informational list of build-essential packages
ii ?g++ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4:4.8.2-1ubuntu6 ? ? ? ? ? ? ? ? ? ?amd64 ? ? ? ?GNU C++ compiler
ii ?g++-4.8 ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4.8.4-2ubuntu1~14.04.3 ? ? ? ? ? ? ?amd64 ? ? ? ?GNU C++ compiler?
```
確定已成功安裝!!!!
最終問題解決。
? ? ?這里有個深層次的原因: Ubuntu 14.10 版本在當前(2016/2017)已經從維護名單里面去除了,相應的源也不再支持,所以導致原始匹配版本的源無法使用,ping不通服務器ip。 而我這里配置的是 14.04對應的源, 其安裝軟件時依賴的版本是與 14.10是有差異的,所以導致 安裝一些軟件的時候, 依賴的軟件的版本總是比當前系統已經安裝的版本要低。 導致依賴沖突,最終導致安裝軟件無法順利進行。
---------------------
- 序言
- Nginx從入門到實踐
- 第一章 前言
- 第二章 基礎篇
- 2-1 什么是Nginx?
- 2-2 常見的中間件服務
- 2-3 Nginx特性-多路復用
- 2-4 Nginx特性-輕量級
- 2-5 Nginx特性-Cpu親和
- 2-6 Nginx特性_實現優點4
- 2-7 Nginx的快速安裝
- 2-8 Nginx安裝目錄
- 2-9 Nginx編譯配置參數
- 2-10 Nginx默認配置語法
- 2-11 Nginx默認站點啟動
- 2-12 HTTP請求
- 2-13 Nginx日志
- 2-14 Nginx模塊介紹
- 2-15 Nginx的請求限制
- 2-16 Nginx的訪問控制
- 第三章 場景實踐篇
- 3-1 Nginx作為靜態資源web服務
- 1、靜態資源類型
- 2、CDN場景
- 3、配置語法
- 4、場景演示
- 5、瀏覽器緩存原理
- 6、跨站訪問
- 7、防盜鏈
- 3-2 Nginx作為代理服務
- 1、代理服務.
- 2、反向代理配置場景
- 3、正向代理配置場景
- 4、代理配置和規范
- 3-3 Nginx作為負載均衡服務
- 1、配置語法與場景
- 2、參數講解
- 3、backup狀態演示
- 4、輪詢策略
- 3-4 Nginx作為緩存服務
- 1、緩存服務配置語法
- 2、場景配置演示.
- 3、分片請求
- 第四章 深度學習篇
- 4-1 Nginx動靜分離
- 4-2 Rewrite規則
- 1、配置語法
- 2、正則表達式
- 3、規則中的flag
- 4、redirect和permanent區別
- 5、規則場景
- 4-3 Nginx進階高級模塊
- 1、secure_link模塊作用原理
- 2、Geoip讀取地域信息模塊
- 4-4 基于Nginx的HTTPS服務
- 1、原理和作用
- 2、證書簽名生成CA證書.
- 3、實戰場景配置蘋果要求的openssl
- 4、HTTPS服務優化
- 4-5 Nginx與Lua的開發
- 1、Nginx與Lua特性與優勢
- 2、Lua基礎開發語法
- 3、Lua的指令及api接口
- 4、實戰場景灰度發布
- 第五章 Nginx架構篇
- 安全
- 5-27 Nginx+LUA防火墻功能
- Nginx 錯誤專題
- 1、 Failed to parse PID from file
- 2、error: the HTTP gzip module requires the zlib library
- 3、open() “/usr/local/nginx/html/favicon.ico” failed (2: No such file or directory)
- Openresty
- 控制命令