我在 CentOS 6,nginx 1.6.3 上
$nginx -v
nginx version: nginx/1.6.3
我想将 nginx 升级到 1.8,因为add_header [always] 指令需要
我关注https://webtatic.com/packages/nginx18/进行升级,但出现以下错误
$yum list nginx*
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.service.networklayer.com
* epel: free.nchc.org.tw
* extras: mirrors.service.networklayer.com
* updates: mirrors.service.networklayer.com
* webtatic: uk.repo.webtatic.com
Installed Packages
nginx16.x86_64 1.6.3-1.w6 @webtatic
Available Packages
nginx18.x86_64 1.8.0-1.w6 webtatic
当我跑步时yum install -y nginx18
,它给出
Transaction Check Error:
file /usr/sbin/nginx from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
file /usr/lib64/perl5/vendor_perl/auto/nginx/nginx.so from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
file /usr/lib64/perl5/vendor_perl/nginx.pm from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
file /usr/share/man/man3/nginx.3pm.gz from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
Error Summary
有人可以指导我如何在 CentOS 6 上将 nginx 从 1.6.3 升级到 1.8 吗?理想情况下,不要先yum remove
安装 nginx16,然后再安装 nginx18,因为这样会导致服务器停机。
答案1
由于 nginx 包不支持同时安装多个版本,因此您需要卸载旧版本并安装新版本:
$ yum remove nginx16
$ yum install nginx18
或者你可以尝试
$ yum install yum-plugin-replace
$ yum replace nginx16 --replace-with=nginx18
$ service nginx restart
但最好先在测试服务器上进行测试。