linux yum配置本地iso镜像
1、本地源配置:cdiso.repo
将iso镜像文件中所有内容复制到/public/software/cdrom 中,节点将本地yum指向此处。
[root@node19 ~]# vim /etc/yum.repos.d/cdiso.repo [cd1] name=cd1 baseurl=file:///public/software/cdrom enabled=1 gpgcheck=0
2、本地源配置:file.repo
mount -o loop xxxx.iso /mnt/iso
如果/etc/yum.repos.d/下面有其它的*.repo文件,先创建个备份文件夹,将这些repo先转移到文件夹中,自己写一个新的.repo的文件
vi /etc/yum.repos.d/file.repo 添加如下内容: [base] name=rhel6repo baseurl=file:///mnt/iso enabled=1 gpgckeck=0 gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release 5.清除cache yum clean all 6.验证是否成功 yum -y install tree tree
3、网络源配置
# cat /etc/yum.repos.d/cent6-epel.repo [base] name=CentOS-6 - Base - mirrors.ustc.edu.cn baseurl=http://mirrors.ustc.edu.cn/centos/6/os/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=&repo=os gpgcheck=0 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6 - Updates - mirrors.ustc.edu.cn baseurl=http://mirrors.ustc.edu.cn/centos/6/updates/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=&repo=updates gpgcheck=0 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6 - Extras - mirrors.ustc.edu.cn baseurl=http://mirrors.ustc.edu.cn/centos/6/extras/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=&repo=extras gpgcheck=0 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6 - Plus - mirrors.ustc.edu.cn baseurl=http://mirrors.ustc.edu.cn/centos/6/centosplus/x86_64/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6 - Contrib - mirrors.ustc.edu.cn baseurl=http://mirrors.ustc.edu.cn/centos/6/contrib// #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 [epel] name=Extra Packages for Enterprise Linux 6 - baseurl=http://mirrors.ustc.edu.cn/epel/6/x86_64/ #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch= failovermethod=priority enabled=1 gpgcheck=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 [epel-debuginfo] name=Extra Packages for Enterprise Linux 6 - - Debug baseurl=http://mirrors.ustc.edu.cn/epel/6/x86_64/debug #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch= failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1 [epel-source] name=Extra Packages for Enterprise Linux 6 - - Source baseurl=http://mirrors.ustc.edu.cn/epel/6/SRPMS #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch= failovermethod=priority enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgcheck=1 测试是否正常运行 yum list