Centos下yum安裝nginx本地倉(cāng)庫(kù)無(wú)nginx源解決方案
一、在CentOS下使用yum install -y nginx 命令時(shí),出現(xiàn)如下錯(cuò)誤:
[root@hadoop100 /]#yum install -y nginx
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
沒(méi)有可用軟件包 nginx。
錯(cuò)誤:無(wú)須任何處理
二、問(wèn)題原因
nginx位于第三方的yum源里面,而不在centos官方y(tǒng)um源里面
三、解決方法
查看系統(tǒng)是6還是7
[root@hadoop100 /]# cat /etc/redhat-release

在使用yum install命令時(shí),可以直接指定安裝包的https下載路徑,如下:
RHEL/CentOS 6:
# yum install http://www.tjdsmy.cn/pub/epel/epel-release-latest-6.noarch.rpm
RHEL/CentOS 7:
# yum install http://www.tjdsmy.cn/pub/epel/epel-release-latest-7.noarch.rpm
另外說(shuō)明,如果在RHEL上安裝,還需要安裝與啟動(dòng)EPEL相關(guān)的組件;
# subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms"
執(zhí)行下面的命令
[root@hadoop100 /] yum install http://www.tjdsmy.cn/pub/epel/epel-release-latest-7.noarch.rpm
再次執(zhí)行安裝命令即可
方案二:直接下載一個(gè)epel源替代系統(tǒng)的軟件源:
配置yum源、epel源為國(guó)內(nèi)鏡像
cd /etc/yum.repos.d
獲取阿里centos7的base-repo
wget http://www.tjdsmy.cn/repo/epel-7.repo
會(huì)員登錄
賬號(hào)登錄還沒(méi)有賬號(hào)?立即注冊(cè)