Redhat 7.0 配置yum源
由於在安裝Redhat7 想安裝gcc 使用yum install gcc 報錯:
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
大概意思是讓先註冊一下,這是redhat 自帶的yum需要註冊。
---------------------
第一步:先解除安裝原來的yum
[[email protected] ~]# rpm -qa |grep yum (檢視原來是否安裝
[[email protected] ~]# rpm -qa|grep yum|xargs rpm -e –-nodeps (直接解除安裝)
第二步:下載替換包
新建目錄 mkdir /home/yum (上傳到這裡yum下面)
執行: rpm -ivh *.rpm 一次性安裝依賴包。
[[email protected] yum]# rpm -ivh *.rpm
第三步 : 新建配置檔案 1.repo
(home/yum/1.repo
vim 1.repo
第四步: 把下面的配置檔案複製到 1.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
第五步:清楚快取
[[email protected] yum.repos.d]# yum cear all
[[email protected] yum.repos.d]# yum makecache
既yum配置完成。