您的位置:首页 > 运维架构 > Nginx

CentOS安装Nginx

2016-03-14 23:15 483 查看
利用yum 命令, 可以简化Nginx的安装

本来可以一句:

yum install nginx --installroot=/usr/local/nginx

很遗憾报错了

YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. $releasever is not a valid and current release or hasnt been released yet/
removing mirrorlist with no valid mirrors: /usr/local/nginx/var/cache/yum/x86_64/$releasever/base/mirrorlist.txt
错误:Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again


看了官方, 是这么说的

To set up the yum repository for RHEL/CentOS, create the file named
/etc/yum.repos.d/nginx.repo
with the following contents:

Replace “
OS
” with “
rhel
” or “
centos
”, depending on the distribution used, and “
OSRELEASE
” with “
5
”, “
6
”, or “
7
”, for 5.x, 6.x, or 7.x versions, respectively.


[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: