RHEL7配置yum源

配置yum源:
[root@warner ~]# umount /dev/sr0
[root@warner ~]# mount /dev/sr0 /mnt
mount: /dev/sr0 is write-protected, mounting read-only
[root@warner ~]# yum-config-manager --add-repo="file:///mnt"
Loaded plugins: langpacks, product-id
adding repo from: file:///mnt


[mnt]
name=added from: file:///mnt
baseurl=file:///mnt
enabled=1
 
[root@warner ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 
查询用哪个包:
[root@warner selinux]# yum provides seinfo
yum网络源配置
1.下载源地址文件
wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
只留第一个源即可,若都留下则可能出现多个源冲突的错误
可以不用加http: // mirrors.163.com /centos/7/os/x86_64/repodata/repomd.xml 
2.mv CentOS6-Base-163.repo rhel-source.repo
3.$releasever更改为centos的版本号
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
下面的6改成7
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6==>
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


用网上yum源安装软件步骤:
1.下载源地址文件
wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
2.打开CentOS6-Base-163.repo
vi CentOS6-Base-163.repo
删除19行以后的内容(:set nu显示行号)将光标定位到19行(19G),输入:dG
3.15行$releasever更改为centos的版本号,改为7,如下:
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
下面18行的6改成7
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6==>
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

你可能感兴趣的:(RHCE)