第一步
添加 可信任的key:
touch ~/nginx_signing.key
sudo vi ~/nginx_signing.key
把官方提供的 key加进去,这里是key的 url
sudo apt-key add ~/nginx_signing.key
第二步
/etc/apt/sources.list file 末尾处 添加官方源
RHEL/CentOS:
Version 5.x 6.x
Debian:
Version Codename 6.x squeeze 7.x wheezy
Ubuntu:
我的是12 .04 所以 选择 precise
Version Codename 10.04 lucid 11.10 oneiric 12.04 precise 12.10 quantal 13.04 raring
deb http://nginx.org/packages/ubuntu/ precise nginx
deb-src http://nginx.org/packages/ubuntu/ precise nginx
第3 步
apt-get update
apt-get install nginx
但是 我安装 的时候 出现了这个版本冲突错误 。
正在解压缩 nginx (从 .../nginx_1.4.3-1~precise_i386.deb) ...
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
dpkg:处理 /var/cache/apt/archives/nginx_1.4.3-1~precise_i386.deb (--unpack)时出错:
正试图覆盖 /usr/sbin/nginx,它同时被包含于软件包 nginx-full 1.1.19-1ubuntu0.2
由于已经达到 MaxReports 限制,没有写入 apport 报告。
dpkg-deb: error: subprocess 粘贴 was killed by signal (断开的管道)
在处理时有错误发生:
/var/cache/apt/archives/nginx_1.4.3-1~precise_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
仔细一想 原来我之前 换源之前 已经安装过 1.1.19 版本的, 没卸载干净
我之前 是直接
apt-get remove nginx 进行卸载的
还有 nginx-common 和 nginx-full 没卸载
sudo apt-get remove nginx-full
sudo apt-get autoremove
卸载干净了
开始安装
sudo apt-get install nginx
成功