Redhat7 安裝 yum源(親測有效)


由於之前安裝Redhat7 想安裝vsftpd  使用yum   install vsftpd 報錯:

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

大概意思是是讓你先注冊一下。

這是redhat 自帶的 yum 源需要注冊,花錢才能使用,鄙人比較窮,怎么辦呢,發現網上說可以替換,於是開始擼,中間也有不少心酸。把心得寫下來!!!

 

第一步:先卸載原來的yum  

 rpm -qa |grep yum    查看原來是否安裝

yum-3.4.3-118.el7.noarch
yum-utils-1.1.31-24.el7.noarch
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64

直接卸載:

 rpm -qa|grep yum|xargs rpm -e --nodeps

在次運行  :rpm -qa |grep yum  發現卸載干凈了。

 

 

 

第二步 下載 yum 替換包

這里博主要說明一下,因為要替換,所以一定要是一整套,還有一個rhel-debuginfo.repo文件要配置。部分博客寫的就不對了,這個文件配置不對也是不行的,所以博主把測試好的一套yum包給大家包括配置文件。需要留言我。 (最下方有分享鏈接)

 

可以先 mkdir  /home/yum    新建一個文件夾

把5個安裝包拷貝到 yum 這個文件下面

執行: rpm -ivh *.rpm  一次性執行依賴包,因為包之間會相互依賴。

 

 

 

第三步 新建配置   .repo 文件

vim /etc/yum.repos.d/CentOS-Base.repo

輸入內容如下:

#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

 

當然你也可以把我的yum 包里面的文件拷貝出來。放到這個文件夾下面 替換成上面的文件名就行。

第五步  清除緩存

yum clear all

然后執行yum makecache清除緩存,就可以看見列表刷新了。

 

好了擼完!


---------------------------------分割線20210117--------

應各位要求,現將配置文件分享出。

鏈接:https://pan.baidu.com/s/18QPANezXg1kg2pQRNATvaQ
提取碼:5qoe
----------------------------------------------------------------


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM