2019年3月30日 星期六

樹莓派安裝 Nginx 伺服器失敗

下午嘗試在樹莓派安裝 Nginx 伺服器, 結果失敗, 過程紀錄如下 :

1. 更新 apt-get 列表 :

pi@raspberrypi:~ $ sudo apt-get update

2. 安裝 Nginx 伺服器 :

pi@raspberrypi:~ $ sudo apt-get install nginx 
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  nginx-common nginx-full
Suggested packages:
  fcgiwrap nginx-doc
The following NEW packages will be installed:
  nginx nginx-common nginx-full
0 upgraded, 3 newly installed, 0 to remove and 294 not upgraded.
Need to get 535 kB of archives.
After this operation, 1,263 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main nginx-common all 1.6.2-5+deb8u6 [88.4 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main nginx-full armhf 1.6.2-5+deb8u6 [374 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main nginx all 1.6.2-5+deb8u6 [72.9 kB]
Fetched 535 kB in 3s (146 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 135208 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.6.2-5+deb8u6_all.deb ...
Unpacking nginx-common (1.6.2-5+deb8u6) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.6.2-5+deb8u6_armhf.deb ...
Unpacking nginx-full (1.6.2-5+deb8u6) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.6.2-5+deb8u6_all.deb ...
Unpacking nginx (1.6.2-5+deb8u6) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up nginx-common (1.6.2-5+deb8u6) ...
Setting up nginx-full (1.6.2-5+deb8u6) ...
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error processing package nginx-full (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-full (>= 1.6.2-5+deb8u6) | nginx-light (>= 1.6.2-5+deb8u6) | nginx-extras (>= 1.6.2-5+deb8u6); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-full (>> 1.6.2-5+deb8u6.1~) | nginx-light (>> 1.6.2-5+deb8u6.1~) | nginx-extras (>> 1.6.2-5+deb8u6.1~); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
Processing triggers for systemd (215-17+deb8u6) ...
Errors were encountered while processing:
 nginx-full
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

看起來是安裝失敗, 下 start 指令出現錯誤 :

pi@raspberrypi:~ $ sudo service nginx start
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.

我搜尋到下面這篇 :


作者的做法是用 wget 去 Nginx 官網下載最新版 : 


我挑選 stable 的 1.14.2 版來試 :

1. 下載 tar.gx 檔 : 

pi@raspberrypi:~ $ sudo wget http://nginx.org/download/nginx-1.14.2.tar.gz  
--2019-03-30 14:12:43--  http://nginx.org/download/nginx-1.14.2.tar.gz
Resolving nginx.org (nginx.org)... 62.210.92.35, 95.211.80.227, 2001:1af8:4060:a004:21::e3
Connecting to nginx.org (nginx.org)|62.210.92.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1015384 (992K) [application/octet-stream]
Saving to: ‘nginx-1.14.2.tar.gz’

nginx-1.14.2.tar.gz 100%

2019-03-30 14:12:47 (379 KB/s) - ‘nginx-1.14.2.tar.gz’ saved [1015384/1015384]

2. 解壓縮 : 

pi@raspberrypi:~ $ sudo tar zxvf nginx-1.14.2.tar.gz   
nginx-1.14.2/
nginx-1.14.2/auto/
nginx-1.14.2/conf/
nginx-1.14.2/contrib/
.......

3. 下載安裝相依套件 :

pi@raspberrypi:~ $ sudo apt-get install libpcre3* libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libpcre-ocaml-dev-ypu03' for regex 'libpcre3*'
Note, selecting 'libpcre3-dbg' for regex 'libpcre3*'
Note, selecting 'libpcre3-dev' for regex 'libpcre3*'
......

Setting up libssl1.0.0:armhf (1.0.1t-1+deb8u11) ...
Setting up nginx-full (1.6.2-5+deb8u6) ...
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error processing package nginx-full (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-full (>= 1.6.2-5+deb8u6) | nginx-light (>= 1.6.2-5+deb8u6) | nginx-extras (>= 1.6.2-5+deb8u6); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-full (>> 1.6.2-5+deb8u6.1~) | nginx-light (>> 1.6.2-5+deb8u6.1~) | nginx-extras (>> 1.6.2-5+deb8u6.1~); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
Setting up libpcre++0:armhf (0.9.5-6) ...
Setting up ocaml-base-nox (4.01.0-5+rpi1) ...
Setting up ledit (2.03-2) ...
update-alternatives: using /usr/bin/ledit to provide /usr/bin/readline-editor (readline-editor) in auto mode
Setting up libfindlib-ocaml (1.4.1-1) ...
Setting up libpcre-ocaml (7.0.4-1) ...
Setting up ocaml-findlib (1.4.1-1) ...
Setting up libssl-dev:armhf (1.0.1t-1+deb8u11) ...
Setting up libssl-doc (1.0.1t-1+deb8u11) ...
Setting up libpcre++-dev (0.9.5-6) ...
Setting up libpcre3-dbg:armhf (2:8.35-3.3+deb8u4) ...
Setting up ocaml-compiler-libs (4.01.0-5+rpi1) ...
Setting up ocaml-interp (4.01.0-5+rpi1) ...
Setting up ocaml-nox (4.01.0-5+rpi1) ...
Setting up camlp4 (4.01.0-5+rpi1) ...
Setting up libfindlib-ocaml-dev (1.4.1-1) ...
Setting up libpcre-ocaml-dev (7.0.4-1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Errors were encountered while processing:
 nginx-full
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

問題是一樣的.

查詢 Raspbian Jessie 的 Dabian 版本 : 

pi@raspberrypi:~ $ cat /etc/debian_version
8.0

難道 Jessie 已經太舊了嗎?

沒有留言 :