-bash: yum: command not found (不能使用yum命令,離線安裝yum)
<div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post"> <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-e2445db1a8.css"> <div class="htmledit_views"> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <strong>解決: -bash: yum: command not found錯誤</strong></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 最近在學習Linux,今天不小心在<strong>CentOS7</strong>系統下把yum命令給刪除了,於是百度了好幾篇文章,實話照他們的操作去做,實在不敢說啥,只得自己手動了.......</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <br></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <strong>步驟如下</strong></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <strong>第一步:</strong></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <a href="http://mirrors.163.com/centos/6/os/x86_64/Packages/" rel="nofollow" style="text-decoration:none;color:rgb(49,139,146);" target="_blank">http://mirrors.163.com/centos/6/os/x86_64/Packages/</a></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 到上面這個網站去下載如下RPM包</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:#FE5D02;line-height:21px;"> python-iniparse-0.3.1-2.1.el6.noarch.rpm</span></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:#FE5D02;line-height:21px;"> yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm </span></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:#FE5D02;line-height:21px;"> yum-3.2.29-69.el6.centos.noarch.rpm</span></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:#FE5D02;line-height:21px;"> yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm</span></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 下載完成之後,用rpm命令進行安裝,如下:</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:#0411FC;line-height:21px;"> rpm -ivh --force --nodeps python-iniparse-0.3.1-2.1.el6.noarch.rpm<br> rpm -ivh --force --nodeps yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm <br> rpm -ivh --force --nodeps yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fa<br> stestmirror-1.1.30-30.el6.noarch.rpm</span></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 這裡安裝的時候需要注意,一定要加 --force --nodeps不然會報錯安裝不上</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 到這一步了當你輸入yum命令的時候出現如下錯誤:</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <a href="http://photo.blog.sina.com.cn/showpic.html#blogid=643754960102w82m&url=http://album.sina.com.cn/pic/001PMLlQgy70SHUHIZld3" rel="nofollow" style="text-decoration:none;color:rgb(49,139,146);" target="_blank"><img src="http://s4.sinaimg.cn/mw690/001PMLlQgy70SHUHIZld3&690" name="image_operate_85141460541675136" alt="-bash: <wbr>yum: <wbr>command <wbr>not <wbr>found" title="-bash: <wbr>yum: <wbr>command <wbr>not <wbr>found" style="border:0px;list-style:none;"></a></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <br></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <strong>第二步:</strong></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 根據上圖的提示到 <a href="http://yum.baseurl.org/wiki" rel="nofollow" style="text-decoration:none;color:rgb(49,139,146);" target="_blank">http://yum.baseurl.org/wiki</a><br></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 下載<u><span style="color:#0066CC;line-height:21px;">yum-3.4.3.tar.gz</span></u> ,放到你指定的目錄下解壓,解壓命令如下:</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:#0027FD;line-height:21px;">tar -zxvf yum-3.4.3.tar.gz #解壓後進到yum-3.4.3目錄</span></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:rgb(0,39,253);line-height:21px;"> </span></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 輸入如下命令</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <span style="color:#0027FD;line-height:21px;">./yummain.py update </span>如下圖:</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <a href="http://photo.blog.sina.com.cn/showpic.html#blogid=643754960102w82m&url=http://album.sina.com.cn/pic/001PMLlQgy70SIuGEIof0" rel="nofollow" style="text-decoration:none;color:rgb(49,139,146);" target="_blank"><img src="http://s1.sinaimg.cn/mw690/001PMLlQgy70SIuGEIof0&690" name="image_operate_46311460541677655" alt="-bash: <wbr>yum: <wbr>command <wbr>not <wbr>found" title="-bash: <wbr>yum: <wbr>command <wbr>not <wbr>found" style="border:0px;list-style:none;"></a><br><br></div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> 注意紅框中的操作,完成之後,你試著輸入一下yum 就OK了,如下圖:</div> <div style="color:rgb(50,62,50);font-family:'Microsoft YaHei', 'Helvetica Neue', SimSun;font-size:14px;background-color:rgb(156,174,193);"> <a href="http://photo.blog.sina.com.cn/showpic.html#blogid=643754960102w82m&url=http://album.sina.com.cn/pic/001PMLlQgy70SIDZFaxb9" rel="nofollow" style="text-decoration:none;color:rgb(49,139,146);" target="_blank"><img src="http://s10.sinaimg.cn/mw690/001PMLlQgy70SIDZFaxb9&690" name="image_operate_9501460541690831" alt="-bash: <wbr>yum: <wbr>command <wbr>not <wbr>found" title="-bash: <wbr>yum: <wbr>command <wbr>not <wbr>found" style="border:0px;list-style:none;"></a></div> </div> </div>