分享

CentOS下安装nginx并且升级nginx到最新版

 jyhjun 2016-04-16

CentOS下安装nginx并且升级nginx到最新版




时间:2015-05-05 15:13来源:blog.csdn.net  作者:Level_meng 举报   点击:3341次


           





Centos6.5  



 





[html] view plaincopy在CODE上查看代码片派生到我的代码片





  1. 自动安装选择最快的源  


  2. [root@localhost ~]# yum install yum-fastestmirror  



这里 我已经安装过,运行结果如下


 



 





[html] view plaincopy在CODE上查看代码片派生到我的代码片





  1. Loaded plugins: fastestmirror, refresh-packagekit, security  


  2. Loading mirror speeds from cached hostfile  


  3.  * base: ftp.riken.jp  


  4.  * epel: mirrors.zju.edu.cn  


  5.  * extras: ftp.riken.jp  


  6.  * updates: ftp.riken.jp  


  7. Setting up Install Process  


  8. Package yum-plugin-fastestmirror-1.1.30-30.el6.noarch already installed and latest version  




 



安装nginx



yum install nginx 



 





[html] view plaincopy在CODE上查看代码片派生到我的代码片





  1. [root@localhost ~]# yum install nginx  


  2. Loaded plugins: fastestmirror, refresh-packagekit, security  


  3. Loading mirror speeds from cached hostfile  


  4.  * base: ftp.riken.jp  


  5.  * epel: mirrors.opencas.cn  


  6.  * extras: ftp.riken.jp  


  7.  * updates: ftp.riken.jp  


  8. Setting up Install Process  


  9. Package nginx-1.8.0-1.el6.ngx.x86_64 already installed and latest version  




 



 


平滑升级


yum update nginx



执行命令前,首先配置nginx 源





[html] view plaincopy在CODE上查看代码片派生到我的代码片





  1. [root@localhost ~]# vim /etc/yum.repos.d/nginx.repo  








[html] view plaincopy在CODE上查看代码片派生到我的代码片





  1. #nginx.repo  


  2.   


  3. [nginx]  


  4. name=nginx repo  


  5. baseurl=http://nginx.org/packages/centos/6/$basearch/  


  6. gpgcheck=0  


  7. enabled=1  






[html] view plaincopy在CODE上查看代码片派生到我的代码片





  1. </pre><pre code_snippet_id="659047" snippet_file_name="blog_20150505_7_9989798" name="code" class="html">yum update nginx  




 



执行结果与检查如下



 





[html] view plaincopy在CODE上查看代码片派生到我的代码片





  1. [root@localhost ~]# yum update nginx  


  2. Loaded plugins: fastestmirror, refresh-packagekit, security  


  3. Loading mirror speeds from cached hostfile  


  4.  * base: ftp.riken.jp  


  5.  * epel: ftp.cuhk.edu.hk  


  6.  * extras: ftp.riken.jp  


  7.  * updates: ftp.riken.jp  


  8. nginx                                                                                                                                                            | 2.9 kB     00:00       


  9. nginx/primary_db                                                                                                                                                 |  37 kB     00:00       


  10. Setting up Update Process  


  11. Resolving Dependencies  


  12. --> Running transaction check  


  13. ---> Package nginx.x86_64 0:1.0.15-11.el6 will be updated  


  14. ---> Package nginx.x86_64 0:1.8.0-1.el6.ngx will be an update  


  15. --> Finished Dependency Resolution  


  16.   


  17. Dependencies Resolved  


  18.   


  19. ========================================================================================================================================================================================  


  20.  Package                                  Arch                                      Version                                              Repository                                Size  


  21. ========================================================================================================================================================================================  


  22. Updating:  


  23.  nginx                                    x86_64                                    1.8.0-1.el6.ngx                                      nginx                                    352 k  


  24.   


  25. Transaction Summary  


  26. ========================================================================================================================================================================================  


  27. Upgrade       1 Package(s)  


  28.   


  29. Total download size: 352 k  


  30. Is this ok [y/N]: y  


  31. Downloading Packages:  


  32. nginx-1.8.0-1.el6.ngx.x86_64.rpm                                                                                                                                 | 352 kB     00:03       


  33. Running rpm_check_debug  


  34. Running Transaction Test  


  35. Transaction Test Succeeded  


  36. Running Transaction  


  37.   Updating   : nginx-1.8.0-1.el6.ngx.x86_64                                                                                                                                         1/2   


  38.   Cleanup    : nginx-1.0.15-11.el6.x86_64                                                                                                                                           2/2   


  39.   Verifying  : nginx-1.8.0-1.el6.ngx.x86_64                                                                                                                                         1/2   


  40.   Verifying  : nginx-1.0.15-11.el6.x86_64                                                                                                                                           2/2   


  41.   


  42. Updated:  


  43.   nginx.x86_64 0:1.8.0-1.el6.ngx                                                                                                                                                          


  44.   


  45. Complete!  


  46. [root@localhost ~]# service nginx stop  


  47. 停止 nginx:                                               [确定]  


  48. [root@localhost ~]# service nginx start  


  49. 正在启动 nginx:                                           [确定]  


  50. [root@localhost ~]# nginx -v  


  51. nginx version: nginx/1.8.0  





当前nginx版本为 1.8.0   (nginx -v

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多